Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Dependency Injection #150

Open
VincentRPS opened this issue Mar 4, 2023 · 0 comments
Open

Dependency Injection #150

VincentRPS opened this issue Mar 4, 2023 · 0 comments

Comments

@VincentRPS
Copy link
Member

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.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant