31 lines
680 B
Python
31 lines
680 B
Python
import asyncio
|
||
import logging
|
||
|
||
from maxapi import Bot, Dispatcher
|
||
from maxapi.types import BotStarted, Command, MessageCreated
|
||
|
||
logging.basicConfig(level=logging.INFO)
|
||
|
||
bot = Bot('тут_ваш_токен')
|
||
dp = Dispatcher()
|
||
|
||
|
||
@dp.bot_started()
|
||
async def bot_started(event: BotStarted):
|
||
await event.bot.send_message(
|
||
chat_id=event.chat_id,
|
||
text='Привет! Отправь мне /start'
|
||
)
|
||
|
||
|
||
@dp.message_created(Command('start'))
|
||
async def hello(event: MessageCreated):
|
||
await event.message.answer(f"Пример чат-бота для MAX 💙")
|
||
|
||
|
||
async def main():
|
||
await dp.start_polling(bot)
|
||
|
||
|
||
if __name__ == '__main__':
|
||
asyncio.run(main()) |