Files
TelegramAnonReciever/handlers/commands.py
2025-08-07 00:38:19 +03:00

24 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from aiogram import types
from aiogram.dispatcher import Dispatcher
from config import MODERATORS_CHAT_ID
# Обработчик команды /start
async def send_welcome(message: types.Message):
await message.answer(
"Привет! Я анонимный бот для связи с администрацией. "
"Просто отправьте мне сообщение, и я передам его администраторам."
)
# Обработчик команды /whereiam (только для групп)
async def get_group_id(message: types.Message):
chat_id = message.chat.id
chat_title = message.chat.title or "Беседа без названия"
await message.answer(
f"ID этой группы: `{chat_id}`\nНазвание: {chat_title}",
parse_mode="Markdown"
)
# Регистрация обработчиков команд
def register_commands_handlers(dp: Dispatcher):
dp.register_message_handler(send_welcome, commands=["start"])
dp.register_message_handler(get_group_id, commands=["whereiam"], chat_type=[types.ChatType.GROUP, types.ChatType.SUPERGROUP])