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

Update code for latest nightly builds #167

Merged
merged 5 commits into from
Aug 14, 2024
Merged

Conversation

NycroV
Copy link
Collaborator

@NycroV NycroV commented Aug 13, 2024

A couple of noteworthy changes here:

  • Reflection is no longer used to hook events - the handlers are now triggered through a transient service as part of DSharpPlus' new event handler implementations

  • Connected shard count retrieval still has default implementations, but if an end-user is using a custom IShardOrchestrator implementation, for the most accurate shard count retrieval they should supply their own Task.

Example:
builder.Services.Configure<DiscordClientWrapper>(wrapper => wrapper.GetShardCount = () => YourTask());

Additionally, if your shard count retrieval needs to make asynchronous calls:
builder.Services.Configure<DiscordClientWrapper>(wrapper => wrapper.GetShardCount = async () => await YourTaskAsync());

Obviously you can skip the lambda expressions and directly insert the method name, but I used lambda here to make it more obvious what's actually being done.

This won't be relevant for 99% (if not 100%) of users, as D#+'s default implementations are usually more than fine enough. However, I'm still going to reach out to D#+ to see about implementing a connected shard count property or method on the IShardOrchestrator interface. This would allow us to forego all of this extra roundabout retrieval and directly access the counts without the need for any additional configuration from end users.

@akiraveliara
Copy link

This won't be relevant for 99% (if not 100%) of users, as D#+'s default implementations are usually more than fine enough. However, I'm still going to reach out to D#+ to see about implementing a connected shard count property or method on the IShardOrchestrator interface.

hej, D#+ maintainer here - this will be available shortly: DSharpPlus/DSharpPlus#2068

@NycroV
Copy link
Collaborator Author

NycroV commented Aug 13, 2024

Once the DSharpPlus PR has been merged and published, all that needs to be changed is updating the L4N .csproj information to use the latest nightly package, and then this PR will be ready to merge.

Thanks @akiraveliara for the speedy response and implementation!

@NycroV
Copy link
Collaborator Author

NycroV commented Aug 13, 2024

DSharpPlus package has been updated and this PR is now ready to merge!

@angelobreuer angelobreuer added the enhancement New feature or request label Aug 14, 2024
@angelobreuer
Copy link
Owner

Thank you 🚀

@angelobreuer angelobreuer merged commit f5dc4f6 into angelobreuer:dev Aug 14, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants