Skip to content
Advertisement

discord.py some commands simply dont run

after adding these commands my code has stopped working removing some help however adding them back adds makes it not process

JavaScript

any commands i try don’t run besides the deleted message one i have tried using the await client.commands.process and it also dosent work. it dosent give an error it just sits there and does nothing

Advertisement

Answer

Are you sure any “command” you try don’t work?

You are overriding the same event 3 times (on_message()), this means that the code you wrote in the first two overrides is discarded so it won’t execute.

Look at this example (the code is below). As you can see in this screenshot, the bot isn’t answering me when there is an “a” or a “b” in my messages (first two on_message() overrides). Only the last override (the one that checks if there is a “c” in the messages) is applied.

JavaScript

In your case, your bot should answer to a message which content is equal to “random_meme!” (also to both on_message_delete() and on_member_unban()).

You should not override the same event (or function, or whatever) more than once. Join the content of the three overrides in one and delete the others:

JavaScript

So now the bot will answer to “a”, “b” and “c”: screenshot

Note: on_member_unban() may look like it isn’t working as you didn’t tell the bot to send the message to any channel, but it is working (try adding a print(), for instance).

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement