handler(message: types.Message)

This commit is contained in:
Alex Root Junior 2017-06-03 10:53:13 +03:00
parent 03c7e4a6d8
commit 2192d4b7ea
3 changed files with 9 additions and 9 deletions

View file

@ -1,7 +1,7 @@
import asyncio
import logging
from aiogram import Bot
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
API_TOKEN = 'BOT TOKEN HERE'
@ -14,19 +14,19 @@ dp = Dispatcher(bot)
@dp.message_handler(commands=['start', 'help'])
async def send_welcome(message):
async def send_welcome(message: types.Message):
await message.reply("Hi!\nI'm EchoBot!\nPowered by aiogram.")
@dp.message_handler(regexp='(^cat[s]?$|puss)')
async def cats(message):
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)
@dp.message_handler()
async def echo(message):
async def echo(message: types.Message):
await bot.send_message(message.chat.id, message.text)