From 32cf0a36481ee7dfcca310f5a06aa73f4cd20461 Mon Sep 17 00:00:00 2001 From: Declan Chidlow Date: Sun, 30 Aug 2026 17:25:32 +0800 Subject: [PATCH] Fix emoji prefixes --- .../bot/src/bot/commands/moderation/role.ts | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/packages/bot/src/bot/commands/moderation/role.ts b/packages/bot/src/bot/commands/moderation/role.ts index 1f6bd7b..e88f438 100644 --- a/packages/bot/src/bot/commands/moderation/role.ts +++ b/packages/bot/src/bot/commands/moderation/role.ts @@ -18,7 +18,7 @@ export default { const action = args.shift()?.toLowerCase(); const normalizeEmoji = (emoji: string) => { - return emoji.replace(/^:([A-Z0-9]+):$/i, "$1").replace(/[\uFE0F\uFE0E\uE0E2]/g, ""); + return emoji.replace(/^:([A-Z0-9]+):$/i, "$1").replace(/[\uFE0F\uFE0E\uE0E1-\uE0E9]/g, ""); }; if (action === "reaction") { @@ -47,24 +47,19 @@ export default { return message.reply("Please provide a valid emoji."); } - const roleHierarchyErr = await checkRoleAction( - server.roles.get(roleId), - message, - "assign this role", - "AssignRoles", - ); - if (roleHierarchyErr) return message.reply({ embeds: [roleHierarchyErr] }); - - const channel = message.channel; - if (!channel) { - return message.reply("This command must be used in a channel."); - } + const roleHierarchyErr = await checkRoleAction(server.roles.get(roleId), message, "assign this role", "AssignRoles"); + if (roleHierarchyErr) return message.reply({ embeds: [roleHierarchyErr] }); - if (!channel.havePermission("React")) { - return message.reply("I don't have permission to add reactions in this channel."); - } + const channel = message.channel; + if (!channel) { + return message.reply("This command must be used in a channel."); + } - try { + if (!channel.havePermission("React")) { + return message.reply("I don't have permission to add reactions in this channel."); + } + + try { const targetMsg = await channel.fetchMessage(messageId); await targetMsg.react(emoji); @@ -101,8 +96,8 @@ export default { return message.reply("No reaction role found for that message and emoji combination."); } - const channel = message.channel; - if (channel && channel.havePermission("React")) { + const channel = message.channel; + if (channel && channel.havePermission("React")) { try { const targetMsg = await channel.fetchMessage(messageId); await targetMsg.unreact(emoji); -- 2.51.2