style: run format:apply
This commit is contained in:
+22
-11
@@ -1,29 +1,34 @@
|
|||||||
import { ChatInputCommandInteraction, MessageCreateOptions, MessageFlags, SlashCommandBuilder, TextChannel } from "discord.js";
|
import {
|
||||||
import { Command } from "../../commands";
|
ChatInputCommandInteraction,
|
||||||
|
MessageCreateOptions,
|
||||||
|
MessageFlags,
|
||||||
|
SlashCommandBuilder,
|
||||||
|
TextChannel
|
||||||
|
} from 'discord.js';
|
||||||
|
import { Command } from '../../commands';
|
||||||
|
|
||||||
const builder = new SlashCommandBuilder()
|
const builder = new SlashCommandBuilder()
|
||||||
.setName('bot-mimic')
|
.setName('bot-mimic')
|
||||||
.setDescription('Makes the bot send a message')
|
.setDescription('Makes the bot send a message')
|
||||||
.addStringOption(opt =>
|
.addStringOption((opt) =>
|
||||||
opt
|
opt
|
||||||
.setName('content')
|
.setName('content')
|
||||||
.setDescription('The text content of the message')
|
.setDescription('The text content of the message')
|
||||||
.setRequired(false)
|
.setRequired(false)
|
||||||
)
|
)
|
||||||
.addAttachmentOption(opt =>
|
.addAttachmentOption((opt) =>
|
||||||
opt
|
opt
|
||||||
.setName('attachment')
|
.setName('attachment')
|
||||||
.setDescription('An attachment for the message')
|
.setDescription('An attachment for the message')
|
||||||
.setRequired(false)
|
.setRequired(false)
|
||||||
)
|
)
|
||||||
.addStringOption(opt =>
|
.addStringOption((opt) =>
|
||||||
opt
|
opt
|
||||||
.setName('reply')
|
.setName('reply')
|
||||||
.setDescription('The message ID that the bot should reply to')
|
.setDescription('The message ID that the bot should reply to')
|
||||||
.setRequired(false)
|
.setRequired(false)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
const command: Command = {
|
const command: Command = {
|
||||||
name: 'bot-mimic',
|
name: 'bot-mimic',
|
||||||
builder: builder,
|
builder: builder,
|
||||||
@@ -32,7 +37,9 @@ const command: Command = {
|
|||||||
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
||||||
|
|
||||||
if (!interaction.channel?.isTextBased()) {
|
if (!interaction.channel?.isTextBased()) {
|
||||||
await interaction.editReply('This command can only be used in a text channel.');
|
await interaction.editReply(
|
||||||
|
'This command can only be used in a text channel.'
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +53,9 @@ const command: Command = {
|
|||||||
const replyId = interaction.options.getString('reply');
|
const replyId = interaction.options.getString('reply');
|
||||||
|
|
||||||
if (!content && !attachment) {
|
if (!content && !attachment) {
|
||||||
await interaction.editReply('Unable to send empty message. Specify content or attachment, or both.');
|
await interaction.editReply(
|
||||||
|
'Unable to send empty message. Specify content or attachment, or both.'
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,10 +79,12 @@ const command: Command = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (attachment) {
|
if (attachment) {
|
||||||
message.files = [{
|
message.files = [
|
||||||
|
{
|
||||||
attachment: attachment.proxyURL,
|
attachment: attachment.proxyURL,
|
||||||
name: attachment.name
|
name: attachment.name
|
||||||
}];
|
}
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -84,6 +95,6 @@ const command: Command = {
|
|||||||
await interaction.editReply('Failed to send message.');
|
await interaction.editReply('Failed to send message.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export default command;
|
export default command;
|
||||||
|
|||||||
Reference in New Issue
Block a user