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

Intents can't be specified lazily #395

Closed
gdude2002 opened this issue Sep 22, 2021 · 2 comments
Closed

Intents can't be specified lazily #395

gdude2002 opened this issue Sep 22, 2021 · 2 comments

Comments

@gdude2002
Copy link
Contributor

gdude2002 commented Sep 22, 2021

I'm running into an issue with Kord Extensions, which recently gained a new feature to automatically enable the intents required for commands and event handlers to work. This has resulted in a load order issue.

In order for intents to be registered properly, all extensions must have been set up before the Kord instance is constructed via the KordBuilder. This is because the KordBuilder has a single intents property rather than an intents builder that's evaluated as part of login. However, this means that it's now unsafe to try to access the bot's Kord instance during extension setup, as it doesn't yet exist.

So, this issue is a formal request to change the intents property in KordBuilder to a DSL function that registers an intents builder which is called just before login in order to resolve the required intents.

I've worked around this in KordEx for now, but it does make some things considerably less intuitive, so it'd be great to get this looked at.

@BartArys
Copy link
Contributor

If the proposed builder is only called when logging in then we should just move the intents to the log in function instead. We've had requests from other users to modify intents between gateway identifies, which would also be solved by this change.

The notable downside is that intents won't be usable by other parts of the API (I can only think of cache being potentially affected), and if we are to move it to the log in call it'll become the user's responsibility to remember intents between manual log in attempts (not sure how many times people actually manually reconnect, but I don't think it'd be much of an issue).

@gdude2002
Copy link
Contributor Author

I feel like "builder supplied early and called at login" negates the last downside there, but you're probably right that it isn't much of an issue - bots at that scale are going to be frameworking that anyway, I think.

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

3 participants