fix: rename argument to chat_type

fix: rename example file name

fix: str is container also lol. example fixed also
This commit is contained in:
Egor 2020-06-22 22:13:50 +05:00
parent 006a5ef987
commit 768491d976
2 changed files with 21 additions and 5 deletions

View file

@ -6,6 +6,7 @@ It filters incoming object based on type of its chat type
import logging
from aiogram import Bot, Dispatcher, executor, types
from aiogram.dispatcher.handler import SkipHandler
from aiogram.types import ChatType
API_TOKEN = 'BOT TOKEN HERE'
@ -18,13 +19,24 @@ bot = Bot(token=API_TOKEN)
dp = Dispatcher(bot)
@dp.message_handler(chat_types=[ChatType.PRIVATE, ChatType.CHANNEL])
@dp.message_handler(chat_type=[ChatType.PRIVATE, ChatType.CHANNEL])
async def send_welcome(message: types.Message):
"""
This handler will be called when user sends `/start` or `/help` command
"""
await message.reply("Hi!\nI'm hearing your messages in private chats and channels")
# propagate message to the next handler
raise SkipHandler
@dp.message_handler(chat_type=ChatType.PRIVATE)
async def send_welcome(message: types.Message):
"""
This handler will be called when user sends `/start` or `/help` command
"""
await message.reply("Hi!\nI'm hearing your messages only in private chats")
if __name__ == '__main__':
executor.start_polling(dp, skip_updates=True)