from dataclasses import dataclass from pyrogram.types import CallbackQuery @dataclass class CallbackVerify: user_id: int @classmethod def from_callback(cls, callback: CallbackQuery): action, user_id = str(callback.data).split(":") if action.lower() != "verify": raise ValueError("Callback provided is not a verification callback") return cls(int(user_id)) @dataclass class CallbackEmoji: user_id: int emoji: str @classmethod def from_callback(cls, callback: CallbackQuery): action, user_id, emoji = str(callback.data).split(":") if action.lower() != "emoji": raise ValueError("Callback provided is not an emoji button callback") return cls(int(user_id), emoji) @dataclass class CallbackBan: user_id: int @classmethod def from_callback(cls, callback: CallbackQuery): action, user_id = str(callback.data).split(":") if action.lower() != "ban": raise ValueError("Callback provided is not a ban callback") return cls(int(user_id)) @dataclass class CallbackLanguage: language: str @classmethod def from_callback(cls, callback: CallbackQuery): action, language = str(callback.data).split(":") if action.lower() != "language": raise ValueError("Callback provided is not a language callback") return cls(language)