INNER CODE UNIT · Python
toggle_notification
sidor0912/FunPayCardinal · tg_bot/bot.py:184
def toggle_notification(self, chat_id: int, notification_type: str) -> bool:
"""
Переключает указанный тип уведомлений в указанном чате и сохраняет настройки уведомлений.
:param chat_id: ID Telegram чата.
:param notification_type: тип уведомлений.
:return: вкл / выкл указанный тип уведомлений в указанном чате.
"""
chat_id = str(chat_id)
if chat_id not in self.notification_settings:
self.notification_settings[chat_id] = {}
self.notification_settings[chat_id][notification_type] = not self.is_notification_enabled(chat_id,
notification_type)
utils.save_notification_settings(self.notification_settings)
return self.notification_settings[chat_id][notification_type]