From d931da37ecd86394711c841704b9c82fa0bc35e9 Mon Sep 17 00:00:00 2001 From: Toutsu Date: Mon, 25 May 2026 17:05:51 +0300 Subject: [PATCH] fix(discord): use correct slash command context type in AddApplicationCommands The default AddApplicationCommands() registers ApplicationCommandService, but our modules inherit ApplicationCommandModule. Because SlashCommandContext does not inherit from ApplicationCommandContext in NetCord, AddModules(typeof(Program).Assembly) failed to discover the modules, so /newsession, /listsessions, /reschedule were never published to Discord. Only /ping worked because it uses the minimal API route. Fix: specify AddApplicationCommands() so the service matches the module context type, allowing module discovery to succeed. Bump version to 3.0.4. Co-Authored-By: Claude Opus 4.7 --- .gitea/workflows/deploy.yml | 2 +- Directory.Build.props | 2 +- compose.yaml | 6 +++--- src/GmRelay.DiscordBot/Program.cs | 3 ++- src/GmRelay.Web/Components/Layout/NavMenu.razor | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index aef72d3..34f1f77 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -6,7 +6,7 @@ on: - main env: - VERSION: 3.0.3 + VERSION: 3.0.4 jobs: # ЧАСТЬ 1: Собираем образы и кладем в Gitea (чтобы делиться с ребятами) diff --git a/Directory.Build.props b/Directory.Build.props index b5a75ae..933ddd6 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 3.0.3 + 3.0.4 net10.0 preview enable diff --git a/compose.yaml b/compose.yaml index c1625b7..f49d434 100644 --- a/compose.yaml +++ b/compose.yaml @@ -49,7 +49,7 @@ services: crond -f bot: - image: git.codeanddice.ru/toutsu/gmrelay-bot:3.0.3 + image: git.codeanddice.ru/toutsu/gmrelay-bot:3.0.4 restart: always depends_on: db: @@ -67,7 +67,7 @@ services: retries: 3 discord: - image: git.codeanddice.ru/toutsu/gmrelay-discord-bot:3.0.3 + image: git.codeanddice.ru/toutsu/gmrelay-discord-bot:3.0.4 restart: always depends_on: db: @@ -84,7 +84,7 @@ services: retries: 3 web: - image: git.codeanddice.ru/toutsu/gmrelay-web:3.0.3 + image: git.codeanddice.ru/toutsu/gmrelay-web:3.0.4 restart: always depends_on: db: diff --git a/src/GmRelay.DiscordBot/Program.cs b/src/GmRelay.DiscordBot/Program.cs index 92ceca9..52bbc1b 100644 --- a/src/GmRelay.DiscordBot/Program.cs +++ b/src/GmRelay.DiscordBot/Program.cs @@ -21,6 +21,7 @@ using NetCord.Hosting.Gateway; using NetCord.Hosting.Services; using NetCord.Hosting.Services.ApplicationCommands; using NetCord.Hosting.Services.ComponentInteractions; +using NetCord.Services.ApplicationCommands; using NetCord.Services.ComponentInteractions; using Npgsql; @@ -83,7 +84,7 @@ builder.Services options.Token = discordOptions.Token; options.Intents = GatewayIntents.Guilds; }) - .AddApplicationCommands() + .AddApplicationCommands() .AddComponentInteractions() .AddGatewayHandlers(typeof(Program).Assembly); diff --git a/src/GmRelay.Web/Components/Layout/NavMenu.razor b/src/GmRelay.Web/Components/Layout/NavMenu.razor index 2569cf9..f559b16 100644 --- a/src/GmRelay.Web/Components/Layout/NavMenu.razor +++ b/src/GmRelay.Web/Components/Layout/NavMenu.razor @@ -73,7 +73,7 @@ - +