diff --git a/examples/echo_bot.py b/examples/echo_bot.py index 27dc70d9..00046f3a 100644 --- a/examples/echo_bot.py +++ b/examples/echo_bot.py @@ -20,7 +20,7 @@ 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. + This handler will be called when user sends `/start` or `/help` command """ await message.reply("Hi!\nI'm EchoBot!\nPowered by aiogram.") @@ -28,13 +28,25 @@ async def send_welcome(message: types.Message): @dp.message_handler(regexp='(^cat[s]?$|puss)') async def cats(message: types.Message): with open('data/cats.jpg', 'rb') as photo: - await bot.send_photo(message.chat.id, photo, caption='Cats is here 😺', - reply_to_message_id=message.message_id) + ''' + # Old fashioned way: + await bot.send_photo( + message.chat.id, + photo, + caption='Cats are here 😺', + reply_to_message_id=message.message_id, + ) + ''' + + await message.reply_photo(photo, caption='Cats are here 😺') @dp.message_handler() async def echo(message: types.Message): - await bot.send_message(message.chat.id, message.text) + # old style: + # await bot.send_message(message.chat.id, message.text) + + await message.reply(message.text, reply=False) if __name__ == '__main__':