Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant