fix: avoid Discord /tts conflict

This commit is contained in:
Peter Steinberger
2026-01-24 09:58:06 +00:00
parent cfdd5a8c2e
commit c8c58c0537
8 changed files with 52 additions and 14 deletions

View File

@@ -254,7 +254,7 @@ async function handleDiscordCommandArgInteraction(
return;
}
const commandDefinition =
findCommandByNativeName(parsed.command) ??
findCommandByNativeName(parsed.command, "discord") ??
listChatCommands().find((entry) => entry.key === parsed.command);
if (!commandDefinition) {
await safeDiscordInteractionCall("command arg update", () =>
@@ -395,7 +395,7 @@ export function createDiscordNativeCommand(params: {
}) {
const { command, cfg, discordConfig, accountId, sessionPrefix, ephemeralDefault } = params;
const commandDefinition =
findCommandByNativeName(command.name) ??
findCommandByNativeName(command.name, "discord") ??
({
key: command.name,
nativeName: command.name,

View File

@@ -346,11 +346,13 @@ export async function monitorDiscordProvider(opts: MonitorDiscordOpts = {}) {
const maxDiscordCommands = 100;
let skillCommands =
nativeEnabled && nativeSkillsEnabled ? listSkillCommandsForAgents({ cfg }) : [];
let commandSpecs = nativeEnabled ? listNativeCommandSpecsForConfig(cfg, { skillCommands }) : [];
let commandSpecs = nativeEnabled
? listNativeCommandSpecsForConfig(cfg, { skillCommands, provider: "discord" })
: [];
const initialCommandCount = commandSpecs.length;
if (nativeEnabled && nativeSkillsEnabled && commandSpecs.length > maxDiscordCommands) {
skillCommands = [];
commandSpecs = listNativeCommandSpecsForConfig(cfg, { skillCommands: [] });
commandSpecs = listNativeCommandSpecsForConfig(cfg, { skillCommands: [], provider: "discord" });
runtime.log?.(
warn(
`discord: ${initialCommandCount} commands exceeds limit; removing per-skill commands and keeping /skill.`,