dokku-comp
This commit is contained in:
41
bot/handlers/routing.py
Normal file
41
bot/handlers/routing.py
Normal file
@@ -0,0 +1,41 @@
|
||||
from bot.handlers.handle_feedback import handle_feedback, handle_answer
|
||||
from bot.handlers.handle_members_change import handle_join, handle_left
|
||||
from bot.handlers.handle_default import handle_default
|
||||
from bot.handlers.command_my import handle_command_my
|
||||
from bot.handlers.command_graph import handle_command_graph
|
||||
from bot.handlers.command_ask import handle_command_ask
|
||||
from bot.config import FEEDBACK_CHAT_ID
|
||||
|
||||
|
||||
async def handle_routing(msg, state):
|
||||
cid = msg["chat"]["id"]
|
||||
uid = msg["from"]["id"]
|
||||
if cid == uid:
|
||||
# сообщения в личке с ботом
|
||||
print("private chat message")
|
||||
if msg["text"].startswith("/my"):
|
||||
await handle_command_my(msg)
|
||||
elif msg["text"].startswith("/unlink"):
|
||||
await handle_unlink(msg)
|
||||
else:
|
||||
await handle_feedback(msg, state)
|
||||
|
||||
elif str(cid) == FEEDBACK_CHAT_ID:
|
||||
# сообщения из группы обратной связи
|
||||
print("feedback chat message")
|
||||
if "reply_to_message" in msg:
|
||||
await handle_answer(msg)
|
||||
elif msg["text"] == "/graph":
|
||||
await handle_command_graph(msg)
|
||||
elif msg["text"].startswith("/ask"):
|
||||
await handle_command_ask(msg)
|
||||
|
||||
else:
|
||||
# сообщения из всех остальных групп
|
||||
print(f"group {cid} chat message")
|
||||
if "text" in msg:
|
||||
await handle_default(msg)
|
||||
elif "new_chat_member" in msg:
|
||||
await handle_join(msg)
|
||||
elif "left_chat_member" in msg:
|
||||
await handle_left(msg)
|
Reference in New Issue
Block a user