Skip to content

Commit

Permalink
Upgrade DSharpPlus to 5.0.0-nightly-02374
Browse files Browse the repository at this point in the history
  • Loading branch information
Erisa committed Oct 10, 2024
1 parent fff0560 commit db90087
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
6 changes: 3 additions & 3 deletions Cliptok.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

<ItemGroup>
<PackageReference Include="Abyssal.HumanDateParser" Version="2.0.0-20191113.1" />
<PackageReference Include="DSharpPlus" Version="5.0.0-nightly-02357" />
<PackageReference Include="DSharpPlus.CommandsNext" Version="5.0.0-nightly-02357" />
<PackageReference Include="DSharpPlus.SlashCommands" Version="5.0.0-nightly-02357" />
<PackageReference Include="DSharpPlus" Version="5.0.0-nightly-02374" />
<PackageReference Include="DSharpPlus.CommandsNext" Version="5.0.0-nightly-02374" />
<PackageReference Include="DSharpPlus.SlashCommands" Version="5.0.0-nightly-02374" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Serilog" Version="4.0.1" />
<PackageReference Include="Serilog.Expressions" Version="5.0.0" />
Expand Down
28 changes: 13 additions & 15 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using DSharpPlus.Extensions;
using DSharpPlus.Net.Gateway;
using DSharpPlus.SlashCommands;
using Serilog.Sinks.Grafana.Loki;
using System.Reflection;

Expand Down Expand Up @@ -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 _) { }

}

Expand Down Expand Up @@ -179,8 +178,19 @@ static async Task Main(string[] _)
discordBuilder.ConfigureServices(services =>
{
services.Replace<IGatewayController, GatewayController>();
#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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit db90087

Please sign in to comment.