#Client ReadyAsync Function not being called

1 messages · Page 1 of 1 (latest)

elder epoch
#

My main function:

public async Task RunAsync()
{
    DiscordSocketClient client = _services.GetRequiredService<DiscordSocketClient>();
    
    client.Log += ConsoleUtils.Log;
    await _services.GetRequiredService<InteractionHandler>().InitializeAsync();

    await client.LoginAsync(TokenType.Bot,
        "TOKEN");
    await client.StartAsync();

    await Task.Delay(Timeout.Infinite);
}
#

My InteractionHandler.InitializeAsync function:

public async Task InitializeAsync()
{
    _client.Ready += ReadyAsync;
    _handler.Log += ConsoleUtils.Log;

    await _handler.AddModulesAsync(Assembly.GetEntryAssembly(), _services);
    _client.InteractionCreated += HandleInteraction;
}
#

My InteractionHandler.ReadyAsync function:

private async Task ReadyAsync()
{
    await _handler.RegisterCommandsToGuildAsync(guildId, true);
    await ConsoleUtils.Log("Interactions registered!", "InteractionHandler");
}
narrow pewter
#

🤔 it looks as though you have 2 DiscordSocketClient instances