INNER CODE UNIT · Python
is_notification_enabled
sidor0912/FunPayCardinal · tg_bot/bot.py:172
def is_notification_enabled(self, chat_id: int | str, notification_type: str) -> bool:
"""
Включен ли указанный тип уведомлений в указанном чате?
:param chat_id: ID Telegram чата.
:param notification_type: тип уведомлений.
"""
try:
return bool(self.notification_settings[str(chat_id)][notification_type])
except KeyError:
return False
def toggle_notification(self, chat_id: int, notification_type: str) -> bool:
"""
Переключает указанный тип уведомлений в указанном чате и сохраняет настройки уведомлений.
:param chat_id: ID Telegram чата.
:param notification_type: тип уведомлений.