Skip to content

Commit

Permalink
Truncate register modal title to 45 characters
Browse files Browse the repository at this point in the history
Fixes #521
  • Loading branch information
kevinlul committed Oct 22, 2023
1 parent 4fc3e66 commit f54a3b6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/slash/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ import {
AutocompleteInteraction,
ButtonBuilder,
ButtonInteraction,
channelMention,
ChatInputCommandInteraction,
DiscordAPIError,
GuildMember,
ModalBuilder,
ModalMessageModalSubmitInteraction,
RESTJSONErrorCodes,
SlashCommandBuilder,
TextInputBuilder
TextInputBuilder,
channelMention
} from "discord.js";
import { Not } from "typeorm";
import { AutocompletableCommand, ButtonClickHandler, MessageModalSubmitHandler } from "../SlashCommand";
import { TournamentStatus } from "../database/interface";
import { ManualParticipant, ManualTournament } from "../database/orm";
import { AutocompletableCommand, ButtonClickHandler, MessageModalSubmitHandler } from "../SlashCommand";
import { send } from "../util/discord";
import { getLogger, Logger } from "../util/logger";
import { Logger, getLogger } from "../util/logger";
import {
authenticateHost,
autocompleteTournament,
Expand Down Expand Up @@ -211,7 +211,10 @@ export class RegisterButtonHandler implements ButtonClickHandler {
return;
}
if (tournament.requireFriendCode) {
const modal = new ModalBuilder().setCustomId("registerModal").setTitle(`Register for ${tournament.name}`);
// Max title length of 45: https://github.com/DawnbrandBots/emcee-tournament-bot/issues/521
const modal = new ModalBuilder()
.setCustomId("registerModal")
.setTitle(`Register for ${tournament.name.slice(0, 32)}`);
const friendCodeInput = new TextInputBuilder()
.setCustomId("friendCode")
.setLabel("Master Duel Friend Code")
Expand Down

0 comments on commit f54a3b6

Please sign in to comment.