Skip to content

Add support injections for event listeners #1569

Description

@iflemix

Summary

Injections expand capabilities

What is the feature request for?

disnake.ext.commands

The Problem

Image

My file with all dependencies.

Image

My command with injection it works perfectly.

Image

However, if you try to inject the dependency into the listener, it simply doesn't see it and throws an error.
I had to temporarily leave the necessary dependency in the class initializer.

The Ideal Solution

Storing dependencies globally at the library level isn't exactly ideal, though it works fine for small use cases.
It’ll be interesting to see what happens when it needs to scale
it’ll likely become too cumbersome, or something is bound to break, just like with the listeners.

I’d really like to see full-fledged DI support even if just the bare minimum built into disnake that would be great.
I’m not exactly keen on pulling in extra, heavy packages for IoC and DI on top of disnake in their projects.

The Current Solution

No response

Additional Context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions