Issue
I'm running a script, it shows me this error message:
Ignoring exception in on_message_edit
Traceback (most recent call last):
File "C:\Users\Debashis\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
TypeError: on_message_edit() takes 1 positional argument but 2 were given
but my code is nothing more than:
@bot.event
async def on_message_edit(message):
pass
I'll be working on the function later, but it gives me an error already (message intents are enabled). The other posts I found on this topic didn't help me at all. I don't know if that'll be helpful, but I'm not using discord.Client
. I'm using discord.ext.commands.Bot
.
Solution
It should be:
async def on_message_edit(before, after):
Where before
is the previous version of the message and after
is the current version (documentation).
You might also think about using on_raw_message_edit
as it's not relying on an internal cache (documentation).
async def on_raw_message_edit(payload)
Answered By - RiveN
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.