Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
outerwinnie committed Sep 2, 2024
1 parent e6450b2 commit 141da05
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ static async Task Main(string[] args)
await _client.LoginAsync(TokenType.Bot, token);
await _client.StartAsync();

// Prevent application from closing
await Task.Delay(-1);
}

Expand All @@ -78,13 +79,14 @@ private static Task Log(LogMessage log)
private static async Task OnReady()
{
Console.WriteLine("Bot is connected.");
await RegisterCommandsAsync();
await ScheduleNextPost();

// Call asynchronous tasks without blocking
await Task.Run(() => RegisterCommandsAsync()).ConfigureAwait(false);
await Task.Run(() => ScheduleNextPost()).ConfigureAwait(false);
}

private static async Task RegisterCommandsAsync()
{
// Register the command module
await _commands.AddModuleAsync<CommandModule>(_services);
}

Expand Down

0 comments on commit 141da05

Please sign in to comment.