So, I've making some code that will allow me to log edited messages to a certain channel. Here is the code:
async def on_message_edit(message_before, message_after):
embed=discord.Embed(title="{} edited a message".format(message_before, message.author), description="", color=0xFFFF00)
embed.add_field(name= message_before.content ,value="This is the message before the edit:", inline=True)
embed.add_field(name= message_after.content ,value="This is the message after the edit", inline=True)
channel=bot.get_channel(747057143630528563)
await channel.send(embed=embed)
However, when I run the code, I get the error message:
Ignoring exception in on_message_edit Traceback (most recent call last): File "C:\Users\jackt\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 333, in _run_event await coro(*args, **kwargs) File "C:\Users\jackt\Desktop\bot.py", line 92, in on_message_edit embed=discord.Embed(title="{} edited a message".format(message_before, message.author), description="", color=0xFFFF00) NameError: name 'message' is not defined
What part of the code do I need to change, and what do I need to change about it? Thanks.