Fix a bunch of linter errors
diff --git a/src/commands/mod/slowmode.ts b/src/commands/mod/slowmode.ts
index 7e8b8a2..1a06db1 100644
--- a/src/commands/mod/slowmode.ts
+++ b/src/commands/mod/slowmode.ts
@@ -5,29 +5,51 @@
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
-
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
.setName("slowmode")
.setDescription("Manages slowmode in a channel")
- .addStringOption(option => option.setName("time").setDescription("The delay between messages").setRequired(false).addChoices([
- ["Off", "0"],
- ["5 seconds", "5"], ["10 seconds", "10"], ["15 seconds", "15"], ["30 seconds", "30"],
- ["1 minute", "60"], ["2 minutes", "120"], ["5 minutes", "300"], ["10 minutes", "600"],
- ["15 minutes", "900"], ["30 minutes", "1800"],
- ["1 hour", "3600"], ["2 hours", "7200"], ["6 hours", "21600"]
- ]));
+ .addStringOption((option) =>
+ option
+ .setName("time")
+ .setDescription("The delay between messages")
+ .setRequired(false)
+ .addChoices([
+ ["Off", "0"],
+ ["5 seconds", "5"],
+ ["10 seconds", "10"],
+ ["15 seconds", "15"],
+ ["30 seconds", "30"],
+ ["1 minute", "60"],
+ ["2 minutes", "120"],
+ ["5 minutes", "300"],
+ ["10 minutes", "600"],
+ ["15 minutes", "900"],
+ ["30 minutes", "1800"],
+ ["1 hour", "3600"],
+ ["2 hours", "7200"],
+ ["6 hours", "21600"]
+ ])
+ );
const callback = async (interaction: CommandInteraction): Promise<void> => {
let time = parseInt(interaction.options.getString("time") ?? "0");
- if (time === 0 && (interaction.channel as TextChannel).rateLimitPerUser === 0) { time = 10; }
+ if (
+ time === 0 &&
+ (interaction.channel as TextChannel).rateLimitPerUser === 0
+ ) {
+ time = 10;
+ }
const confirmation = await new confirmationMessage(interaction)
.setEmoji("CHANNEL.SLOWMODE.OFF")
.setTitle("Slowmode")
- .setDescription(keyValueList({
- "time": time ? humanizeDuration(time * 1000, { round: true }) : "No delay"
- })
- + "Are you sure you want to set the slowmode in this channel?")
+ .setDescription(
+ keyValueList({
+ time: time
+ ? humanizeDuration(time * 1000, { round: true })
+ : "No delay"
+ }) + "Are you sure you want to set the slowmode in this channel?"
+ )
.setColor("Danger")
.send();
if (confirmation.cancelled) return;
@@ -35,37 +57,53 @@
try {
(interaction.channel as TextChannel).setRateLimitPerUser(time);
} catch (e) {
- await interaction.editReply({embeds: [new EmojiEmbed()
- .setEmoji("CHANNEL.SLOWMODE.OFF")
- .setTitle("Slowmode")
- .setDescription("Something went wrong while setting the slowmode")
- .setStatus("Danger")
- ], components: []});
+ await interaction.editReply({
+ embeds: [
+ new EmojiEmbed()
+ .setEmoji("CHANNEL.SLOWMODE.OFF")
+ .setTitle("Slowmode")
+ .setDescription(
+ "Something went wrong while setting the slowmode"
+ )
+ .setStatus("Danger")
+ ],
+ components: []
+ });
}
- await interaction.editReply({embeds: [new EmojiEmbed()
- .setEmoji("CHANNEL.SLOWMODE.ON")
- .setTitle("Slowmode")
- .setDescription("The channel slowmode was set successfully")
- .setStatus("Success")
- ], components: []});
+ await interaction.editReply({
+ embeds: [
+ new EmojiEmbed()
+ .setEmoji("CHANNEL.SLOWMODE.ON")
+ .setTitle("Slowmode")
+ .setDescription("The channel slowmode was set successfully")
+ .setStatus("Success")
+ ],
+ components: []
+ });
} else {
- await interaction.editReply({embeds: [new EmojiEmbed()
- .setEmoji("CHANNEL.SLOWMODE.ON")
- .setTitle("Slowmode")
- .setDescription("No changes were made")
- .setStatus("Success")
- ], components: []});
+ await interaction.editReply({
+ embeds: [
+ new EmojiEmbed()
+ .setEmoji("CHANNEL.SLOWMODE.ON")
+ .setTitle("Slowmode")
+ .setDescription("No changes were made")
+ .setStatus("Success")
+ ],
+ components: []
+ });
}
};
const check = (interaction: CommandInteraction) => {
- const member = (interaction.member as GuildMember);
+ const member = interaction.member as GuildMember;
// Check if Nucleus can set the slowmode
- if (! interaction.guild.me.permissions.has("MANAGE_CHANNELS")) throw "I do not have the *Manage Channels* permission";
+ if (!interaction.guild.me.permissions.has("MANAGE_CHANNELS"))
+ throw "I do not have the *Manage Channels* permission";
// Check if the user has manage_channel permission
- if (! member.permissions.has("MANAGE_CHANNELS")) throw "You do not have the *Manage Channels* permission";
+ if (!member.permissions.has("MANAGE_CHANNELS"))
+ throw "You do not have the *Manage Channels* permission";
// Allow slowmode
return true;
};
-export { command, callback, check };
\ No newline at end of file
+export { command, callback, check };