- Added detailed logging for user ban processing in `process_ban_target` and `process_ban_reason` functions, including user data and error messages. - Improved error handling for user input validation and database interactions. - Updated `return_to_admin_menu` function to log user return actions. - Enhanced media group handling in `PostPublishService` with better error logging and author ID retrieval. - Added new button options in voice handlers and updated keyboard layouts for improved user interaction. - Refactored album middleware to better handle media group messages and added documentation for clarity.
60 lines
1.4 KiB
Python
60 lines
1.4 KiB
Python
from typing import Final, Dict
|
|
|
|
# Voice bot constants
|
|
VOICE_BOT_NAME = "voice"
|
|
|
|
# States
|
|
STATE_START = "START"
|
|
STATE_STANDUP_WRITE = "STANDUP_WRITE"
|
|
|
|
# Commands
|
|
CMD_START = "start"
|
|
CMD_HELP = "help"
|
|
CMD_RESTART = "restart"
|
|
CMD_EMOJI = "emoji"
|
|
CMD_REFRESH = "refresh"
|
|
|
|
# Command to command mapping for metrics
|
|
COMMAND_MAPPING: Final[Dict[str, str]] = {
|
|
"start": "voice_start",
|
|
"help": "voice_help",
|
|
"restart": "voice_restart",
|
|
"emoji": "voice_emoji",
|
|
"refresh": "voice_refresh"
|
|
}
|
|
|
|
# Button texts
|
|
BTN_SPEAK = "🎤Высказаться"
|
|
BTN_LISTEN = "🎧Послушать"
|
|
|
|
# Button to command mapping for metrics
|
|
BUTTON_COMMAND_MAPPING: Final[Dict[str, str]] = {
|
|
"🎤Высказаться": "voice_speak",
|
|
"🎧Послушать": "voice_listen",
|
|
"Отменить": "voice_cancel",
|
|
"🔄Сбросить прослушивания": "voice_refresh_listen",
|
|
"😊Узнать эмодзи": "voice_emoji"
|
|
}
|
|
|
|
# Callback data
|
|
CALLBACK_SAVE = "save"
|
|
CALLBACK_DELETE = "delete"
|
|
|
|
# Callback to command mapping for metrics
|
|
CALLBACK_COMMAND_MAPPING: Final[Dict[str, str]] = {
|
|
"save": "voice_save",
|
|
"delete": "voice_delete"
|
|
}
|
|
|
|
# File paths
|
|
VOICE_USERS_DIR = "voice_users"
|
|
STICK_DIR = "Stick"
|
|
STICK_PATTERN = "Hello_*"
|
|
|
|
# Time delays
|
|
STICKER_DELAY = 0.3
|
|
MESSAGE_DELAY_1 = 1.0
|
|
MESSAGE_DELAY_2 = 1.5
|
|
MESSAGE_DELAY_3 = 1.3
|
|
MESSAGE_DELAY_4 = 0.8
|