From 7eb82936e411a289889b12dbdeb4d9e8bfb2e6a0 Mon Sep 17 00:00:00 2001 From: profitroll Date: Fri, 26 May 2023 16:32:07 +0200 Subject: [PATCH] Added different dataclasses --- classes/commandset.py | 29 +++++++++++++++++++++++++++++ classes/pyrocommand.py | 9 +++++++++ 2 files changed, 38 insertions(+) create mode 100644 classes/commandset.py create mode 100644 classes/pyrocommand.py diff --git a/classes/commandset.py b/classes/commandset.py new file mode 100644 index 0000000..1434166 --- /dev/null +++ b/classes/commandset.py @@ -0,0 +1,29 @@ +from dataclasses import dataclass +from typing import List, Union +from pyrogram.types import ( + BotCommandScopeAllChatAdministrators, + BotCommandScopeAllGroupChats, + BotCommandScopeAllPrivateChats, + BotCommandScopeChat, + BotCommandScopeChatAdministrators, + BotCommandScopeChatMember, + BotCommandScopeDefault, + BotCommand, +) + + +@dataclass +class CommandSet: + """Command stored in PyroClient's 'commands' attribute""" + + commands: List[BotCommand] + scope: Union[ + BotCommandScopeDefault, + BotCommandScopeAllPrivateChats, + BotCommandScopeAllGroupChats, + BotCommandScopeAllChatAdministrators, + BotCommandScopeChat, + BotCommandScopeChatAdministrators, + BotCommandScopeChatMember, + ] = BotCommandScopeDefault() + language_code: str = "" diff --git a/classes/pyrocommand.py b/classes/pyrocommand.py new file mode 100644 index 0000000..7b01180 --- /dev/null +++ b/classes/pyrocommand.py @@ -0,0 +1,9 @@ +from dataclasses import dataclass + + +@dataclass +class PyroCommand: + """Command stored in PyroClient's 'commands' attribute""" + + command: str + description: str