diff options
| author | Fuwn <[email protected]> | 2025-10-06 21:46:11 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-10-06 21:46:11 -0700 |
| commit | 18c98788174b0d473ed008b06369deb8b6b89648 (patch) | |
| tree | 76e3a1d610aecb0d8a37f2d0f4c493ca79fd85e5 /packages/gateway | |
| parent | refactor(gateway): Replace uses of old GUILD_ID constant (diff) | |
| download | umabotdiscord-18c98788174b0d473ed008b06369deb8b6b89648.tar.xz umabotdiscord-18c98788174b0d473ed008b06369deb8b6b89648.zip | |
fix(gateway): Clean and lint
Diffstat (limited to 'packages/gateway')
12 files changed, 81 insertions, 22 deletions
diff --git a/packages/gateway/src/commands/react.ts b/packages/gateway/src/commands/react.ts index d31cc90..8e8e5b3 100644 --- a/packages/gateway/src/commands/react.ts +++ b/packages/gateway/src/commands/react.ts @@ -45,8 +45,11 @@ export const handleReactCommand = async (message: Message) => { try { targetChannel = await message.client.channels.fetch(channelId); - } catch (error) { - await replyWithCleanup(message, "❌ Channel not found or not accessible."); + } catch { + await replyWithCleanup( + message, + "❌ Channel not found or not accessible.", + ); return; } @@ -72,17 +75,30 @@ export const handleReactCommand = async (message: Message) => { } const existingReaction = targetMessage.reactions.cache.get(emoji); - const botReacted = existingReaction?.users.cache.has(message.client.user?.id || ''); + const botReacted = existingReaction?.users.cache.has( + message.client.user?.id || "", + ); if (botReacted) { - await targetMessage.reactions.cache.get(emoji)?.users.remove(message.client.user?.id); - await replyWithCleanup(message, `✅ Removed reaction ${emoji} from message in ${targetChannel}`); + await targetMessage.reactions.cache + .get(emoji) + ?.users.remove(message.client.user?.id); + await replyWithCleanup( + message, + `✅ Removed reaction ${emoji} from message in ${targetChannel}`, + ); } else { await targetMessage.react(emoji); - await replyWithCleanup(message, `✅ Reacted with ${emoji} to message in ${targetChannel}`); + await replyWithCleanup( + message, + `✅ Reacted with ${emoji} to message in ${targetChannel}`, + ); } } catch (error) { console.error("Error toggling reaction:", error); - await replyWithCleanup(message, "❌ Failed to toggle reaction on the message."); + await replyWithCleanup( + message, + "❌ Failed to toggle reaction on the message.", + ); } }; diff --git a/packages/gateway/src/constants.ts b/packages/gateway/src/constants.ts index e544c05..ba3ec00 100644 --- a/packages/gateway/src/constants.ts +++ b/packages/gateway/src/constants.ts @@ -1,5 +1,5 @@ -export { - CENTRAL_GUILD_ID, +export { + CENTRAL_GUILD_ID, ROLEPLAY_GUILD_ID, CENTRAL_MESSAGE_LOG_CHANNEL_ID, ROLEPLAY_MESSAGE_LOG_CHANNEL_ID, @@ -30,5 +30,5 @@ export { CENTRAL_USER_NSFW_APPLICATIONS_LOG_CHANNEL_ID, STAFF_GUILD_ID, STAFF_LOG_CHANNEL_ID, - CENTRAL_OKBUDDY_EMOJI_ID + CENTRAL_OKBUDDY_EMOJI_ID, } from "../../shared"; diff --git a/packages/gateway/src/listeners/clientReady/umagramCatchup.ts b/packages/gateway/src/listeners/clientReady/umagramCatchup.ts index 05b107b..0506cb5 100644 --- a/packages/gateway/src/listeners/clientReady/umagramCatchup.ts +++ b/packages/gateway/src/listeners/clientReady/umagramCatchup.ts @@ -1,5 +1,10 @@ import { Client } from "discord.js"; -import { CENTRAL_GUILD_ID, ROLEPLAY_GUILD_ID, CENTRAL_UMAGRAM_CHANNEL_ID, ROLEPLAY_UMAGRAM_CHANNEL_ID } from "../../constants"; +import { + CENTRAL_GUILD_ID, + ROLEPLAY_GUILD_ID, + CENTRAL_UMAGRAM_CHANNEL_ID, + ROLEPLAY_UMAGRAM_CHANNEL_ID, +} from "../../constants"; const GUILD_UMAGRAM_CHANNELS = { [CENTRAL_GUILD_ID]: CENTRAL_UMAGRAM_CHANNEL_ID, diff --git a/packages/gateway/src/listeners/clientReady/voiceConnection.ts b/packages/gateway/src/listeners/clientReady/voiceConnection.ts index 24c87cb..87101d8 100644 --- a/packages/gateway/src/listeners/clientReady/voiceConnection.ts +++ b/packages/gateway/src/listeners/clientReady/voiceConnection.ts @@ -5,7 +5,12 @@ import { VoiceConnectionDisconnectReason, createAudioPlayer, } from "@discordjs/voice"; -import { CENTRAL_GUILD_ID, ROLEPLAY_GUILD_ID, CENTRAL_VOICE_CHANNEL_ID, ROLEPLAY_VOICE_CHANNEL_ID } from "../../constants"; +import { + CENTRAL_GUILD_ID, + ROLEPLAY_GUILD_ID, + CENTRAL_VOICE_CHANNEL_ID, + ROLEPLAY_VOICE_CHANNEL_ID, +} from "../../constants"; const GUILD_VOICE_CHANNELS = { [CENTRAL_GUILD_ID]: CENTRAL_VOICE_CHANNEL_ID, diff --git a/packages/gateway/src/listeners/messageCreate/announcementReaction.ts b/packages/gateway/src/listeners/messageCreate/announcementReaction.ts index 87fada4..2ae2952 100644 --- a/packages/gateway/src/listeners/messageCreate/announcementReaction.ts +++ b/packages/gateway/src/listeners/messageCreate/announcementReaction.ts @@ -1,5 +1,8 @@ import { Message } from "discord.js"; -import { CENTRAL_ANNOUNCEMENTS_CHANNEL_ID, CENTRAL_OKBUDDY_EMOJI_ID } from "../../constants"; +import { + CENTRAL_ANNOUNCEMENTS_CHANNEL_ID, + CENTRAL_OKBUDDY_EMOJI_ID, +} from "../../constants"; export const handleAnnouncementReaction = async (message: Message) => { if (message.channelId !== CENTRAL_ANNOUNCEMENTS_CHANNEL_ID) return; diff --git a/packages/gateway/src/listeners/messageCreate/randomEyesReaction.ts b/packages/gateway/src/listeners/messageCreate/randomEyesReaction.ts index 8206eb9..ef81f84 100644 --- a/packages/gateway/src/listeners/messageCreate/randomEyesReaction.ts +++ b/packages/gateway/src/listeners/messageCreate/randomEyesReaction.ts @@ -1,5 +1,9 @@ import { Message } from "discord.js"; -import { CENTRAL_ART_MEDIA_CHANNEL_ID, CENTRAL_GENERAL_CHANNEL_ID, CENTRAL_UMABOT_CHANNEL_ID } from "../../constants"; +import { + CENTRAL_ART_MEDIA_CHANNEL_ID, + CENTRAL_GENERAL_CHANNEL_ID, + CENTRAL_UMABOT_CHANNEL_ID, +} from "../../constants"; const EYES_REACTION_CHANNELS = [ CENTRAL_ART_MEDIA_CHANNEL_ID, diff --git a/packages/gateway/src/listeners/messageCreate/roleMentionCooldown.ts b/packages/gateway/src/listeners/messageCreate/roleMentionCooldown.ts index 73cad2b..7ad6d44 100644 --- a/packages/gateway/src/listeners/messageCreate/roleMentionCooldown.ts +++ b/packages/gateway/src/listeners/messageCreate/roleMentionCooldown.ts @@ -1,7 +1,13 @@ import { Message } from "discord.js"; -import { CENTRAL_REVIVE_ROLEPLAY_ROLE_ID, CENTRAL_REVIVE_CHAT_ROLE_ID } from "../../constants"; +import { + CENTRAL_REVIVE_ROLEPLAY_ROLE_ID, + CENTRAL_REVIVE_CHAT_ROLE_ID, +} from "../../constants"; -const COOLDOWN_ROLES = [CENTRAL_REVIVE_ROLEPLAY_ROLE_ID, CENTRAL_REVIVE_CHAT_ROLE_ID]; +const COOLDOWN_ROLES = [ + CENTRAL_REVIVE_ROLEPLAY_ROLE_ID, + CENTRAL_REVIVE_CHAT_ROLE_ID, +]; const COOLDOWN_DURATION = 30 * 60 * 1000; const roleCooldowns = new Map<string, number>(); diff --git a/packages/gateway/src/listeners/messageCreate/roleplayThumbsUpReaction.ts b/packages/gateway/src/listeners/messageCreate/roleplayThumbsUpReaction.ts index 8f07a60..f5715ee 100644 --- a/packages/gateway/src/listeners/messageCreate/roleplayThumbsUpReaction.ts +++ b/packages/gateway/src/listeners/messageCreate/roleplayThumbsUpReaction.ts @@ -9,6 +9,9 @@ export const handleRoleplayThumbsUpReaction = async (message: Message) => { try { await message.react("👍"); } catch (error) { - console.error("Failed to add thumbs up reaction to roleplay message:", error); + console.error( + "Failed to add thumbs up reaction to roleplay message:", + error, + ); } }; diff --git a/packages/gateway/src/listeners/messageCreate/roleplayUmagram.ts b/packages/gateway/src/listeners/messageCreate/roleplayUmagram.ts index 7b132f9..e17674e 100644 --- a/packages/gateway/src/listeners/messageCreate/roleplayUmagram.ts +++ b/packages/gateway/src/listeners/messageCreate/roleplayUmagram.ts @@ -1,5 +1,10 @@ import { Message } from "discord.js"; -import { CENTRAL_GUILD_ID, ROLEPLAY_GUILD_ID, CENTRAL_UMAGRAM_CHANNEL_ID, ROLEPLAY_UMAGRAM_CHANNEL_ID } from "../../constants"; +import { + CENTRAL_GUILD_ID, + ROLEPLAY_GUILD_ID, + CENTRAL_UMAGRAM_CHANNEL_ID, + ROLEPLAY_UMAGRAM_CHANNEL_ID, +} from "../../constants"; const GUILD_UMAGRAM_CHANNELS = { [CENTRAL_GUILD_ID]: CENTRAL_UMAGRAM_CHANNEL_ID, diff --git a/packages/gateway/src/listeners/messageDeletion.ts b/packages/gateway/src/listeners/messageDeletion.ts index b548ac0..a4d33f6 100644 --- a/packages/gateway/src/listeners/messageDeletion.ts +++ b/packages/gateway/src/listeners/messageDeletion.ts @@ -1,6 +1,11 @@ import { Client, Events, EmbedBuilder } from "discord.js"; import { sendAuditLog } from "../commands/utilities"; -import { CENTRAL_GUILD_ID, ROLEPLAY_GUILD_ID, CENTRAL_MESSAGE_LOG_CHANNEL_ID, ROLEPLAY_MESSAGE_LOG_CHANNEL_ID } from "../constants"; +import { + CENTRAL_GUILD_ID, + ROLEPLAY_GUILD_ID, + CENTRAL_MESSAGE_LOG_CHANNEL_ID, + ROLEPLAY_MESSAGE_LOG_CHANNEL_ID, +} from "../constants"; const GUILD_CHANNEL_MAPPINGS = { [CENTRAL_GUILD_ID]: CENTRAL_MESSAGE_LOG_CHANNEL_ID, @@ -45,7 +50,7 @@ export const handleMessageDeletion = (client: Client) => { if (isPrivilegedDeleter) return; } } catch (error) { - console.log("Could not fetch audit logs for message deletion"); + console.log("Could not fetch audit logs for message deletion:", error); } try { diff --git a/packages/gateway/src/listeners/messageEdit.ts b/packages/gateway/src/listeners/messageEdit.ts index 18e4ca3..17da845 100644 --- a/packages/gateway/src/listeners/messageEdit.ts +++ b/packages/gateway/src/listeners/messageEdit.ts @@ -1,6 +1,11 @@ import { Client, Events, EmbedBuilder } from "discord.js"; import { sendAuditLog } from "../commands/utilities"; -import { CENTRAL_GUILD_ID, ROLEPLAY_GUILD_ID, CENTRAL_MESSAGE_LOG_CHANNEL_ID, ROLEPLAY_MESSAGE_LOG_CHANNEL_ID } from "../constants"; +import { + CENTRAL_GUILD_ID, + ROLEPLAY_GUILD_ID, + CENTRAL_MESSAGE_LOG_CHANNEL_ID, + ROLEPLAY_MESSAGE_LOG_CHANNEL_ID, +} from "../constants"; const GUILD_CHANNEL_MAPPINGS = { [CENTRAL_GUILD_ID]: CENTRAL_MESSAGE_LOG_CHANNEL_ID, diff --git a/packages/gateway/src/listeners/roleProtection.ts b/packages/gateway/src/listeners/roleProtection.ts index e2e8c2c..4d290a3 100644 --- a/packages/gateway/src/listeners/roleProtection.ts +++ b/packages/gateway/src/listeners/roleProtection.ts @@ -41,7 +41,9 @@ export const handleRoleProtection = (client: Client) => { if (addedRoles.size === 0) return; try { - const protectedRole = newMember.guild.roles.cache.get(CENTRAL_PROTECTED_ROLE_ID); + const protectedRole = newMember.guild.roles.cache.get( + CENTRAL_PROTECTED_ROLE_ID, + ); if (!protectedRole) { console.error("Protected role not found"); |