Open circuitsacul opened 3 years ago
You can do this yourself,
@bot.listen()
async def on_message_edit(before: discord.Message, after: discord.Message):
if before.content == after.content:
return
return await bot.process_commands(after)
You can also limit this to the owner with await bot.is_owner(after.author)
No, because that would send a new result, not edit the original result.
Maybe you can override commands.Context and edit the message with the new content if the message was edited, Not sure though.
No, because that would send a new result, not edit the original result.
What if your evaluated code sends multiple messages before erroring? If your code works and sends something when it gets rerun, how show Jishaku know to edit the original message without modifying the Context class? (A custom Context class for Jishaku would conflict with any user-set Context classes, and monkeypatching is not a great solution for production code.)
The Problem
Very frequently, I will write a long eval code and come across some error. This means I have to copy+paste my code, fix the error, and then resend it. This is spammy and slow.
The Ideal Solution
After running the py/pyi command, jiskaku will listen for the
on_raw_message_edit
event for the next 30 seconds on this specific message. If edited, rerun the py/pyi command, and instead of sending new output, edit the original message with the new output.The Current Solution
Copy+paste the eval command and resend it after fixing.