Open hitblast opened 2 years ago
Couldn't you just invoke the code that you have to on the on_ready event of the cog?
@nigamanthsrivatsan wouldn't that only fire once though? It wouldn't work if you have code that you want to run every time a command gets called prior to the command logic running.
Summary
A proposal for two new methods inside
discord.ext.commands.Cog
to allow execution of code before-and-after the invocation of an application command.What is the feature request for?
discord.ext.commands
The Problem
Imagine you have a Discord Bot that only has text commands. You have a
greet
command inside a cog that looks something like this:Now as you can see that this command is pretty straightforward. Now imagine that you would like to do something before your code runs. When it comes to text commands, the action is going to be as simple as this:
However, if you decide to switch to slash commands in the future some time, things might get pretty rough with the current version of discord.py as there's no such method for application commands (deriving from
discord.Interaction
).The Ideal Solution
The idea in this case is to add two special methods inside
discord.ext.commands.Cog
which could apparently be coded like this:The Current Solution
No response
Additional Context
No response