Как исправить asyncio:Task exception was never retrieved?
INFO:aiogram:Bot: Dgonni_Silverhend [@Dgonni_Silverhend_bot]
WARNING:aiogram:Updates were skipped successfully.
INFO:aiogram.dispatcher.dispatcher:Start polling.
ERROR:asyncio:Task exception was never retrieved
future: exception=MessageToDeleteNotFound('Message to delete not found')>
Traceback (most recent call last):
File "G:\Games\lib\site-packages\aiogram\dispatcher\dispatcher.py", line 415, in _process_polling_updates
for responses in itertools.chain.from_iterable(await self.process_updates(updates, fast)):
File "G:\Games\lib\site-packages\aiogram\dispatcher\dispatcher.py", line 235, in process_updates
return await asyncio.gather(*tasks)
File "G:\Games\lib\site-packages\aiogram\dispatcher\handler.py", line 116, in notify
response = await handler_obj.handler(*args, **partial_data)
File "G:\Games\lib\site-packages\aiogram\dispatcher\dispatcher.py", line 256, in process_update
return await self.message_handlers.notify(update.message)
File "G:\Games\lib\site-packages\aiogram\dispatcher\handler.py", line 116, in notify
response = await handler_obj.handler(*args, **partial_data)
File "C:\Users\baxar\PycharmProjects\pythonProject1\main.py", line 23, in commands_ban
await message.bot.delete_message(chat_id=auth_data.GROUP_ID, message_id=message.reply_to_message.message_id)
File "G:\Games\lib\site-packages\aiogram\bot\bot.py", line 2950, in delete_message
return await self.request(api.Methods.DELETE_MESSAGE, payload)
File "G:\Games\lib\site-packages\aiogram\bot\base.py", line 236, in request
return await api.make_request(await self.get_session(), self.server, self.__token, method, data, files,
File "G:\Games\lib\site-packages\aiogram\bot\api.py", line 140, in make_request
return check_result(method, response.content_type, response.status, await response.text())
File "G:\Games\lib\site-packages\aiogram\bot\api.py", line 115, in check_result
exceptions.BadRequest.detect(description)
File "G:\Games\lib\site-packages\aiogram\utils\exceptions.py", line 140, in detect
raise err(cls.text or description)
aiogram.utils.exceptions.MessageToDeleteNotFound: Message to delete not found
Вот ошибка кода
Вот сам код:import auth_data
import logging
from aiogram import Bot, Dispatcher, executor, types
import filters
from filters import IsAdminFilter
@dp.message_handler(is_admin=True, commands=['ban'], commands_prefix='!/')
async def commands_ban(message: types.Message):
if not message.reply_to_message:
await message.reply('Эта команда должна быть ответом на сообщение ')
return
рекомендую всегда traceback оборачивать его тэгом code для корректного отображения, и прятать под спойлер, если длинный.
Код в вопросе обязательно надо оборачивать тэгом code. См.п.3.8 Регламента.