pycord-v3
pycord-v3 copied to clipboard
Dependency Injection
Add support for sub command/listener dependency injection:
@bot.command(call_once=True)
async def my_command(self, pre: pycord.Prelude) -> pycord.Dependency:
return pycord.Dependency(pycord.Prelude, pre)
@my_command.command()
async def my_subcommand(self, pre: pycord.Prelude, pr: pycord.Prelude) -> None:
await pr.send(...)
That is a really dumbed down version of the Dependency injection formula we may adopt.
The main command function can also return a list of dependencies if require, and the dependencies
go truly like: type, value, where the type is the id defining the Dependency.