Skip to content

Commit

Permalink
/queue: fix failure due to exceeding the character limit
Browse files Browse the repository at this point in the history
Closes #556
  • Loading branch information
kevinlul committed Nov 19, 2023
1 parent 8084575 commit d916378
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/slash/queue.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { RESTPostAPIApplicationCommandsJSONBody } from "discord-api-types/v10";
import { AutocompleteInteraction, ChatInputCommandInteraction, SlashCommandBuilder, userMention } from "discord.js";
import { ManualDeckSubmission, ManualTournament } from "../database/orm";
import { AutocompletableCommand } from "../SlashCommand";
import { getLogger, Logger } from "../util/logger";
import { ManualDeckSubmission, ManualTournament } from "../database/orm";
import { splitText } from "../deck";
import { Logger, getLogger } from "../util/logger";
import { authenticateHost, autocompleteTournament, tournamentOption } from "./database";

export class QueueCommand extends AutocompletableCommand {
Expand Down Expand Up @@ -52,9 +53,11 @@ export class QueueCommand extends AutocompletableCommand {
return;
}
const players = decks.map(d => userMention(d.discordId));

await interaction.reply(
`${players.length} player(s) are waiting for deck approval. List:\n${players.join(", ")}`
);
const text = `${players.length} player(s) are waiting for deck approval:\n${players.join(", ")}`;
const [first, ...rest] = splitText(text);
await interaction.reply(first);
for (const message of rest) {
await interaction.followUp(message);
}
}
}

0 comments on commit d916378

Please sign in to comment.