Discord-Bot-Tutorial icon indicating copy to clipboard operation
Discord-Bot-Tutorial copied to clipboard

OnClientReady Function no matching overload

Open Hyndy opened this issue 4 years ago • 2 comments

The OnClientReady function is not working with Client.Ready and is coming up with an error stating:

Error CS0123 No overload for 'OnClientReady' matches delegate 'AsyncEventHandler<DiscordClient, ReadyEventArgs>' MrBastard 18 Active

my code for the "Bot.cs" file:

namespace MrBastard { public class Bot { public DSharpPlus.DiscordClient Client { get; private set; }

    public async Task RunAsync()
    {
        var config = new DSharpPlus.DiscordConfiguration
        {

        };

        Client = new DSharpPlus.DiscordClient(config);

        Client.Ready += OnClientReady;      <-- line 18
    }

    private Task OnClientReady(DSharpPlus.EventArgs.ReadyEventArgs e)
    {
        return null;
    }
}

}

Don't know why it is doing this or how to fix it. Help would be appreciated.

Hyndy avatar Aug 19 '21 01:08 Hyndy

Hello! In private Tusk OnClientReady you must add 1 argument DiscordClient client, example: OnClientReady(DiscordClient client, ReadyEventArgs e)

Si6aClo avatar Sep 14 '21 17:09 Si6aClo

hello, i've tried this solution but I'm still getting the same problem

MarcTouma avatar Mar 04 '22 03:03 MarcTouma