diff --git a/ApplicationCommands/src/Program.cs b/ApplicationCommands/src/Program.cs index b28da11..9938359 100644 --- a/ApplicationCommands/src/Program.cs +++ b/ApplicationCommands/src/Program.cs @@ -12,6 +12,7 @@ namespace DisCatSharp.Examples.ApplicationCommands; +// TODO: rewrite, this is kinda weird /// /// The program. /// @@ -51,12 +52,6 @@ public static async Task MainAsync(string[] args) DiscordShardedClient discordShardedClient = new(discordConfiguration); - Log.Logger.Information("Connecting to Discord..."); - await discordShardedClient.StartAsync(); - - // Use the default logger provided for easy reading - discordShardedClient.Logger.LogInformation("Connection success! Logged in as {CurrentUserUsername}#{CurrentUserDiscriminator} ({CurrentUserId})", discordShardedClient.CurrentUser.Username, discordShardedClient.CurrentUser.Discriminator, discordShardedClient.CurrentUser.Id); - // Register a Random class instance now for use later over in RollRandom.cs ApplicationCommandsConfiguration appCommandsConfiguration = new(new ServiceCollection().AddSingleton().BuildServiceProvider()) { @@ -99,6 +94,14 @@ public static async Task MainAsync(string[] args) } discordShardedClient.Logger.LogInformation("Application commands registered successfully"); + + + Log.Logger.Information("Connecting to Discord..."); + await discordShardedClient.StartAsync(); + + // Use the default logger provided for easy reading + discordShardedClient.Logger.LogInformation("Connection success! Logged in as {CurrentUserUsername}#{CurrentUserDiscriminator} ({CurrentUserId})", discordShardedClient.CurrentUser.Username, discordShardedClient.CurrentUser.Discriminator, discordShardedClient.CurrentUser.Id); + // Listen for commands by putting this method to sleep and relying off of DiscordClient's event listeners await Task.Delay(-1); }