H-005
H-005

Reputation: 505

I don't have the right arguments for AddModulesAsync (C# Discord.Net)

I followed this tutorial ( https://www.youtube.com/watch?v=ccsf5Rcu9mM ) on how to make a discord bot in C#. Everything went fine until the 57:02 timestamp (the last step before getting it done). I get an error in the following line of code: await commands.AddModulesAsync(Assembly.GetEntryAssembly());. It tells me that the argument is incorrect. VS suggest me to use AddModuleAsync() instead of AddModulesAsync(), but then it throws another error related to the arguments.

By the way, the only thing that isn't as in the tutorial is that I seem to have .Net Core 3.0 instead of 2.0 as in the video.

Upvotes: 0

Views: 904

Answers (1)

lobstar
lobstar

Reputation: 310

In latest stable version of Discord.net signature changed. Now you need add IServiceProvider as second argument. So you code must look like this

await commands.AddModulesAsync(Assembly.GetEntryAssembly(), _services);

Where _services is IServiceProvider;

Upvotes: 1

Related Questions