From 06926e5601cfc65be31aa21d7a31b07e612d660e Mon Sep 17 00:00:00 2001 From: neru Date: Wed, 11 Feb 2026 02:36:44 -0300 Subject: [PATCH] style: run format:apply --- src/commands/bot/mimic.ts | 159 ++++++++++++++++++++------------------ 1 file changed, 85 insertions(+), 74 deletions(-) diff --git a/src/commands/bot/mimic.ts b/src/commands/bot/mimic.ts index 2dbfa5d..529b16c 100644 --- a/src/commands/bot/mimic.ts +++ b/src/commands/bot/mimic.ts @@ -1,89 +1,100 @@ -import { ChatInputCommandInteraction, MessageCreateOptions, MessageFlags, SlashCommandBuilder, TextChannel } from "discord.js"; -import { Command } from "../../commands"; +import { + ChatInputCommandInteraction, + MessageCreateOptions, + MessageFlags, + SlashCommandBuilder, + TextChannel +} from 'discord.js'; +import { Command } from '../../commands'; const builder = new SlashCommandBuilder() - .setName('bot-mimic') - .setDescription('Makes the bot send a message') - .addStringOption(opt => - opt - .setName('content') - .setDescription('The text content of the message') - .setRequired(false) - ) - .addAttachmentOption(opt => - opt - .setName('attachment') - .setDescription('An attachment for the message') - .setRequired(false) - ) - .addStringOption(opt => - opt - .setName('reply') - .setDescription('The message ID that the bot should reply to') - .setRequired(false) - ); - + .setName('bot-mimic') + .setDescription('Makes the bot send a message') + .addStringOption((opt) => + opt + .setName('content') + .setDescription('The text content of the message') + .setRequired(false) + ) + .addAttachmentOption((opt) => + opt + .setName('attachment') + .setDescription('An attachment for the message') + .setRequired(false) + ) + .addStringOption((opt) => + opt + .setName('reply') + .setDescription('The message ID that the bot should reply to') + .setRequired(false) + ); const command: Command = { - name: 'bot-mimic', - builder: builder, - ownerOnly: true, - execute: async (interaction: ChatInputCommandInteraction): Promise => { - await interaction.deferReply({ flags: MessageFlags.Ephemeral }); + name: 'bot-mimic', + builder: builder, + ownerOnly: true, + execute: async (interaction: ChatInputCommandInteraction): Promise => { + await interaction.deferReply({ flags: MessageFlags.Ephemeral }); - if (!interaction.channel?.isTextBased()) { - await interaction.editReply('This command can only be used in a text channel.'); - return; - } + if (!interaction.channel?.isTextBased()) { + await interaction.editReply( + 'This command can only be used in a text channel.' + ); + return; + } - if (!interaction.channel.isSendable()) { - await interaction.editReply('Channel is not sendable'); - return; - } + if (!interaction.channel.isSendable()) { + await interaction.editReply('Channel is not sendable'); + return; + } - const content = interaction.options.getString('content'); - const attachment = interaction.options.getAttachment('attachment'); - const replyId = interaction.options.getString('reply'); + const content = interaction.options.getString('content'); + const attachment = interaction.options.getAttachment('attachment'); + const replyId = interaction.options.getString('reply'); - if (!content && !attachment) { - await interaction.editReply('Unable to send empty message. Specify content or attachment, or both.'); - return; - } + if (!content && !attachment) { + await interaction.editReply( + 'Unable to send empty message. Specify content or attachment, or both.' + ); + return; + } - const channel = interaction.channel as TextChannel; - const message: MessageCreateOptions = {}; + const channel = interaction.channel as TextChannel; + const message: MessageCreateOptions = {}; - if (content) { - message.content = content; - } + if (content) { + message.content = content; + } - if (replyId) { - try { - const replyMessage = await channel.messages.fetch(replyId); - message.reply = { - messageReference: replyMessage.id - }; - } catch { - await interaction.editReply('Invalid message ID for reply.'); - return; - } - } + if (replyId) { + try { + const replyMessage = await channel.messages.fetch(replyId); + message.reply = { + messageReference: replyMessage.id + }; + } catch { + await interaction.editReply('Invalid message ID for reply.'); + return; + } + } - if (attachment) { - message.files = [{ - attachment: attachment.proxyURL, - name: attachment.name - }]; - } + if (attachment) { + message.files = [ + { + attachment: attachment.proxyURL, + name: attachment.name + } + ]; + } - try { - await channel.send(message); - await interaction.editReply('Message sent successfully.'); - } catch (error) { - console.error('Failed to send message:', error); - await interaction.editReply('Failed to send message.'); - } - } -} + try { + await channel.send(message); + await interaction.editReply('Message sent successfully.'); + } catch (error) { + console.error('Failed to send message:', error); + await interaction.editReply('Failed to send message.'); + } + } +}; export default command;