mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
29 lines
568 B
Python
29 lines
568 B
Python
"""
|
|
This is a echo bot.
|
|
It echoes any incoming text messages.
|
|
"""
|
|
|
|
import logging
|
|
|
|
from aiogram import Bot, Dispatcher, executor, types
|
|
|
|
API_TOKEN = 'BOT TOKEN HERE'
|
|
|
|
# Configure logging
|
|
logging.basicConfig(level=logging.INFO)
|
|
|
|
# Initialize bot and dispatcher
|
|
bot = Bot(token=API_TOKEN)
|
|
dp = Dispatcher(bot)
|
|
|
|
|
|
@dp.message_handler()
|
|
async def echo(message: types.Message):
|
|
# old style:
|
|
# await bot.send_message(message.chat.id, message.text)
|
|
|
|
await message.answer(message.text)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
executor.start_polling(dp, skip_updates=True)
|