diff --git a/Cliptok.csproj b/Cliptok.csproj index 0f93087..a4c9f6a 100644 --- a/Cliptok.csproj +++ b/Cliptok.csproj @@ -13,9 +13,9 @@ - - - + + + diff --git a/Program.cs b/Program.cs index 340b987..7aa3c6f 100644 --- a/Program.cs +++ b/Program.cs @@ -1,5 +1,6 @@ using DSharpPlus.Extensions; using DSharpPlus.Net.Gateway; +using DSharpPlus.SlashCommands; using Serilog.Sinks.Grafana.Loki; using System.Reflection; @@ -29,10 +30,8 @@ public async Task ZombiedAsync(IGatewayClient client) public async Task ReconnectRequestedAsync(IGatewayClient _) { } public async Task ReconnectFailedAsync(IGatewayClient _) { } - public async Task SessionInvalidatedAsync(IGatewayClient _) { } - - + public async Task ResumeAttemptedAsync(IGatewayClient _) { } } @@ -179,8 +178,19 @@ static async Task Main(string[] _) discordBuilder.ConfigureServices(services => { services.Replace(); +#pragma warning disable CS0618 // Type or member is obsolete + services.AddSlashCommandsExtension(slash => + { + slash.SlashCommandErrored += InteractionEvents.SlashCommandErrorEvent; + slash.ContextMenuErrored += InteractionEvents.ContextCommandErrorEvent; + + var slashCommandClasses = Assembly.GetExecutingAssembly().GetTypes().Where(t => t.IsClass && t.Namespace == "Cliptok.Commands.InteractionCommands" && !t.IsNested); + foreach (var type in slashCommandClasses) + slash.RegisterCommands(type, cfgjson.ServerID); + }); }); +#pragma warning restore CS0618 // Type or member is obsolete discordBuilder.ConfigureExtraFeatures(clientConfig => { clientConfig.LogUnknownEvents = false; @@ -211,18 +221,6 @@ static async Task Main(string[] _) .HandleAutoModerationRuleExecuted(AutoModEvents.AutoModerationRuleExecuted) ); -#pragma warning disable CS0618 // Type or member is obsolete - discordBuilder.UseSlashCommands(slash => - { - slash.SlashCommandErrored += InteractionEvents.SlashCommandErrorEvent; - slash.ContextMenuErrored += InteractionEvents.ContextCommandErrorEvent; - - var slashCommandClasses = Assembly.GetExecutingAssembly().GetTypes().Where(t => t.IsClass && t.Namespace == "Cliptok.Commands.InteractionCommands" && !t.IsNested); - foreach (var type in slashCommandClasses) - slash.RegisterCommands(type, cfgjson.ServerID); ; - }); -#pragma warning restore CS0618 // Type or member is obsolete - discordBuilder.UseCommandsNext(commands => { var commandClasses = Assembly.GetExecutingAssembly().GetTypes().Where(t => t.IsClass && t.Namespace == "Cliptok.Commands" && !t.IsNested);