From 956ed319e7722d168b4c23d5c6aeb85b20e5b15d Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 28 Sep 2025 00:06:49 -0700 Subject: fix(gateway): Lint --- packages/gateway/src/commands/start.ts | 114 ++++++++++++++++----------------- 1 file changed, 56 insertions(+), 58 deletions(-) (limited to 'packages/gateway/src/commands/start.ts') diff --git a/packages/gateway/src/commands/start.ts b/packages/gateway/src/commands/start.ts index b6c9300..9b8beb5 100644 --- a/packages/gateway/src/commands/start.ts +++ b/packages/gateway/src/commands/start.ts @@ -2,80 +2,78 @@ import { Message } from "discord.js"; import { sendProgressUpdate, executeBulkRoleAssignment } from "./utilities"; export const handleStartCommand = async (message: Message) => { - if (message.author.bot) return; + if (message.author.bot) return; - if (message.content.toLowerCase().startsWith("uma!start")) { - const application = await message.client.application?.fetch(); - const ownerId = application?.owner?.id; + if (message.content.toLowerCase().startsWith("uma!start")) { + const application = await message.client.application?.fetch(); + const ownerId = application?.owner?.id; - if (message.author.id !== ownerId) return; + if (message.author.id !== ownerId) return; - const parameters = message.content.split(" ").slice(1); + const parameters = message.content.split(" ").slice(1); - if (parameters.length < 3) { - await message.reply( - "❌ Usage: `uma!start [action]`\nExample: `uma!start @Participant #general 1415599617214513254 execute`", - ); - - return; - } - - const roleMention = parameters[0]; - const channelOrCategory = parameters[1]; - const updateChannelId = parameters[2]; - const action = parameters[3] || "execute"; - const roleMatch = roleMention.match(/<@&(\d+)>/); + if (parameters.length < 3) { + await message.reply( + "❌ Usage: `uma!start [action]`\nExample: `uma!start @Participant #general 1415599617214513254 execute`", + ); - if (!roleMatch) { - await message.reply( - "❌ Please mention a role. Example: `@Participant`", - ); + return; + } - return; - } + const roleMention = parameters[0]; + const channelOrCategory = parameters[1]; + const updateChannelId = parameters[2]; + const action = parameters[3] || "execute"; + const roleMatch = roleMention.match(/<@&(\d+)>/); - const roleId = roleMatch[1]; - let channelId: string | undefined; - let categoryId: string | undefined; - const channelMatch = channelOrCategory.match(/<#(\d+)>/); + if (!roleMatch) { + await message.reply("❌ Please mention a role. Example: `@Participant`"); - if (channelMatch) { - channelId = channelMatch[1]; - } else { - categoryId = channelOrCategory; - } + return; + } - if (action !== "preview" && action !== "execute") { - await message.reply("❌ Action must be either `preview` or `execute`"); + const roleId = roleMatch[1]; + let channelId: string | undefined; + let categoryId: string | undefined; + const channelMatch = channelOrCategory.match(/<#(\d+)>/); - return; - } + if (channelMatch) { + channelId = channelMatch[1]; + } else { + categoryId = channelOrCategory; + } - if (action === "preview") { - await message.reply( - "📋 Preview mode - this would check the specified channel(s) for users who have sent messages.", - ); + if (action !== "preview" && action !== "execute") { + await message.reply("❌ Action must be either `preview` or `execute`"); - return; - } + return; + } + if (action === "preview") { await message.reply( - "🚀 Bulk role operation started! Check the progress channel for updates.", + "📋 Preview mode - this would check the specified channel(s) for users who have sent messages.", ); - executeBulkRoleAssignment( + return; + } + + await message.reply( + "🚀 Bulk role operation started! Check the progress channel for updates.", + ); + + executeBulkRoleAssignment( + message.client, + roleId, + updateChannelId, + channelId, + categoryId, + ).catch((error) => { + console.error("Bulk role assignment failed:", error); + sendProgressUpdate( message.client, - roleId, + "❌ Bulk role assignment failed due to an error", updateChannelId, - channelId, - categoryId, - ).catch((error) => { - console.error("Bulk role assignment failed:", error); - sendProgressUpdate( - message.client, - "❌ Bulk role assignment failed due to an error", - updateChannelId, - ); - }); - } + ); + }); + } }; -- cgit v1.2.3