Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

Commit

Permalink
Add DiscordClient as singleton service
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverbooth committed Mar 11, 2022
1 parent 2aff0af commit c42fac7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions BrackeysBot/Plugins/SimplePluginManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ public Plugin LoadPlugin(string name)
builder.AddNLog();
});
serviceCollection.AddSingleton(this);

if (plugin.DiscordClient is not null)
serviceCollection.AddSingleton(plugin.DiscordClient);

plugin.ConfigureServices(serviceCollection);
plugin.ServiceProvider = serviceCollection.BuildServiceProvider();

Expand Down

0 comments on commit c42fac7

Please sign in to comment.