def handler(message: dict, text: str, message_id: int, user: UserClass): match user.database.menu: case User.Menu.USER_MAIN: main.handler(message, text, message_id, user) case User.Menu.USER_CONTACT_ADMIN: contact_admin.handler(message_id, user) case User.Menu.USER_SUGGEST_MEME_NAME if user.validate_meme_name(message, text, user.database.temp_meme_type): suggest_meme_name.handler(text, user) case User.Menu.USER_SETTINGS: settings_menu.handler(text, message_id, user) case User.Menu.USER_SUGGEST_MEME_TAGS if user.process_meme_tags(text): suggest_meme_tags.handler(user) case User.Menu.USER_SUGGEST_MEME if target_meme := user.add_meme(message, Meme.Status.PENDING): suggest_meme.handler(target_meme, user)
def handler(message: dict, user: UserClass): if user.add_meme(message, Meme.Status.ACTIVE): user.database.menu = User.Menu.ADMIN_MAIN user.send_message( user.translate('meme_added', user.temp_meme_translation), admin)