Skip to content

Commit 4327f34

Browse files
committed
fix: ignore Discord text commands and only handle slash commands
1 parent 292d605 commit 4327f34

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

packages/ims/discord/client.ts

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -198,16 +198,6 @@ function buildLauncherCommandText(params: {
198198
return `Open settings: ${settingsUrl}`;
199199
}
200200

201-
async function postLauncherCommandReply(params: {
202-
channel: any;
203-
command: "setting" | "channel" | "gh";
204-
userId: string;
205-
channelId: string;
206-
}): Promise<void> {
207-
const text = buildLauncherCommandText(params);
208-
await params.channel.send(text);
209-
}
210-
211201
async function registerDiscordCommands(client: Client): Promise<void> {
212202
try {
213203
const guilds = await client.guilds.fetch();
@@ -256,11 +246,9 @@ export async function startDiscordRuntime(reason: string): Promise<boolean> {
256246
const text = message.content.trim();
257247
const launcherCommand = parseLauncherCommand(text);
258248
if (launcherCommand) {
259-
await postLauncherCommandReply({
260-
channel: message.channel,
249+
log.debug("Ignoring Discord message command in thread; slash command handles it", {
261250
command: launcherCommand,
262-
userId: message.author.id,
263-
channelId: parentId,
251+
threadId,
264252
});
265253
return;
266254
}
@@ -293,10 +281,8 @@ export async function startDiscordRuntime(reason: string): Promise<boolean> {
293281

294282
const parentLauncherCommand = parseLauncherCommand(message.content);
295283
if (parentLauncherCommand) {
296-
await postLauncherCommandReply({
297-
channel: message.channel,
284+
log.debug("Ignoring Discord message command in parent channel; slash command handles it", {
298285
command: parentLauncherCommand,
299-
userId: message.author.id,
300286
channelId: parentId,
301287
});
302288
return;
@@ -308,10 +294,8 @@ export async function startDiscordRuntime(reason: string): Promise<boolean> {
308294
const cleaned = cleanBotMention(message.content, client.user.id);
309295
const cleanedLauncherCommand = parseLauncherCommand(cleaned);
310296
if (cleanedLauncherCommand) {
311-
await postLauncherCommandReply({
312-
channel: message.channel,
297+
log.debug("Ignoring Discord mention command; slash command handles it", {
313298
command: cleanedLauncherCommand,
314-
userId: message.author.id,
315299
channelId: parentId,
316300
});
317301
return;

0 commit comments

Comments
 (0)