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

Dependency Injection #150

@VincentRPS

Description

@VincentRPS

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions