From 4def4e877a29f1bf2cac6f319368a6587426d001 Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Tue, 20 Feb 2024 18:58:59 +1100 Subject: [PATCH] I hate the board that clips papers --- src/commands/mp.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/commands/mp.ts b/src/commands/mp.ts index c480954..634c34f 100644 --- a/src/commands/mp.ts +++ b/src/commands/mp.ts @@ -149,7 +149,9 @@ export default class MP { if (client.config.dcServer.id === interaction.guildId) { if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmod) && !interaction.member.roles.cache.has(client.config.dcServer.roles.bottech)) return MessageTool.youNeedRole(interaction, 'mpmod'); } - const msg = await (interaction.guild.channels.cache.get(channels.announcements) as Discord.TextChannel).messages.fetch(interaction.options.getString('message_id', true)); + const msg_id = interaction.options.getString('message_id', true); + const stripUrl = msg_id.replace(/https:\/\/discord.com\/channels\/\d+\/\d+\/(\d+)/, '$1'); + const msg = await (interaction.guild.channels.cache.get(channels.announcements) as Discord.TextChannel).messages.fetch(stripUrl).catch(()=>null); if (!msg) return interaction.reply('Message not found, please make sure you have the correct message ID.'); if (msg.embeds[0].title !== 'Vote for next map!') return interaction.reply('This message is not a poll!');