mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Bump examples, docs and executor (nothing)
This commit is contained in:
parent
21908739e9
commit
9f13e11e6b
9 changed files with 57 additions and 21 deletions
|
|
@ -1,19 +1,27 @@
|
|||
import asyncio
|
||||
"""
|
||||
This is a echo bot.
|
||||
It echoes any incoming text messages.
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
from aiogram import Bot, types, Dispatcher, executor
|
||||
from aiogram import Bot, Dispatcher, executor, types
|
||||
|
||||
API_TOKEN = 'BOT TOKEN HERE'
|
||||
|
||||
# Configure logging
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
bot = Bot(token=API_TOKEN, loop=loop)
|
||||
# Initialize bot and dispatcher
|
||||
bot = Bot(token=API_TOKEN)
|
||||
dp = Dispatcher(bot)
|
||||
|
||||
|
||||
@dp.message_handler(commands=['start', 'help'])
|
||||
async def send_welcome(message: types.Message):
|
||||
"""
|
||||
This handler will be called when client send `/start` or `/help` commands.
|
||||
"""
|
||||
await message.reply("Hi!\nI'm EchoBot!\nPowered by aiogram.")
|
||||
|
||||
|
||||
|
|
@ -30,4 +38,4 @@ async def echo(message: types.Message):
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
executor.start_polling(dp, loop=loop, skip_updates=True)
|
||||
executor.start_polling(dp, skip_updates=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue