Bot
Bot — основной класс aiomax для работы с MAX API и обработкой обновлений.
Создание
Жизненный цикл
Основные API-методы
await bot.get_me()
await bot.get_chats()
await bot.get_chat_info_by_chat_id(chat_id=-100123456)
await bot.patch_chat_info_by_chat_id(chat_id=-100123456, title="New title")
await bot.delete_chat_by_chat_id(chat_id=-100123456)
await bot.send_message(chat_id=-100123456, text="Привет")
await bot.send_action(chat_id=-100123456, action="typing")
await bot.get_message(chat_id=-100123456, message_id="msg-1")
await bot.get_messages(chat_id=-100123456, limit=50)
await bot.edit_message(chat_id=-100123456, message_id="msg-1", text="Updated")
await bot.delete_message(chat_id=-100123456, message_id="msg-1")
await bot.pin_message(chat_id=-100123456, message_id="msg-1")
await bot.unpin_message(chat_id=-100123456, message_id="msg-1")
await bot.get_pinned_message(chat_id=-100123456)
Участники и администраторы
await bot.get_members_from_chat(chat_id=-100123456)
await bot.add_members_to_chat(chat_id=-100123456, user_ids=[111, 222])
await bot.delete_members_from_chat(chat_id=-100123456, user_id=111)
await bot.get_me_from_chat(chat_id=-100123456)
await bot.get_admins_from_chat(chat_id=-100123456)
await bot.add_admins_to_chat(chat_id=-100123456, user_id=111, permissions=["WRITE"])
await bot.delete_permissions_from_chat(chat_id=-100123456, user_id=111)
Polling
Webhook
await bot.start_webhook(
host="0.0.0.0",
port=8080,
path="/webhook",
webhook_url="https://example.com/webhook",
secret="secret"
)
await bot.get_subscriptions()
await bot.set_subscription(url="https://example.com/webhook")
await bot.delete_subscription(url="https://example.com/webhook")