Created
August 14, 2019 22:46
-
-
Save Birdi7/5dbae1619dc3908a4b4218bd587305d1 to your computer and use it in GitHub Desktop.
Example of chat action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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