Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

404 NOT FOUND (error code : 1008) : Unknown message

I am making a bot in python using discord.py , i was trying delete the command when it is executed it is working but giving me a error and the error is

Ignoring exception in on_message Traceback (most recent call last): File "C:\Users\Dell\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 312, in _run_event await coro(*args, **kwargs) File "C:/Users/Dell/Desktop/test_bot/add_role.py", line 25, in on_message msg = await message.channel.fetch_message(761275239346339871) File "C:\Users\Dell\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\abc.py", line 956, in fetch_message data = await self._state.http.get_message(channel.id, id) File "C:\Users\Dell\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\http.py", line 243, in request raise NotFound(r, data) discord.errors.NotFound: 404 Not Found (error code: 10008): Unknown Message

After giving the error also it works , but i want to know what rises the error code :

msg = await message.channel.fetch_message(761275239346339871)
await msg.delete()
like image 446
mr.roi Avatar asked Aug 14 '26 09:08

mr.roi


1 Answers

The problem is, The message id that you inputted has already been deleted. If you want to delete the author message just do

await ctx.message.delete()

if you want to delete the inputted message by wait_for you can do this

msg = await client.wait_for('message', check=lambda message: message.author == ctx.author)
await msg.delete()

if on_message.

@client.event
async def on_message(message):
    message = await message.channel.send(message here)
    await message.delete()
like image 155
Raphiel Avatar answered Aug 16 '26 23:08

Raphiel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!