fix(discord): use correct slash command context type in AddApplicationCommands
PR Checks / test-and-build (pull_request) Failing after 8m7s

The default AddApplicationCommands() registers ApplicationCommandService<ApplicationCommandContext>,
but our modules inherit ApplicationCommandModule<SlashCommandContext>. 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<SlashCommandInteraction, SlashCommandContext>() 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 <noreply@anthropic.com>
This commit is contained in:
2026-05-25 17:05:51 +03:00
parent 9375fa45b2
commit d931da37ec
5 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ on:
- main - main
env: env:
VERSION: 3.0.3 VERSION: 3.0.4
jobs: jobs:
# ЧАСТЬ 1: Собираем образы и кладем в Gitea (чтобы делиться с ребятами) # ЧАСТЬ 1: Собираем образы и кладем в Gitea (чтобы делиться с ребятами)
+1 -1
View File
@@ -1,6 +1,6 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<Version>3.0.3</Version> <Version>3.0.4</Version>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<LangVersion>preview</LangVersion> <LangVersion>preview</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
+3 -3
View File
@@ -49,7 +49,7 @@ services:
crond -f crond -f
bot: bot:
image: git.codeanddice.ru/toutsu/gmrelay-bot:3.0.3 image: git.codeanddice.ru/toutsu/gmrelay-bot:3.0.4
restart: always restart: always
depends_on: depends_on:
db: db:
@@ -67,7 +67,7 @@ services:
retries: 3 retries: 3
discord: 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 restart: always
depends_on: depends_on:
db: db:
@@ -84,7 +84,7 @@ services:
retries: 3 retries: 3
web: web:
image: git.codeanddice.ru/toutsu/gmrelay-web:3.0.3 image: git.codeanddice.ru/toutsu/gmrelay-web:3.0.4
restart: always restart: always
depends_on: depends_on:
db: db:
+2 -1
View File
@@ -21,6 +21,7 @@ using NetCord.Hosting.Gateway;
using NetCord.Hosting.Services; using NetCord.Hosting.Services;
using NetCord.Hosting.Services.ApplicationCommands; using NetCord.Hosting.Services.ApplicationCommands;
using NetCord.Hosting.Services.ComponentInteractions; using NetCord.Hosting.Services.ComponentInteractions;
using NetCord.Services.ApplicationCommands;
using NetCord.Services.ComponentInteractions; using NetCord.Services.ComponentInteractions;
using Npgsql; using Npgsql;
@@ -83,7 +84,7 @@ builder.Services
options.Token = discordOptions.Token; options.Token = discordOptions.Token;
options.Intents = GatewayIntents.Guilds; options.Intents = GatewayIntents.Guilds;
}) })
.AddApplicationCommands() .AddApplicationCommands<SlashCommandInteraction, SlashCommandContext>()
.AddComponentInteractions<ButtonInteraction, ButtonInteractionContext>() .AddComponentInteractions<ButtonInteraction, ButtonInteractionContext>()
.AddGatewayHandlers(typeof(Program).Assembly); .AddGatewayHandlers(typeof(Program).Assembly);
@@ -73,7 +73,7 @@
</button> </button>
</form> </form>
<div class="nav-version">v3.0.3</div> <div class="nav-version">v3.0.4</div>
</div> </div>
</Authorized> </Authorized>
<NotAuthorized> <NotAuthorized>