Bug fixes and ~~performance~~ typing improvements
diff --git a/src/commands/settings/commands.ts b/src/commands/settings/commands.ts
index 13cfa89..19a13e3 100644
--- a/src/commands/settings/commands.ts
+++ b/src/commands/settings/commands.ts
@@ -1,10 +1,5 @@
import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, {
- CommandInteraction,
- MessageActionRow,
- MessageButton,
- TextInputComponent
-} from "discord.js";
+import Discord, { CommandInteraction, MessageActionRow, MessageButton, TextInputComponent } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
@@ -17,18 +12,10 @@
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
.setName("commands")
- .setDescription(
- "Links and text shown to a user after a moderator action is performed"
- )
- .addRoleOption((o) =>
- o
- .setName("role")
- .setDescription("The role given when a member is muted")
- );
+ .setDescription("Links and text shown to a user after a moderator action is performed")
+ .addRoleOption((o) => o.setName("role").setDescription("The role given when a member is muted"));
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
await interaction.reply({
embeds: LoadingEmbed,
ephemeral: true,
@@ -75,9 +62,7 @@
.setDescription(
"These links are shown below the message sent in a user's DM when they are punished.\n\n" +
"**Mute Role:** " +
- (moderation.mute.role
- ? `<@&${moderation.mute.role}>`
- : "*None set*")
+ (moderation.mute.role ? `<@&${moderation.mute.role}>` : "*None set*")
)
],
components: [
@@ -117,35 +102,16 @@
]),
new MessageActionRow().addComponents([
new MessageButton()
- .setLabel(
- clicked === "clearMuteRole"
- ? "Click again to confirm"
- : "Clear mute role"
- )
+ .setLabel(clicked === "clearMuteRole" ? "Click again to confirm" : "Clear mute role")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
.setCustomId("clearMuteRole")
.setStyle("DANGER")
.setDisabled(!moderation.mute.role),
new MessageButton()
.setCustomId("timeout")
- .setLabel(
- "Mute timeout " +
- (moderation.mute.timeout
- ? "Enabled"
- : "Disabled")
- )
- .setStyle(
- moderation.mute.timeout ? "SUCCESS" : "DANGER"
- )
- .setEmoji(
- getEmojiByName(
- "CONTROL." +
- (moderation.mute.timeout
- ? "TICK"
- : "CROSS"),
- "id"
- )
- )
+ .setLabel("Mute timeout " + (moderation.mute.timeout ? "Enabled" : "Disabled"))
+ .setStyle(moderation.mute.timeout ? "SUCCESS" : "DANGER")
+ .setEmoji(getEmojiByName("CONTROL." + (moderation.mute.timeout ? "TICK" : "CROSS"), "id"))
])
]
});
@@ -193,9 +159,7 @@
new MessageActionRow<TextInputComponent>().addComponents(
new TextInputComponent()
.setCustomId("url")
- .setLabel(
- "URL - Type {id} to insert the user's ID"
- )
+ .setLabel("URL - Type {id} to insert the user's ID")
.setMaxLength(2000)
.setRequired(false)
.setStyle("SHORT")
@@ -207,9 +171,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Moderation Links")
- .setDescription(
- "Modal opened. If you can't see it, click back and try again."
- )
+ .setDescription("Modal opened. If you can't see it, click back and try again.")
.setStatus("Success")
.setEmoji("GUILD.TICKET.OPEN")
],
@@ -235,14 +197,9 @@
}
if (out.fields) {
const buttonText = out.fields.getTextInputValue("name");
- const buttonLink = out.fields
- .getTextInputValue("url")
- .replace(/{id}/gi, "{id}");
+ const buttonLink = out.fields.getTextInputValue("url").replace(/{id}/gi, "{id}");
const current = chosen;
- if (
- current.text !== buttonText ||
- current.link !== buttonLink
- ) {
+ if (current.text !== buttonText || current.link !== buttonLink) {
chosen = { text: buttonText, link: buttonLink };
await client.database.guilds.write(interaction.guild.id, {
["moderation." + i.customId]: {
@@ -258,10 +215,7 @@
}
};
-const check = (
- interaction: CommandInteraction,
- _defaultCheck: WrappedCheck
-) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("MANAGE_GUILD"))
throw "You must have the *Manage Server* permission to use this command";
diff --git a/src/commands/settings/logs/attachment.ts b/src/commands/settings/logs/attachment.ts
index ea8aa51..8e72651 100644
--- a/src/commands/settings/logs/attachment.ts
+++ b/src/commands/settings/logs/attachment.ts
@@ -1,10 +1,6 @@
import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js";
import { ChannelType } from "discord-api-types/v9";
-import Discord, {
- CommandInteraction,
- MessageActionRow,
- MessageButton
-} from "discord.js";
+import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../../utils/confirmationMessage.js";
import getEmojiByName from "../../../utils/getEmojiByName.js";
@@ -24,9 +20,7 @@
.setRequired(false)
);
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const m = (await interaction.reply({
embeds: LoadingEmbed,
ephemeral: true,
@@ -42,9 +36,7 @@
new EmojiEmbed()
.setEmoji("CHANNEL.TEXT.DELETE")
.setTitle("Attachment Log Channel")
- .setDescription(
- "The channel you provided is not a valid channel"
- )
+ .setDescription("The channel you provided is not a valid channel")
.setStatus("Danger")
]
});
@@ -55,9 +47,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Attachment Log Channel")
- .setDescription(
- "You must choose a channel in this server"
- )
+ .setDescription("You must choose a channel in this server")
.setStatus("Danger")
.setEmoji("CHANNEL.TEXT.DELETE")
]
@@ -79,8 +69,7 @@
await client.database.guilds.write(interaction.guild.id, {
"logging.attachments.channel": channel.id
});
- const { log, NucleusColors, entry, renderUser, renderChannel } =
- client.logger;
+ const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
const data = {
meta: {
type: "attachmentChannelUpdate",
@@ -91,14 +80,8 @@
timestamp: new Date().getTime()
},
list: {
- memberId: entry(
- interaction.user.id,
- `\`${interaction.user.id}\``
- ),
- changedBy: entry(
- interaction.user.id,
- renderUser(interaction.user)
- ),
+ memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
+ changedBy: entry(interaction.user.id, renderUser(interaction.user)),
channel: entry(channel.id, renderChannel(channel))
},
hidden: {
@@ -111,9 +94,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Attachment Log Channel")
- .setDescription(
- "Something went wrong and the attachment log channel could not be set"
- )
+ .setDescription("Something went wrong and the attachment log channel could not be set")
.setStatus("Danger")
.setEmoji("CHANNEL.TEXT.DELETE")
],
@@ -145,9 +126,7 @@
channel
? `Your attachment log channel is currently set to <#${channel}>`
: "This server does not have an attachment log channel" +
- (client.database.premium.hasPremium(
- interaction.guild.id
- )
+ (client.database.premium.hasPremium(interaction.guild.id)
? ""
: "\n\nThis server does not have premium, so this feature is disabled")
)
@@ -158,15 +137,8 @@
new MessageActionRow().addComponents([
new MessageButton()
.setCustomId("clear")
- .setLabel(
- clicks ? "Click again to confirm" : "Reset channel"
- )
- .setEmoji(
- getEmojiByName(
- clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS",
- "id"
- )
- )
+ .setLabel(clicks ? "Click again to confirm" : "Reset channel")
+ .setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
.setStyle("DANGER")
.setDisabled(!channel)
])
@@ -183,9 +155,7 @@
clicks += 1;
if (clicks === 2) {
clicks = 0;
- await client.database.guilds.write(interaction.guild.id, null, [
- "logging.announcements.channel"
- ]);
+ await client.database.guilds.write(interaction.guild.id, null, ["logging.announcements.channel"]);
channel = undefined;
}
} else {
@@ -218,10 +188,7 @@
});
};
-const check = (
- interaction: CommandInteraction,
- _defaultCheck: WrappedCheck
-) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("MANAGE_GUILD"))
throw "You must have the *Manage Server* permission to use this command";
diff --git a/src/commands/settings/logs/channel.ts b/src/commands/settings/logs/channel.ts
index fd64424..21437b2 100644
--- a/src/commands/settings/logs/channel.ts
+++ b/src/commands/settings/logs/channel.ts
@@ -1,10 +1,6 @@
import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js";
import { ChannelType } from "discord-api-types/v9";
-import Discord, {
- CommandInteraction,
- MessageActionRow,
- MessageButton
-} from "discord.js";
+import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../../utils/confirmationMessage.js";
import getEmojiByName from "../../../utils/getEmojiByName.js";
@@ -23,9 +19,7 @@
.addChannelTypes([ChannelType.GuildNews, ChannelType.GuildText])
);
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const m = (await interaction.reply({
embeds: LoadingEmbed,
ephemeral: true,
@@ -41,9 +35,7 @@
new EmojiEmbed()
.setEmoji("CHANNEL.TEXT.DELETE")
.setTitle("Log Channel")
- .setDescription(
- "The channel you provided is not a valid channel"
- )
+ .setDescription("The channel you provided is not a valid channel")
.setStatus("Danger")
]
});
@@ -54,9 +46,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Log Channel")
- .setDescription(
- "You must choose a channel in this server"
- )
+ .setDescription("You must choose a channel in this server")
.setStatus("Danger")
.setEmoji("CHANNEL.TEXT.DELETE")
]
@@ -65,9 +55,7 @@
const confirmation = await new confirmationMessage(interaction)
.setEmoji("CHANNEL.TEXT.EDIT")
.setTitle("Log Channel")
- .setDescription(
- `Are you sure you want to set the log channel to <#${channel.id}>?`
- )
+ .setDescription(`Are you sure you want to set the log channel to <#${channel.id}>?`)
.setColor("Warning")
.setInverted(true)
.send(true);
@@ -77,8 +65,7 @@
await client.database.guilds.write(interaction.guild.id, {
"logging.logs.channel": channel.id
});
- const { log, NucleusColors, entry, renderUser, renderChannel } =
- client.logger;
+ const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
const data = {
meta: {
type: "logChannelUpdate",
@@ -89,14 +76,8 @@
timestamp: new Date().getTime()
},
list: {
- memberId: entry(
- interaction.user.id,
- `\`${interaction.user.id}\``
- ),
- changedBy: entry(
- interaction.user.id,
- renderUser(interaction.user)
- ),
+ memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
+ changedBy: entry(interaction.user.id, renderUser(interaction.user)),
channel: entry(channel.id, renderChannel(channel))
},
hidden: {
@@ -110,9 +91,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Log Channel")
- .setDescription(
- "Something went wrong and the log channel could not be set"
- )
+ .setDescription("Something went wrong and the log channel could not be set")
.setStatus("Danger")
.setEmoji("CHANNEL.TEXT.DELETE")
],
@@ -152,15 +131,8 @@
new MessageActionRow().addComponents([
new MessageButton()
.setCustomId("clear")
- .setLabel(
- clicks ? "Click again to confirm" : "Reset channel"
- )
- .setEmoji(
- getEmojiByName(
- clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS",
- "id"
- )
- )
+ .setLabel(clicks ? "Click again to confirm" : "Reset channel")
+ .setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
.setStyle("DANGER")
.setDisabled(!channel)
])
@@ -177,9 +149,7 @@
clicks += 1;
if (clicks === 2) {
clicks = 0;
- await client.database.guilds.write(interaction.guild.id, null, [
- "logging.logs.channel"
- ]);
+ await client.database.guilds.write(interaction.guild.id, null, ["logging.logs.channel"]);
channel = undefined;
}
} else {
@@ -212,10 +182,7 @@
});
};
-const check = (
- interaction: CommandInteraction,
- _defaultCheck: WrappedCheck
-) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("MANAGE_GUILD"))
throw "You must have the *Manage Server* permission to use this command";
diff --git a/src/commands/settings/logs/events.ts b/src/commands/settings/logs/events.ts
index a1edcaf..a2dcc63 100644
--- a/src/commands/settings/logs/events.ts
+++ b/src/commands/settings/logs/events.ts
@@ -1,10 +1,5 @@
import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js";
-import Discord, {
- CommandInteraction,
- MessageActionRow,
- MessageButton,
- MessageSelectMenu
-} from "discord.js";
+import Discord, { CommandInteraction, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
@@ -35,9 +30,7 @@
};
const command = (builder: SlashCommandSubcommandBuilder) =>
- builder
- .setName("events")
- .setDescription("Sets what events should be logged");
+ builder.setName("events").setDescription("Sets what events should be logged");
const callback = async (interaction: CommandInteraction): Promise<void> => {
await interaction.reply({
@@ -75,14 +68,8 @@
)
]),
new MessageActionRow().addComponents([
- new MessageButton()
- .setLabel("Select all")
- .setStyle("PRIMARY")
- .setCustomId("all"),
- new MessageButton()
- .setLabel("Select none")
- .setStyle("DANGER")
- .setCustomId("none")
+ new MessageButton().setLabel("Select all").setStyle("PRIMARY").setCustomId("all"),
+ new MessageButton().setLabel("Select none").setStyle("DANGER").setCustomId("none")
])
]
});
@@ -95,9 +82,7 @@
i.deferUpdate();
if (i.customId === "logs") {
const selected = i.values;
- const newLogs = toHexInteger(
- selected.map((e) => Object.keys(logs)[parseInt(e)])
- );
+ const newLogs = toHexInteger(selected.map((e) => Object.keys(logs)[parseInt(e)]));
await client.database.guilds.write(interaction.guild.id, {
"logging.logs.toLog": newLogs
});
@@ -129,10 +114,7 @@
return;
};
-const check = (
- interaction: CommandInteraction,
- _defaultCheck: WrappedCheck
-) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("MANAGE_GUILD"))
throw "You must have the *Manage Server* permission to use this command";
diff --git a/src/commands/settings/logs/staff.ts b/src/commands/settings/logs/staff.ts
index a0df97c..8450bbb 100644
--- a/src/commands/settings/logs/staff.ts
+++ b/src/commands/settings/logs/staff.ts
@@ -1,10 +1,6 @@
import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js";
import { ChannelType } from "discord-api-types/v9";
-import Discord, {
- CommandInteraction,
- MessageActionRow,
- MessageButton
-} from "discord.js";
+import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../../utils/confirmationMessage.js";
import getEmojiByName from "../../../utils/getEmojiByName.js";
@@ -20,16 +16,12 @@
.addChannelOption((option) =>
option
.setName("channel")
- .setDescription(
- "The channel to set the staff notifications channel to"
- )
+ .setDescription("The channel to set the staff notifications channel to")
.addChannelTypes([ChannelType.GuildNews, ChannelType.GuildText])
.setRequired(false)
);
-const callback = async (
- interaction: CommandInteraction
-): Promise<unknown | void> => {
+const callback = async (interaction: CommandInteraction): Promise<unknown | void> => {
if (!interaction.guild) return;
const m = (await interaction.reply({
embeds: LoadingEmbed,
@@ -46,9 +38,7 @@
new EmojiEmbed()
.setEmoji("CHANNEL.TEXT.DELETE")
.setTitle("Staff Notifications Channel")
- .setDescription(
- "The channel you provided is not a valid channel"
- )
+ .setDescription("The channel you provided is not a valid channel")
.setStatus("Danger")
]
});
@@ -59,9 +49,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Staff Notifications Channel")
- .setDescription(
- "You must choose a channel in this server"
- )
+ .setDescription("You must choose a channel in this server")
.setStatus("Danger")
.setEmoji("CHANNEL.TEXT.DELETE")
]
@@ -83,8 +71,7 @@
await client.database.guilds.write(interaction.guild.id, {
"logging.staff.channel": channel.id
});
- const { log, NucleusColors, entry, renderUser, renderChannel } =
- client.logger;
+ const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
const data = {
meta: {
type: "staffChannelUpdate",
@@ -95,14 +82,8 @@
timestamp: new Date().getTime()
},
list: {
- memberId: entry(
- interaction.user.id,
- `\`${interaction.user.id}\``
- ),
- changedBy: entry(
- interaction.user.id,
- renderUser(interaction.user)
- ),
+ memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
+ changedBy: entry(interaction.user.id, renderUser(interaction.user)),
channel: entry(channel.id, renderChannel(channel))
},
hidden: {
@@ -115,9 +96,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Staff Notifications Channel")
- .setDescription(
- "Something went wrong and the staff notifications channel could not be set"
- )
+ .setDescription("Something went wrong and the staff notifications channel could not be set")
.setStatus("Danger")
.setEmoji("CHANNEL.TEXT.DELETE")
],
@@ -157,15 +136,8 @@
new MessageActionRow().addComponents([
new MessageButton()
.setCustomId("clear")
- .setLabel(
- clicks ? "Click again to confirm" : "Reset channel"
- )
- .setEmoji(
- getEmojiByName(
- clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS",
- "id"
- )
- )
+ .setLabel(clicks ? "Click again to confirm" : "Reset channel")
+ .setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
.setStyle("DANGER")
.setDisabled(!channel)
])
@@ -182,9 +154,7 @@
clicks += 1;
if (clicks === 2) {
clicks = 0;
- await client.database.guilds.write(interaction.guild.id, null, [
- "logging.staff.channel"
- ]);
+ await client.database.guilds.write(interaction.guild.id, null, ["logging.staff.channel"]);
channel = undefined;
}
} else {
@@ -217,10 +187,7 @@
});
};
-const check = (
- interaction: CommandInteraction,
- _defaultCheck: WrappedCheck
-) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("MANAGE_GUILD"))
throw "You must have the *Manage Server* permission to use this command";
diff --git a/src/commands/settings/rolemenu.ts b/src/commands/settings/rolemenu.ts
index beb2f35..93fe70d 100644
--- a/src/commands/settings/rolemenu.ts
+++ b/src/commands/settings/rolemenu.ts
@@ -6,21 +6,14 @@
builder
.setName("rolemenu")
.setDescription("rolemenu") // TODO
- .addRoleOption((option) =>
- option
- .setName("role")
- .setDescription("The role to give after verifying")
- ); // FIXME FOR FUCK SAKE
+ .addRoleOption((option) => option.setName("role").setDescription("The role to give after verifying")); // FIXME FOR FUCK SAKE
const callback = async (interaction: CommandInteraction): Promise<void> => {
console.log("we changed the charger again because fuck you");
await interaction.reply("You're mum");
};
-const check = (
- interaction: CommandInteraction,
- _defaultCheck: WrappedCheck
-) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("MANAGE_ROLES"))
throw "You must have the *Manage Roles* permission to use this command";
diff --git a/src/commands/settings/stats.ts b/src/commands/settings/stats.ts
index 507e506..08bf6f8 100644
--- a/src/commands/settings/stats.ts
+++ b/src/commands/settings/stats.ts
@@ -1,10 +1,5 @@
import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, {
- CommandInteraction,
- Message,
- MessageActionRow,
- MessageSelectMenu
-} from "discord.js";
+import Discord, { CommandInteraction, Message, MessageActionRow, MessageSelectMenu } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
@@ -17,24 +12,16 @@
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
.setName("stats")
- .setDescription(
- "Controls channels which update when someone joins or leaves the server"
- )
- .addChannelOption((option) =>
- option.setName("channel").setDescription("The channel to modify")
- )
+ .setDescription("Controls channels which update when someone joins or leaves the server")
+ .addChannelOption((option) => option.setName("channel").setDescription("The channel to modify"))
.addStringOption((option) =>
option
.setName("name")
- .setDescription(
- "The new channel name | Enter any text or use the extra variables like {memberCount}"
- )
+ .setDescription("The new channel name | Enter any text or use the extra variables like {memberCount}")
.setAutocomplete(true)
);
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
singleNotify("statsChannelDeleted", interaction.guild.id, true);
const m = (await interaction.reply({
embeds: LoadingEmbed,
@@ -50,9 +37,7 @@
new EmojiEmbed()
.setEmoji("CHANNEL.TEXT.DELETE")
.setTitle("Stats Channel")
- .setDescription(
- "You can only have 25 stats channels in a server"
- )
+ .setDescription("You can only have 25 stats channels in a server")
.setStatus("Danger")
]
});
@@ -65,9 +50,7 @@
new EmojiEmbed()
.setEmoji("CHANNEL.TEXT.DELETE")
.setTitle("Stats Channel")
- .setDescription(
- "The channel you provided is not a valid channel"
- )
+ .setDescription("The channel you provided is not a valid channel")
.setStatus("Danger")
]
});
@@ -78,9 +61,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Stats Channel")
- .setDescription(
- "You must choose a channel in this server"
- )
+ .setDescription("You must choose a channel in this server")
.setStatus("Danger")
.setEmoji("CHANNEL.TEXT.DELETE")
]
@@ -100,9 +81,7 @@
.setEmoji("CHANNEL.TEXT.EDIT")
.setTitle("Stats Channel")
.setDescription(
- `Are you sure you want to set <#${
- channel.id
- }> to a stats channel?\n\n*Preview: ${newName.replace(
+ `Are you sure you want to set <#${channel.id}> to a stats channel?\n\n*Preview: ${newName.replace(
/^ +| $/g,
""
)}*`
@@ -118,8 +97,7 @@
await client.database.guilds.write(interaction.guild.id, {
[`stats.${channel.id}`]: { name: name, enabled: true }
});
- const { log, NucleusColors, entry, renderUser, renderChannel } =
- client.logger;
+ const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
const data = {
meta: {
type: "statsChannelUpdate",
@@ -130,14 +108,8 @@
timestamp: new Date().getTime()
},
list: {
- memberId: entry(
- interaction.user.id,
- `\`${interaction.user.id}\``
- ),
- changedBy: entry(
- interaction.user.id,
- renderUser(interaction.user)
- ),
+ memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
+ changedBy: entry(interaction.user.id, renderUser(interaction.user)),
channel: entry(channel.id, renderChannel(channel)),
name: entry(
interaction.options.getString("name"),
@@ -155,9 +127,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Stats Channel")
- .setDescription(
- "Something went wrong and the stats channel could not be set"
- )
+ .setDescription("Something went wrong and the stats channel could not be set")
.setStatus("Danger")
.setEmoji("CHANNEL.TEXT.DELETE")
],
@@ -200,14 +170,10 @@
Object.keys(stats).length
? [
selectMenu
- .setPlaceholder(
- "Select a stats channel to remove, stopping it updating"
- )
+ .setPlaceholder("Select a stats channel to remove, stopping it updating")
.addOptions(
Object.keys(stats).map((key) => ({
- label: interaction.guild.channels.cache.get(
- key
- ).name,
+ label: interaction.guild.channels.cache.get(key).name,
value: key,
description: `${stats[key].name}`
}))
@@ -215,9 +181,7 @@
]
: [
selectMenu
- .setPlaceholder(
- "The server has no stats channels"
- )
+ .setPlaceholder("The server has no stats channels")
.setDisabled(true)
.setOptions([
{
@@ -252,10 +216,7 @@
});
};
-const check = (
- interaction: CommandInteraction,
- _defaultCheck: WrappedCheck
-) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("MANAGE_CHANNELS"))
throw "You must have the *Manage Channels* permission to use this command";
diff --git a/src/commands/settings/tickets.ts b/src/commands/settings/tickets.ts
index 206e157..3c6515d 100644
--- a/src/commands/settings/tickets.ts
+++ b/src/commands/settings/tickets.ts
@@ -15,17 +15,10 @@
SelectMenuInteraction,
TextInputComponent
} from "discord.js";
-import {
- SelectMenuOption,
- SlashCommandSubcommandBuilder
-} from "@discordjs/builders";
+import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { ChannelType } from "discord-api-types/v9";
import client from "../../utils/client.js";
-import {
- toHexInteger,
- toHexArray,
- tickets as ticketTypes
-} from "../../utils/calculate.js";
+import { toHexInteger, toHexArray, tickets as ticketTypes } from "../../utils/calculate.js";
import { capitalize } from "../../utils/generateKeyValueList.js";
import { modalInteractionCollector } from "../../utils/dualCollector.js";
import { GuildConfig } from "../../utils/database.js";
@@ -33,9 +26,7 @@
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
.setName("tickets")
- .setDescription(
- "Shows settings for tickets | Use no arguments to manage custom types"
- )
+ .setDescription("Shows settings for tickets | Use no arguments to manage custom types")
.addStringOption((option) =>
option
.setName("enabled")
@@ -56,9 +47,7 @@
.addNumberOption((option) =>
option
.setName("maxticketsperuser")
- .setDescription(
- "The maximum amount of tickets a user can create | Default: 5"
- )
+ .setDescription("The maximum amount of tickets a user can create | Default: 5")
.setRequired(false)
.setMinValue(1)
)
@@ -71,9 +60,7 @@
.setRequired(false)
);
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
let m = (await interaction.reply({
embeds: LoadingEmbed,
ephemeral: true,
@@ -85,28 +72,19 @@
maxtickets: interaction.options.getNumber("maxticketsperuser"),
supportping: interaction.options.getRole("supportrole")
};
- if (
- options.enabled !== null ||
- options.category ||
- options.maxtickets ||
- options.supportping
- ) {
+ if (options.enabled !== null || options.category || options.maxtickets || options.supportping) {
options.enabled = options.enabled === "yes" ? true : false;
if (options.category) {
let channel: GuildChannel;
try {
- channel = await interaction.guild.channels.fetch(
- options.category.id
- );
+ channel = await interaction.guild.channels.fetch(options.category.id);
} catch {
return await interaction.editReply({
embeds: [
new EmojiEmbed()
.setEmoji("CHANNEL.TEXT.DELETE")
.setTitle("Tickets > Category")
- .setDescription(
- "The channel you provided is not a valid category"
- )
+ .setDescription("The channel you provided is not a valid category")
.setStatus("Danger")
]
});
@@ -117,9 +95,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Tickets > Category")
- .setDescription(
- "You must choose a category in this server"
- )
+ .setDescription("You must choose a category in this server")
.setStatus("Danger")
.setEmoji("CHANNEL.TEXT.DELETE")
]
@@ -131,9 +107,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Tickets > Max Tickets")
- .setDescription(
- "You must choose a number greater than 0"
- )
+ .setDescription("You must choose a number greater than 0")
.setStatus("Danger")
.setEmoji("CHANNEL.TEXT.DELETE")
]
@@ -142,18 +116,14 @@
let role: Role;
if (options.supportping) {
try {
- role = await interaction.guild.roles.fetch(
- options.supportping.id
- );
+ role = await interaction.guild.roles.fetch(options.supportping.id);
} catch {
return await interaction.editReply({
embeds: [
new EmojiEmbed()
.setEmoji("GUILD.ROLE.DELETE")
.setTitle("Tickets > Support Ping")
- .setDescription(
- "The role you provided is not a valid role"
- )
+ .setDescription("The role you provided is not a valid role")
.setStatus("Danger")
]
});
@@ -164,9 +134,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Tickets > Support Ping")
- .setDescription(
- "You must choose a role in this server"
- )
+ .setDescription("You must choose a role in this server")
.setStatus("Danger")
.setEmoji("GUILD.ROLE.DELETE")
]
@@ -177,15 +145,9 @@
.setEmoji("GUILD.TICKET.ARCHIVED")
.setTitle("Tickets")
.setDescription(
- (options.category
- ? `**Category:** ${options.category.name}\n`
- : "") +
- (options.maxtickets
- ? `**Max Tickets:** ${options.maxtickets}\n`
- : "") +
- (options.supportping
- ? `**Support Ping:** ${options.supportping.name}\n`
- : "") +
+ (options.category ? `**Category:** ${options.category.name}\n` : "") +
+ (options.maxtickets ? `**Max Tickets:** ${options.maxtickets}\n` : "") +
+ (options.supportping ? `**Support Ping:** ${options.supportping.name}\n` : "") +
(options.enabled !== null
? `**Enabled:** ${
options.enabled
@@ -201,27 +163,18 @@
if (confirmation.cancelled) return;
if (confirmation.success) {
const toUpdate = {};
- if (options.enabled !== null)
- toUpdate["tickets.enabled"] = options.enabled;
- if (options.category)
- toUpdate["tickets.category"] = options.category.id;
- if (options.maxtickets)
- toUpdate["tickets.maxTickets"] = options.maxtickets;
- if (options.supportping)
- toUpdate["tickets.supportRole"] = options.supportping.id;
+ if (options.enabled !== null) toUpdate["tickets.enabled"] = options.enabled;
+ if (options.category) toUpdate["tickets.category"] = options.category.id;
+ if (options.maxtickets) toUpdate["tickets.maxTickets"] = options.maxtickets;
+ if (options.supportping) toUpdate["tickets.supportRole"] = options.supportping.id;
try {
- await client.database.guilds.write(
- interaction.guild.id,
- toUpdate
- );
+ await client.database.guilds.write(interaction.guild.id, toUpdate);
} catch (e) {
return interaction.editReply({
embeds: [
new EmojiEmbed()
.setTitle("Tickets")
- .setDescription(
- "Something went wrong and the staff notifications channel could not be set"
- )
+ .setDescription("Something went wrong and the staff notifications channel could not be set")
.setStatus("Danger")
.setEmoji("GUILD.TICKET.DELETE")
],
@@ -243,8 +196,7 @@
}
let data = await client.database.guilds.read(interaction.guild.id);
data.tickets.customTypes = (data.tickets.customTypes || []).filter(
- (value: string, index: number, array: string[]) =>
- array.indexOf(value) === index
+ (value: string, index: number, array: string[]) => array.indexOf(value) === index
);
let lastClicked = "";
let embed: EmojiEmbed;
@@ -261,34 +213,18 @@
embed = new EmojiEmbed()
.setTitle("Tickets")
.setDescription(
- `${
- data.enabled ? "" : getEmojiByName("TICKETS.REPORT")
- } **Enabled:** ${
- data.enabled
- ? `${getEmojiByName("CONTROL.TICK")} Yes`
- : `${getEmojiByName("CONTROL.CROSS")} No`
+ `${data.enabled ? "" : getEmojiByName("TICKETS.REPORT")} **Enabled:** ${
+ data.enabled ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
}\n` +
- `${
- data.category ? "" : getEmojiByName("TICKETS.REPORT")
- } **Category:** ${
+ `${data.category ? "" : getEmojiByName("TICKETS.REPORT")} **Category:** ${
data.category ? `<#${data.category}>` : "*None set*"
}\n` +
- `**Max Tickets:** ${
- data.maxTickets ? data.maxTickets : "*No limit*"
- }\n` +
- `**Support Ping:** ${
- data.supportRole
- ? `<@&${data.supportRole}>`
- : "*None set*"
- }\n\n` +
- (data.useCustom && data.customTypes === null
- ? `${getEmojiByName("TICKETS.REPORT")} `
- : "") +
+ `**Max Tickets:** ${data.maxTickets ? data.maxTickets : "*No limit*"}\n` +
+ `**Support Ping:** ${data.supportRole ? `<@&${data.supportRole}>` : "*None set*"}\n\n` +
+ (data.useCustom && data.customTypes === null ? `${getEmojiByName("TICKETS.REPORT")} ` : "") +
`${data.useCustom ? "Custom" : "Default"} types in use` +
"\n\n" +
- `${getEmojiByName(
- "TICKETS.REPORT"
- )} *Indicates a setting stopping tickets from being used*`
+ `${getEmojiByName("TICKETS.REPORT")} *Indicates a setting stopping tickets from being used*`
)
.setStatus("Success")
.setEmoji("GUILD.TICKET.OPEN");
@@ -297,43 +233,24 @@
components: [
new MessageActionRow().addComponents([
new MessageButton()
- .setLabel(
- "Tickets " + (data.enabled ? "enabled" : "disabled")
- )
- .setEmoji(
- getEmojiByName(
- "CONTROL." + (data.enabled ? "TICK" : "CROSS"),
- "id"
- )
- )
+ .setLabel("Tickets " + (data.enabled ? "enabled" : "disabled"))
+ .setEmoji(getEmojiByName("CONTROL." + (data.enabled ? "TICK" : "CROSS"), "id"))
.setStyle(data.enabled ? "SUCCESS" : "DANGER")
.setCustomId("enabled"),
new MessageButton()
- .setLabel(
- lastClicked === "cat"
- ? "Click again to confirm"
- : "Clear category"
- )
+ .setLabel(lastClicked === "cat" ? "Click again to confirm" : "Clear category")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
.setStyle("DANGER")
.setCustomId("clearCategory")
.setDisabled(data.category === null),
new MessageButton()
- .setLabel(
- lastClicked === "max"
- ? "Click again to confirm"
- : "Reset max tickets"
- )
+ .setLabel(lastClicked === "max" ? "Click again to confirm" : "Reset max tickets")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
.setStyle("DANGER")
.setCustomId("clearMaxTickets")
.setDisabled(data.maxTickets === 5),
new MessageButton()
- .setLabel(
- lastClicked === "sup"
- ? "Click again to confirm"
- : "Clear support ping"
- )
+ .setLabel(lastClicked === "sup" ? "Click again to confirm" : "Clear support ping")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
.setStyle("DANGER")
.setCustomId("clearSupportPing")
@@ -360,42 +277,25 @@
break;
}
i.deferUpdate();
- if (
- (i.component as MessageActionRowComponent).customId ===
- "clearCategory"
- ) {
+ if ((i.component as MessageActionRowComponent).customId === "clearCategory") {
if (lastClicked === "cat") {
lastClicked = "";
- await client.database.guilds.write(interaction.guild.id, null, [
- "tickets.category"
- ]);
+ await client.database.guilds.write(interaction.guild.id, null, ["tickets.category"]);
data.category = undefined;
} else lastClicked = "cat";
- } else if (
- (i.component as MessageActionRowComponent).customId ===
- "clearMaxTickets"
- ) {
+ } else if ((i.component as MessageActionRowComponent).customId === "clearMaxTickets") {
if (lastClicked === "max") {
lastClicked = "";
- await client.database.guilds.write(interaction.guild.id, null, [
- "tickets.maxTickets"
- ]);
+ await client.database.guilds.write(interaction.guild.id, null, ["tickets.maxTickets"]);
data.maxTickets = 5;
} else lastClicked = "max";
- } else if (
- (i.component as MessageActionRowComponent).customId ===
- "clearSupportPing"
- ) {
+ } else if ((i.component as MessageActionRowComponent).customId === "clearSupportPing") {
if (lastClicked === "sup") {
lastClicked = "";
- await client.database.guilds.write(interaction.guild.id, null, [
- "tickets.supportRole"
- ]);
+ await client.database.guilds.write(interaction.guild.id, null, ["tickets.supportRole"]);
data.supportRole = undefined;
} else lastClicked = "sup";
- } else if (
- (i.component as MessageActionRowComponent).customId === "send"
- ) {
+ } else if ((i.component as MessageActionRowComponent).customId === "send") {
const ticketMessages = [
{
label: "Create ticket",
@@ -403,13 +303,11 @@
},
{
label: "Issues, questions or feedback?",
- description:
- "Click below to open a ticket and get help from our staff team"
+ description: "Click below to open a ticket and get help from our staff team"
},
{
label: "Contact Us",
- description:
- "Click the button below to speak to us privately"
+ description: "Click the button below to speak to us privately"
}
];
while (true) {
@@ -418,9 +316,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Ticket Button")
- .setDescription(
- "Select a message template to send in this channel"
- )
+ .setDescription("Select a message template to send in this channel")
.setFooter({
text: enabled
? ""
@@ -462,10 +358,7 @@
.setLabel("Back")
.setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
.setStyle("DANGER"),
- new MessageButton()
- .setCustomId("blank")
- .setLabel("Empty")
- .setStyle("SECONDARY"),
+ new MessageButton().setCustomId("blank").setLabel("Empty").setStyle("SECONDARY"),
new MessageButton()
.setCustomId("custom")
.setLabel("Custom")
@@ -480,29 +373,14 @@
} catch (e) {
break;
}
- if (
- (i.component as MessageActionRowComponent).customId ===
- "template"
- ) {
+ if ((i.component as MessageActionRowComponent).customId === "template") {
i.deferUpdate();
await interaction.channel.send({
embeds: [
new EmojiEmbed()
- .setTitle(
- ticketMessages[
- parseInt(
- (i as SelectMenuInteraction)
- .values[0]
- )
- ].label
- )
+ .setTitle(ticketMessages[parseInt((i as SelectMenuInteraction).values[0])].label)
.setDescription(
- ticketMessages[
- parseInt(
- (i as SelectMenuInteraction)
- .values[0]
- )
- ].description
+ ticketMessages[parseInt((i as SelectMenuInteraction).values[0])].description
)
.setStatus("Success")
.setEmoji("GUILD.TICKET.OPEN")
@@ -511,41 +389,28 @@
new MessageActionRow().addComponents([
new MessageButton()
.setLabel("Create Ticket")
- .setEmoji(
- getEmojiByName("CONTROL.TICK", "id")
- )
+ .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
.setStyle("SUCCESS")
.setCustomId("createticket")
])
]
});
break;
- } else if (
- (i.component as MessageActionRowComponent).customId ===
- "blank"
- ) {
+ } else if ((i.component as MessageActionRowComponent).customId === "blank") {
i.deferUpdate();
await interaction.channel.send({
components: [
new MessageActionRow().addComponents([
new MessageButton()
.setLabel("Create Ticket")
- .setEmoji(
- getEmojiByName(
- "TICKETS.SUGGESTION",
- "id"
- )
- )
+ .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
.setStyle("SUCCESS")
.setCustomId("createticket")
])
]
});
break;
- } else if (
- (i.component as MessageActionRowComponent).customId ===
- "custom"
- ) {
+ } else if ((i.component as MessageActionRowComponent).customId === "custom") {
await i.showModal(
new Discord.Modal()
.setCustomId("modal")
@@ -573,9 +438,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Ticket Button")
- .setDescription(
- "Modal opened. If you can't see it, click back and try again."
- )
+ .setDescription("Modal opened. If you can't see it, click back and try again.")
.setStatus("Success")
.setEmoji("GUILD.TICKET.OPEN")
],
@@ -583,9 +446,7 @@
new MessageActionRow().addComponents([
new MessageButton()
.setLabel("Back")
- .setEmoji(
- getEmojiByName("CONTROL.LEFT", "id")
- )
+ .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
.setStyle("PRIMARY")
.setCustomId("back")
])
@@ -603,8 +464,7 @@
}
if (out.fields) {
const title = out.fields.getTextInputValue("title");
- const description =
- out.fields.getTextInputValue("description");
+ const description = out.fields.getTextInputValue("description");
await interaction.channel.send({
embeds: [
new EmojiEmbed()
@@ -617,12 +477,7 @@
new MessageActionRow().addComponents([
new MessageButton()
.setLabel("Create Ticket")
- .setEmoji(
- getEmojiByName(
- "TICKETS.SUGGESTION",
- "id"
- )
- )
+ .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
.setStyle("SUCCESS")
.setCustomId("createticket")
])
@@ -634,17 +489,12 @@
}
}
}
- } else if (
- (i.component as MessageActionRowComponent).customId === "enabled"
- ) {
+ } else if ((i.component as MessageActionRowComponent).customId === "enabled") {
await client.database.guilds.write(interaction.guild.id, {
"tickets.enabled": !data.enabled
});
data.enabled = !data.enabled;
- } else if (
- (i.component as MessageActionRowComponent).customId ===
- "manageTypes"
- ) {
+ } else if ((i.component as MessageActionRowComponent).customId === "manageTypes") {
data = await manageTypes(interaction, data, m as Message);
} else {
break;
@@ -656,11 +506,7 @@
});
};
-async function manageTypes(
- interaction: CommandInteraction,
- data: GuildConfig["tickets"],
- m: Message
-) {
+async function manageTypes(interaction: CommandInteraction, data: GuildConfig["tickets"], m: Message) {
while (true) {
if (data.useCustom) {
const customTypes = data.customTypes;
@@ -671,11 +517,7 @@
.setDescription(
"**Custom types enabled**\n\n" +
"**Types in use:**\n" +
- (customTypes !== null
- ? customTypes
- .map((t) => `> ${t}`)
- .join("\n")
- : "*None set*") +
+ (customTypes !== null ? customTypes.map((t) => `> ${t}`).join("\n") : "*None set*") +
"\n\n" +
(customTypes === null
? `${getEmojiByName(
@@ -712,14 +554,10 @@
.setCustomId("back"),
new MessageButton()
.setLabel("Add new type")
- .setEmoji(
- getEmojiByName("TICKETS.SUGGESTION", "id")
- )
+ .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
.setStyle("PRIMARY")
.setCustomId("addType")
- .setDisabled(
- customTypes !== null && customTypes.length >= 25
- ),
+ .setDisabled(customTypes !== null && customTypes.length >= 25),
new MessageButton()
.setLabel("Switch to default types")
.setStyle("SECONDARY")
@@ -735,12 +573,7 @@
new SelectMenuOption({
label: capitalize(type),
value: type,
- emoji: client.emojis.cache.get(
- getEmojiByName(
- `TICKETS.${type.toUpperCase()}`,
- "id"
- )
- ),
+ emoji: client.emojis.cache.get(getEmojiByName(`TICKETS.${type.toUpperCase()}`, "id")),
default: inUse.includes(type)
})
);
@@ -761,12 +594,7 @@
"**Default types enabled**\n\n" +
"**Types in use:**\n" +
inUse
- .map(
- (t) =>
- `> ${getEmojiByName(
- "TICKETS." + t.toUpperCase()
- )} ${capitalize(t)}`
- )
+ .map((t) => `> ${getEmojiByName("TICKETS." + t.toUpperCase())} ${capitalize(t)}`)
.join("\n")
)
.setStatus("Success")
@@ -835,9 +663,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Tickets > Types")
- .setDescription(
- "Modal opened. If you can't see it, click back and try again."
- )
+ .setDescription("Modal opened. If you can't see it, click back and try again.")
.setStatus("Success")
.setEmoji("GUILD.TICKET.OPEN")
],
@@ -868,11 +694,7 @@
}
toAdd = toAdd.substring(0, 80);
try {
- await client.database.guilds.append(
- interaction.guild.id,
- "tickets.customTypes",
- toAdd
- );
+ await client.database.guilds.append(interaction.guild.id, "tickets.customTypes", toAdd);
} catch {
continue;
}
@@ -885,19 +707,11 @@
}
} else if (i.component.customId === "switchToDefault") {
i.deferUpdate();
- await client.database.guilds.write(
- interaction.guild.id,
- { "tickets.useCustom": false },
- []
- );
+ await client.database.guilds.write(interaction.guild.id, { "tickets.useCustom": false }, []);
data.useCustom = false;
} else if (i.component.customId === "switchToCustom") {
i.deferUpdate();
- await client.database.guilds.write(
- interaction.guild.id,
- { "tickets.useCustom": true },
- []
- );
+ await client.database.guilds.write(interaction.guild.id, { "tickets.useCustom": true }, []);
data.useCustom = true;
} else {
i.deferUpdate();
diff --git a/src/commands/settings/verify.ts b/src/commands/settings/verify.ts
index e0af802..614ecb9 100644
--- a/src/commands/settings/verify.ts
+++ b/src/commands/settings/verify.ts
@@ -24,15 +24,10 @@
.setName("verify")
.setDescription("Manage the role given after typing /verify")
.addRoleOption((option) =>
- option
- .setName("role")
- .setDescription("The role to give after verifying")
- .setRequired(false)
+ option.setName("role").setDescription("The role to give after verifying").setRequired(false)
);
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const m = (await interaction.reply({
embeds: LoadingEmbed,
ephemeral: true,
@@ -48,9 +43,7 @@
new EmojiEmbed()
.setEmoji("GUILD.ROLES.DELETE")
.setTitle("Verify Role")
- .setDescription(
- "The role you provided is not a valid role"
- )
+ .setDescription("The role you provided is not a valid role")
.setStatus("Danger")
]
});
@@ -70,9 +63,7 @@
const confirmation = await new confirmationMessage(interaction)
.setEmoji("GUILD.ROLES.EDIT")
.setTitle("Verify Role")
- .setDescription(
- `Are you sure you want to set the verify role to <@&${role.id}>?`
- )
+ .setDescription(`Are you sure you want to set the verify role to <@&${role.id}>?`)
.setColor("Warning")
.setInverted(true)
.send(true);
@@ -83,8 +74,7 @@
"verify.role": role.id,
"verify.enabled": true
});
- const { log, NucleusColors, entry, renderUser, renderRole } =
- client.logger;
+ const { log, NucleusColors, entry, renderUser, renderRole } = client.logger;
const data = {
meta: {
type: "verifyRoleChanged",
@@ -95,14 +85,8 @@
timestamp: new Date().getTime()
},
list: {
- memberId: entry(
- interaction.user.id,
- `\`${interaction.user.id}\``
- ),
- changedBy: entry(
- interaction.user.id,
- renderUser(interaction.user)
- ),
+ memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
+ changedBy: entry(interaction.user.id, renderUser(interaction.user)),
role: entry(role.id, renderRole(role))
},
hidden: {
@@ -116,9 +100,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Verify Role")
- .setDescription(
- "Something went wrong while setting the verify role"
- )
+ .setDescription("Something went wrong while setting the verify role")
.setStatus("Danger")
.setEmoji("GUILD.ROLES.DELETE")
],
@@ -147,9 +129,7 @@
new EmojiEmbed()
.setTitle("Verify Role")
.setDescription(
- role
- ? `Your verify role is currently set to <@&${role}>`
- : "You have not set a verify role"
+ role ? `Your verify role is currently set to <@&${role}>` : "You have not set a verify role"
)
.setStatus("Success")
.setEmoji("GUILD.ROLES.CREATE")
@@ -158,15 +138,8 @@
new MessageActionRow().addComponents([
new MessageButton()
.setCustomId("clear")
- .setLabel(
- clicks ? "Click again to confirm" : "Reset role"
- )
- .setEmoji(
- getEmojiByName(
- clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS",
- "id"
- )
- )
+ .setLabel(clicks ? "Click again to confirm" : "Reset role")
+ .setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
.setStyle("DANGER")
.setDisabled(!role),
new MessageButton()
@@ -188,15 +161,10 @@
clicks += 1;
if (clicks === 2) {
clicks = 0;
- await client.database.guilds.write(interaction.guild.id, null, [
- "verify.role",
- "verify.enabled"
- ]);
+ await client.database.guilds.write(interaction.guild.id, null, ["verify.role", "verify.enabled"]);
role = undefined;
}
- } else if (
- (i.component as MessageActionRowComponent).customId === "send"
- ) {
+ } else if ((i.component as MessageActionRowComponent).customId === "send") {
const verifyMessages = [
{
label: "Verify",
@@ -204,8 +172,7 @@
},
{
label: "Get verified",
- description:
- "To get access to the rest of the server, click the button below"
+ description: "To get access to the rest of the server, click the button below"
},
{
label: "Ready to verify?",
@@ -217,13 +184,9 @@
embeds: [
new EmojiEmbed()
.setTitle("Verify Button")
- .setDescription(
- "Select a message template to send in this channel"
- )
+ .setDescription("Select a message template to send in this channel")
.setFooter({
- text: role
- ? ""
- : "You do no have a verify role set so the button will not work."
+ text: role ? "" : "You do no have a verify role set so the button will not work."
})
.setStatus(role ? "Success" : "Warning")
.setEmoji("GUILD.ROLES.CREATE")
@@ -261,10 +224,7 @@
.setLabel("Back")
.setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
.setStyle("DANGER"),
- new MessageButton()
- .setCustomId("blank")
- .setLabel("Empty")
- .setStyle("SECONDARY"),
+ new MessageButton().setCustomId("blank").setLabel("Empty").setStyle("SECONDARY"),
new MessageButton()
.setCustomId("custom")
.setLabel("Custom")
@@ -279,29 +239,14 @@
} catch (e) {
break;
}
- if (
- (i.component as MessageActionRowComponent).customId ===
- "template"
- ) {
+ if ((i.component as MessageActionRowComponent).customId === "template") {
i.deferUpdate();
await interaction.channel.send({
embeds: [
new EmojiEmbed()
- .setTitle(
- verifyMessages[
- parseInt(
- (i as SelectMenuInteraction)
- .values[0]
- )
- ].label
- )
+ .setTitle(verifyMessages[parseInt((i as SelectMenuInteraction).values[0])].label)
.setDescription(
- verifyMessages[
- parseInt(
- (i as SelectMenuInteraction)
- .values[0]
- )
- ].description
+ verifyMessages[parseInt((i as SelectMenuInteraction).values[0])].description
)
.setStatus("Success")
.setEmoji("CONTROL.BLOCKTICK")
@@ -310,38 +255,28 @@
new MessageActionRow().addComponents([
new MessageButton()
.setLabel("Verify")
- .setEmoji(
- getEmojiByName("CONTROL.TICK", "id")
- )
+ .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
.setStyle("SUCCESS")
.setCustomId("verifybutton")
])
]
});
break;
- } else if (
- (i.component as MessageActionRowComponent).customId ===
- "blank"
- ) {
+ } else if ((i.component as MessageActionRowComponent).customId === "blank") {
i.deferUpdate();
await interaction.channel.send({
components: [
new MessageActionRow().addComponents([
new MessageButton()
.setLabel("Verify")
- .setEmoji(
- getEmojiByName("CONTROL.TICK", "id")
- )
+ .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
.setStyle("SUCCESS")
.setCustomId("verifybutton")
])
]
});
break;
- } else if (
- (i.component as MessageActionRowComponent).customId ===
- "custom"
- ) {
+ } else if ((i.component as MessageActionRowComponent).customId === "custom") {
await i.showModal(
new Discord.Modal()
.setCustomId("modal")
@@ -369,9 +304,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Verify Button")
- .setDescription(
- "Modal opened. If you can't see it, click back and try again."
- )
+ .setDescription("Modal opened. If you can't see it, click back and try again.")
.setStatus("Success")
.setEmoji("GUILD.TICKET.OPEN")
],
@@ -379,9 +312,7 @@
new MessageActionRow().addComponents([
new MessageButton()
.setLabel("Back")
- .setEmoji(
- getEmojiByName("CONTROL.LEFT", "id")
- )
+ .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
.setStyle("PRIMARY")
.setCustomId("back")
])
@@ -399,8 +330,7 @@
}
if (out.fields) {
const title = out.fields.getTextInputValue("title");
- const description =
- out.fields.getTextInputValue("description");
+ const description = out.fields.getTextInputValue("description");
await interaction.channel.send({
embeds: [
new EmojiEmbed()
@@ -413,9 +343,7 @@
new MessageActionRow().addComponents([
new MessageButton()
.setLabel("Verify")
- .setEmoji(
- getEmojiByName("CONTROL.TICK", "id")
- )
+ .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
.setStyle("SUCCESS")
.setCustomId("verifybutton")
])
diff --git a/src/commands/settings/welcome.ts b/src/commands/settings/welcome.ts
index 00b1826..270634e 100644
--- a/src/commands/settings/welcome.ts
+++ b/src/commands/settings/welcome.ts
@@ -19,39 +19,28 @@
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
.setName("welcome")
- .setDescription(
- "Messages and roles sent or given when someone joins the server"
- )
+ .setDescription("Messages and roles sent or given when someone joins the server")
.addStringOption((option) =>
option
.setName("message")
- .setDescription(
- "The message to send when someone joins the server"
- )
+ .setDescription("The message to send when someone joins the server")
.setAutocomplete(true)
)
.addRoleOption((option) =>
- option
- .setName("role")
- .setDescription("The role given when someone joins the server")
+ option.setName("role").setDescription("The role given when someone joins the server")
)
.addRoleOption((option) =>
- option
- .setName("ping")
- .setDescription("The role pinged when someone joins the server")
+ option.setName("ping").setDescription("The role pinged when someone joins the server")
)
.addChannelOption((option) =>
option
.setName("channel")
- .setDescription(
- "The channel the welcome message should be sent to"
- )
+ .setDescription("The channel the welcome message should be sent to")
.addChannelTypes([ChannelType.GuildText, ChannelType.GuildNews])
);
const callback = async (interaction: CommandInteraction): Promise<unknown> => {
- const { renderRole, renderChannel, log, NucleusColors, entry, renderUser } =
- client.logger;
+ const { renderRole, renderChannel, log, NucleusColors, entry, renderUser } = client.logger;
await interaction.reply({
embeds: LoadingEmbed,
fetchReply: true,
@@ -75,9 +64,7 @@
new EmojiEmbed()
.setEmoji("GUILD.ROLES.DELETE")
.setTitle("Welcome Events")
- .setDescription(
- "The role you provided is not a valid role"
- )
+ .setDescription("The role you provided is not a valid role")
.setStatus("Danger")
]
});
@@ -91,9 +78,7 @@
new EmojiEmbed()
.setEmoji("GUILD.ROLES.DELETE")
.setTitle("Welcome Events")
- .setDescription(
- "The channel you provided is not a valid channel"
- )
+ .setDescription("The channel you provided is not a valid channel")
.setStatus("Danger")
]
});
@@ -121,24 +106,14 @@
if (ping) toChange["welcome.ping"] = ping.id;
if (channel) toChange["welcome.channel"] = channel.id;
if (message) toChange["welcome.message"] = message;
- await client.database.guilds.write(
- interaction.guild.id,
- toChange
- );
+ await client.database.guilds.write(interaction.guild.id, toChange);
const list = {
- memberId: entry(
- interaction.user.id,
- `\`${interaction.user.id}\``
- ),
- changedBy: entry(
- interaction.user.id,
- renderUser(interaction.user)
- )
+ memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
+ changedBy: entry(interaction.user.id, renderUser(interaction.user))
};
if (role) list.role = entry(role.id, renderRole(role));
if (ping) list.ping = entry(ping.id, renderRole(ping));
- if (channel)
- list.channel = entry(channel.id, renderChannel(channel.id));
+ if (channel) list.channel = entry(channel.id, renderChannel(channel.id));
if (message) list.message = entry(message, `\`${message}\``);
const data = {
meta: {
@@ -161,9 +136,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Welcome Events")
- .setDescription(
- "Something went wrong while updating welcome settings"
- )
+ .setDescription("Something went wrong while updating welcome settings")
.setStatus("Danger")
.setEmoji("GUILD.ROLES.DELETE")
],
@@ -191,38 +164,22 @@
new EmojiEmbed()
.setTitle("Welcome Events")
.setDescription(
- `**Message:** ${
- config.welcome.message
- ? `\n> ${config.welcome.message}`
- : "*None set*"
- }\n` +
+ `**Message:** ${config.welcome.message ? `\n> ${config.welcome.message}` : "*None set*"}\n` +
`**Role:** ${
config.welcome.role
- ? renderRole(
- await interaction.guild.roles.fetch(
- config.welcome.role
- )
- )
+ ? renderRole(await interaction.guild.roles.fetch(config.welcome.role))
: "*None set*"
}\n` +
`**Ping:** ${
config.welcome.ping
- ? renderRole(
- await interaction.guild.roles.fetch(
- config.welcome.ping
- )
- )
+ ? renderRole(await interaction.guild.roles.fetch(config.welcome.ping))
: "*None set*"
}\n` +
`**Channel:** ${
config.welcome.channel
? config.welcome.channel == "dm"
? "DM"
- : renderChannel(
- await interaction.guild.channels.fetch(
- config.welcome.channel
- )
- )
+ : renderChannel(await interaction.guild.channels.fetch(config.welcome.channel))
: "*None set*"
}`
)
@@ -232,41 +189,25 @@
components: [
new MessageActionRow().addComponents([
new MessageButton()
- .setLabel(
- lastClicked == "clear-message"
- ? "Click again to confirm"
- : "Clear Message"
- )
+ .setLabel(lastClicked == "clear-message" ? "Click again to confirm" : "Clear Message")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
.setCustomId("clear-message")
.setDisabled(!config.welcome.message)
.setStyle("DANGER"),
new MessageButton()
- .setLabel(
- lastClicked == "clear-role"
- ? "Click again to confirm"
- : "Clear Role"
- )
+ .setLabel(lastClicked == "clear-role" ? "Click again to confirm" : "Clear Role")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
.setCustomId("clear-role")
.setDisabled(!config.welcome.role)
.setStyle("DANGER"),
new MessageButton()
- .setLabel(
- lastClicked == "clear-ping"
- ? "Click again to confirm"
- : "Clear Ping"
- )
+ .setLabel(lastClicked == "clear-ping" ? "Click again to confirm" : "Clear Ping")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
.setCustomId("clear-ping")
.setDisabled(!config.welcome.ping)
.setStyle("DANGER"),
new MessageButton()
- .setLabel(
- lastClicked == "clear-channel"
- ? "Click again to confirm"
- : "Clear Channel"
- )
+ .setLabel(lastClicked == "clear-channel" ? "Click again to confirm" : "Clear Channel")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
.setCustomId("clear-channel")
.setDisabled(!config.welcome.channel)
@@ -338,9 +279,7 @@
const check = (interaction: CommandInteraction) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("MANAGE_GUILD"))
- throw new Error(
- "You must have the *Manage Server* permission to use this command"
- );
+ throw new Error("You must have the *Manage Server* permission to use this command");
return true;
};