18 lines
384 B
Python
18 lines
384 B
Python
|
import os
|
||
|
import telegram
|
||
|
import logging
|
||
|
|
||
|
|
||
|
class TelegramHandler:
|
||
|
def __init__(self):
|
||
|
token = os.environ['TELEGRAM_PLUTO_BOT_TOKEN']
|
||
|
if not token:
|
||
|
logging.error('The TELEGRAM_TOKEN must be set')
|
||
|
raise NotImplementedError
|
||
|
|
||
|
self.bot = telegram.Bot(token=token)
|
||
|
|
||
|
|
||
|
def sendMessage(self, recipient: str, message: str):
|
||
|
self.bot.sendMessage(chat_id=recipient, text=message)
|