Skip to content

Instantly share code, notes, and snippets.

@Birdi7
Created August 14, 2019 22:46
Show Gist options
  • Save Birdi7/5dbae1619dc3908a4b4218bd587305d1 to your computer and use it in GitHub Desktop.
Save Birdi7/5dbae1619dc3908a4b4218bd587305d1 to your computer and use it in GitHub Desktop.
Example of chat action
"""
This is a echo bot.
It echoes any incoming text messages.
"""
import logging
from aiogram import Bot, Dispatcher, executor, types
API_TOKEN = 'BOT_API_TOKEN'
# 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):
await bot.send_chat_action(message.chat.id, 'typing')
await bot.send_message(message.chat.id, message.text)
if __name__ == '__main__':
executor.start_polling(dp, skip_updates=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment