P
P
Potatk2021-11-23 23:37:05
Python
Potatk, 2021-11-23 23:37:05

Why is the subsequent handler not being processed?

I can't understand why the subsequent handler is not processed, here is the code:

import asyncio
from aiogram import Bot, Dispatcher, executor
from aiogram.types import Message
from Config import BOT_TOKEN, admin_id

loop = asyncio.get_event_loop()
bot = Bot(BOT_TOKEN)
dp = Dispatcher(bot, loop=loop)

async def send_to_admin(dp):
await bot.send_message(chat_id=admin_id, text="Hooray!")

lw=["yes","yeah"]

@dp.message_handler()
async def delete(message: Message):
if message.text.lower()=="kod":
await message.delete()

@dp.message_handler()
async def echo1(message: Message):
for n in lw:
if message.text[0]=="/":
await message.answer(text="Enter your name")
return
if n in message.text.lower():
await message.answer(text="OK")
return
if "p" in message.text.lower():
await message.answer(text="Let")
return

if __name__=="__main__":
executor.start_polling(dp, on_startup=send_to_admin, skip_updates=True)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
LXSTVAYNE, 2021-11-24
@potatk

Because aiogram processes only one handler, which passes through the filters.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question