1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-08 21:18:00 +03:00

Added forgotten "notify" to telegram notifier :)

This commit is contained in:
Adolfo Gómez García 2023-05-03 01:34:12 +02:00
parent 3fa6478f94
commit a7a658e42d
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23

View File

@ -137,7 +137,13 @@ class TelegramNotifier(messaging.Notifier):
# Done
def notify(self, group: str, identificator: str, level: messaging.LogLevel, message: str) -> None:
pass
telegramMsg = f'{group} - {identificator} - {str(level)}: {message}'
logger.debug('Sending telegram message: %s', telegramMsg)
# load chatIds
chatIds = self.storage.getPickle('chatIds') or []
t = telegram.Telegram(self.accessToken.value, self.botname.value)
for chatId in chatIds:
t.sendMessage(chatId, telegramMsg)
def subscribeUser(self, chatId: int) -> None:
# we do not expect to have a lot of users, so we will use a simple storage