0
votes

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()
1
Please provide us with more code, so we might be able to deduct what the problem might be or reproduce the error for ourselvesGoldwave
You have this error because fetch_message(761275239346339871) didn't found the message you're looking forMrSpaar

1 Answers

0
votes

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()