From 05f9d1d18c05d2b7130f55fc7fb781884730f4d7 Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Wed, 24 Jan 2024 07:24:09 +1100 Subject: [PATCH] Display limit for reason option in Punish.ts --- src/components/Punish.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Punish.ts b/src/components/Punish.ts index 2fffa47..d2c561a 100644 --- a/src/components/Punish.ts +++ b/src/components/Punish.ts @@ -10,6 +10,7 @@ export default async(client:TClient, interaction: Discord.ChatInputCommandIntera const reason = interaction.options.getString('reason') ?? 'Reason unspecified'; const GuildMember = interaction.options.getMember('member') ?? undefined; const User = interaction.options.getUser('member', true); + if (reason.length > 1020) return interaction.reply({content: 'Reason cannot be longer than 1020 characters due to Discord\'s limit.', ephemeral: true}); const punishLog = `${GuildMember?.user?.username ?? User?.username ?? 'No user data'} ${time ? ['warn', 'kick'].includes(type) ? 'and no duration set' : `and ${time} (duration)` : ''} was used in \`/${interaction.commandName}\` for \`${reason}\``; Logger.console('log', 'PunishmentLog', punishLog);