Finishing Reaction Logic (2/2)
The final reaction logic and handling.
I've split this part, based on the comments before, into pre, a, b, c, and d.
pre. Removing reactions.
A quick function to add right above the reaction function, but after the pages object is this:
This will make removing reactions easier, when a user reacts.
a. Going back:
This will handle going back a page.
I'll keep comments inside the code to keep it cleaner and easier to understand, but this code here will remove the reaction (if the bot has permission), check if it can go back, go back if it can, then start listening again.
b. Going forward:
This will, ironically, handle going forward a page.
That handles, well, that. Same thing happens here, just the code is changed a little.
c. Handling the delete:
Incase anyone wants to delete the help command, we can add a trash reaction to do that.
This will delete the embed fully, and stop listening.
d. Handling mis-reactions:
Just in case something happens, this code is here to restart the listener if something goes wrong:
And that's it! Your reaction help menu is done now, and all you have to do is do some proper pages, and give it a test run!
Last updated
Was this helpful?