Checking user is a member of the channel

This commit is contained in:
2024-02-09 12:52:56 +03:00
parent 780855339c
commit e89cb04c02
2 changed files with 29 additions and 8 deletions

View File

@@ -1,11 +1,13 @@
from dataclasses import dataclass
from typing import Optional
from uuid import UUID
from ._helpers import *
from ._singleton import Singleton
@dataclass
class BotSettings:
class BotSettings(Singleton):
uuid: UUID
message_times: List[str]
channel: str
@@ -27,3 +29,10 @@ class BotSettings:
result["channel"] = from_str(self.channel)
result["isActive"] = from_bool(self.is_active)
return result
@staticmethod
def get_active() -> Optional['BotSettings']:
try:
return BotSettings._instances[BotSettings]
except:
return None