admin管理员组文章数量:1025465
I have a big telegram bot project. Today, he suddenly stopped showing signs of life. I don't know exactly what changes led to this result. The problem is that the handler has stopped responding to commands.
INFO:aiogram.dispatcher:Start polling
INFO:aiogram.dispatcher:Run polling for bot ...
INFO:aiogram.event:Update id=????? is not handled. Duration 0 ms by bot id=?????
I've reduced the code to basic, but it still doesn't work, what could be the reason?
main.py
import logging
import asyncio
from aiogram.types import Message, FSInputFile
from aiogram.filters import CommandStart
from aiogram import Bot, Dispatcher
bot = Bot(token="79127??????????????????fXTNyc")
dp = Dispatcher()
async def main():
await dp.start_polling(bot)
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
asyncio.run(main())
logo_photo = FSInputFile('212649.png')
@dp.message(CommandStart())
async def cmd_start(message: Message):
await message.answer_photo(photo=logo_photo, caption='текст')
PS: the id and token are hidden intentionally
I have a big telegram bot project. Today, he suddenly stopped showing signs of life. I don't know exactly what changes led to this result. The problem is that the handler has stopped responding to commands.
INFO:aiogram.dispatcher:Start polling
INFO:aiogram.dispatcher:Run polling for bot ...
INFO:aiogram.event:Update id=????? is not handled. Duration 0 ms by bot id=?????
I've reduced the code to basic, but it still doesn't work, what could be the reason?
main.py
import logging
import asyncio
from aiogram.types import Message, FSInputFile
from aiogram.filters import CommandStart
from aiogram import Bot, Dispatcher
bot = Bot(token="79127??????????????????fXTNyc")
dp = Dispatcher()
async def main():
await dp.start_polling(bot)
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
asyncio.run(main())
logo_photo = FSInputFile('212649.png')
@dp.message(CommandStart())
async def cmd_start(message: Message):
await message.answer_photo(photo=logo_photo, caption='текст')
PS: the id and token are hidden intentionally
Share Improve this question edited Nov 17, 2024 at 12:20 Maurice Meyer 18.1k4 gold badges35 silver badges52 bronze badges asked Nov 17, 2024 at 12:18 Илья ДьяченкоИлья Дьяченко 11 Answer
Reset to default 0Your function cmd_start just cannot be handled because when your bot started polling, the cmd_start wasn't declared. You should place the cmd_start before you run the main function. You should have the code like this at least:
import logging
import asyncio
from aiogram.types import Message, FSInputFile
from aiogram.filters import CommandStart
from aiogram import Bot, Dispatcher
bot = Bot(token="79127??????????????????fXTNyc")
dp = Dispatcher()
logo_photo = FSInputFile('212649.png')
# the function is declared before entering the main working loop
@dp.message(CommandStart())
async def cmd_start(message: Message):
await message.answer_photo(photo=logo_photo, caption='текст')
async def main():
await dp.start_polling(bot)
# all handlers are declared and now you can run the bot
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
asyncio.run(main())
I have a big telegram bot project. Today, he suddenly stopped showing signs of life. I don't know exactly what changes led to this result. The problem is that the handler has stopped responding to commands.
INFO:aiogram.dispatcher:Start polling
INFO:aiogram.dispatcher:Run polling for bot ...
INFO:aiogram.event:Update id=????? is not handled. Duration 0 ms by bot id=?????
I've reduced the code to basic, but it still doesn't work, what could be the reason?
main.py
import logging
import asyncio
from aiogram.types import Message, FSInputFile
from aiogram.filters import CommandStart
from aiogram import Bot, Dispatcher
bot = Bot(token="79127??????????????????fXTNyc")
dp = Dispatcher()
async def main():
await dp.start_polling(bot)
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
asyncio.run(main())
logo_photo = FSInputFile('212649.png')
@dp.message(CommandStart())
async def cmd_start(message: Message):
await message.answer_photo(photo=logo_photo, caption='текст')
PS: the id and token are hidden intentionally
I have a big telegram bot project. Today, he suddenly stopped showing signs of life. I don't know exactly what changes led to this result. The problem is that the handler has stopped responding to commands.
INFO:aiogram.dispatcher:Start polling
INFO:aiogram.dispatcher:Run polling for bot ...
INFO:aiogram.event:Update id=????? is not handled. Duration 0 ms by bot id=?????
I've reduced the code to basic, but it still doesn't work, what could be the reason?
main.py
import logging
import asyncio
from aiogram.types import Message, FSInputFile
from aiogram.filters import CommandStart
from aiogram import Bot, Dispatcher
bot = Bot(token="79127??????????????????fXTNyc")
dp = Dispatcher()
async def main():
await dp.start_polling(bot)
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
asyncio.run(main())
logo_photo = FSInputFile('212649.png')
@dp.message(CommandStart())
async def cmd_start(message: Message):
await message.answer_photo(photo=logo_photo, caption='текст')
PS: the id and token are hidden intentionally
Share Improve this question edited Nov 17, 2024 at 12:20 Maurice Meyer 18.1k4 gold badges35 silver badges52 bronze badges asked Nov 17, 2024 at 12:18 Илья ДьяченкоИлья Дьяченко 11 Answer
Reset to default 0Your function cmd_start just cannot be handled because when your bot started polling, the cmd_start wasn't declared. You should place the cmd_start before you run the main function. You should have the code like this at least:
import logging
import asyncio
from aiogram.types import Message, FSInputFile
from aiogram.filters import CommandStart
from aiogram import Bot, Dispatcher
bot = Bot(token="79127??????????????????fXTNyc")
dp = Dispatcher()
logo_photo = FSInputFile('212649.png')
# the function is declared before entering the main working loop
@dp.message(CommandStart())
async def cmd_start(message: Message):
await message.answer_photo(photo=logo_photo, caption='текст')
async def main():
await dp.start_polling(bot)
# all handlers are declared and now you can run the bot
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
asyncio.run(main())
本文标签: pythonINFOaiogrameventUpdate id is not handledStack Overflow
版权声明:本文标题:python - INFO:aiogram.event:Update id=??????????? is not handled - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745635877a2160443.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论