Bug fixes and ~~performance~~ typing improvements
diff --git a/src/commands/help.ts b/src/commands/help.ts
index 921318e..df44aaa 100644
--- a/src/commands/help.ts
+++ b/src/commands/help.ts
@@ -2,18 +2,13 @@
import { SlashCommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
-const command = new SlashCommandBuilder()
- .setName("help")
- .setDescription("Shows help for commands");
+const command = new SlashCommandBuilder().setName("help").setDescription("Shows help for commands");
const callback = async (interaction: CommandInteraction): Promise<void> => {
interaction.reply("hel p"); // TODO: FINISH THIS FOR RELEASE
};
-const check = (
- _interaction: CommandInteraction,
- _defaultCheck: WrappedCheck
-) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
return true;
};
diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts
index 4560c8b..87bfd28 100644
--- a/src/commands/mod/ban.ts
+++ b/src/commands/mod/ban.ts
@@ -1,9 +1,4 @@
-import {
- CommandInteraction,
- GuildMember,
- MessageActionRow,
- MessageButton
-} from "discord.js";
+import { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -15,12 +10,7 @@
builder
.setName("ban")
.setDescription("Bans a user from the server")
- .addUserOption((option) =>
- option
- .setName("user")
- .setDescription("The user to ban")
- .setRequired(true)
- )
+ .addUserOption((option) => option.setName("user").setDescription("The user to ban").setRequired(true))
.addNumberOption((option) =>
option
.setName("delete")
@@ -43,21 +33,14 @@
.setDescription(
keyValueList({
user: renderUser(interaction.options.getUser("user")),
- reason: reason
- ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ")
- : "*No reason provided*"
+ reason: reason ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ") : "*No reason provided*"
}) +
`The user **will${notify ? "" : " not"}** be notified\n` +
`${addPlurals(
- interaction.options.getInteger("delete")
- ? interaction.options.getInteger("delete")
- : 0,
+ interaction.options.getInteger("delete") ? interaction.options.getInteger("delete") : 0,
"day"
)} of messages will be deleted\n\n` +
- `Are you sure you want to ban <@!${
- (interaction.options.getMember("user") as GuildMember)
- .id
- }>?`
+ `Are you sure you want to ban <@!${(interaction.options.getMember("user") as GuildMember).id}>?`
)
.setColor("Danger")
.addReasonButton(reason ?? "")
@@ -66,8 +49,7 @@
if (confirmation.cancelled) return;
if (confirmation.success) break;
if (confirmation.newReason) reason = confirmation.newReason;
- if (confirmation.components)
- notify = confirmation.components.notify.active;
+ if (confirmation.components) notify = confirmation.components.notify.active;
}
if (confirmation.success) {
let dmd = false;
@@ -75,9 +57,7 @@
const config = await client.database.guilds.read(interaction.guild.id);
try {
if (notify) {
- dm = await (
- interaction.options.getMember("user") as GuildMember
- ).send({
+ dm = await (interaction.options.getMember("user") as GuildMember).send({
embeds: [
new EmojiEmbed()
.setEmoji("PUNISH.BAN.RED")
@@ -112,15 +92,8 @@
days: Number(interaction.options.getNumber("delete") ?? 0),
reason: reason ?? "No reason provided"
});
- await client.database.history.create(
- "ban",
- interaction.guild.id,
- member.user,
- interaction.user,
- reason
- );
- const { log, NucleusColors, entry, renderUser, renderDelta } =
- client.logger;
+ await client.database.history.create("ban", interaction.guild.id, member.user, interaction.user, reason);
+ const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
const data = {
meta: {
type: "memberBan",
@@ -133,22 +106,10 @@
list: {
memberId: entry(member.user.id, `\`${member.user.id}\``),
name: entry(member.user.id, renderUser(member.user)),
- banned: entry(
- new Date().getTime(),
- renderDelta(new Date().getTime())
- ),
- bannedBy: entry(
- interaction.user.id,
- renderUser(interaction.user)
- ),
- reason: entry(
- reason,
- reason ? `\n> ${reason}` : "*No reason provided.*"
- ),
- accountCreated: entry(
- member.user.createdAt,
- renderDelta(member.user.createdAt)
- ),
+ banned: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+ bannedBy: entry(interaction.user.id, renderUser(interaction.user)),
+ reason: entry(reason, reason ? `\n> ${reason}` : "*No reason provided.*"),
+ accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
serverMemberCount: interaction.guild.memberCount
},
hidden: {
@@ -162,9 +123,7 @@
new EmojiEmbed()
.setEmoji("PUNISH.BAN.RED")
.setTitle("Ban")
- .setDescription(
- "Something went wrong and the user was not banned"
- )
+ .setDescription("Something went wrong and the user was not banned")
.setStatus("Danger")
],
components: []
@@ -178,10 +137,7 @@
new EmojiEmbed()
.setEmoji(`PUNISH.BAN.${failed ? "YELLOW" : "GREEN"}`)
.setTitle("Ban")
- .setDescription(
- "The member was banned" +
- (failed ? ", but could not be notified" : "")
- )
+ .setDescription("The member was banned" + (failed ? ", but could not be notified" : ""))
.setStatus(failed ? "Warning" : "Success")
],
components: []
@@ -204,30 +160,24 @@
const member = interaction.member as GuildMember;
const me = interaction.guild.me!;
const apply = interaction.options.getMember("user") as GuildMember;
- if (member === null || me === null || apply === null)
- throw "That member is not in the server";
+ if (member === null || me === null || apply === null) throw "That member is not in the server";
const memberPos = member.roles ? member.roles.highest.position : 0;
const mePos = me.roles ? me.roles.highest.position : 0;
const applyPos = apply.roles ? apply.roles.highest.position : 0;
// Do not allow banning the owner
- if (member.id === interaction.guild.ownerId)
- throw "You cannot ban the owner of the server";
+ if (member.id === interaction.guild.ownerId) throw "You cannot ban the owner of the server";
// Check if Nucleus can ban the member
- if (!(mePos > applyPos))
- throw "I do not have a role higher than that member";
+ if (!(mePos > applyPos)) throw "I do not have a role higher than that member";
// Check if Nucleus has permission to ban
- if (!me.permissions.has("BAN_MEMBERS"))
- throw "I do not have the *Ban Members* permission";
+ if (!me.permissions.has("BAN_MEMBERS")) throw "I do not have the *Ban Members* permission";
// Do not allow banning Nucleus
if (member.id === interaction.guild.me.id) throw "I cannot ban myself";
// Allow the owner to ban anyone
if (member.id === interaction.guild.ownerId) return true;
// Check if the user has ban_members permission
- if (!member.permissions.has("BAN_MEMBERS"))
- throw "You do not have the *Ban Members* permission";
+ if (!member.permissions.has("BAN_MEMBERS")) throw "You do not have the *Ban Members* permission";
// Check if the user is below on the role list
- if (!(memberPos > applyPos))
- throw "You do not have a role higher than that member";
+ if (!(memberPos > applyPos)) throw "You do not have a role higher than that member";
// Allow ban
return true;
};
diff --git a/src/commands/mod/info.ts b/src/commands/mod/info.ts
index 9837273..af30989 100644
--- a/src/commands/mod/info.ts
+++ b/src/commands/mod/info.ts
@@ -18,10 +18,7 @@
.setName("info")
.setDescription("Shows moderator information about a user")
.addUserOption((option) =>
- option
- .setName("user")
- .setDescription("The user to get information about")
- .setRequired(true)
+ option.setName("user").setDescription("The user to get information about").setRequired(true)
);
const types = {
@@ -39,11 +36,9 @@
};
function historyToString(history: HistorySchema) {
- let s = `${getEmojiByName(types[history.type].emoji)} ${
- history.amount ? history.amount + " " : ""
- }${types[history.type].text} on <t:${Math.round(
- history.occurredAt.getTime() / 1000
- )}:F>`;
+ let s = `${getEmojiByName(types[history.type].emoji)} ${history.amount ? history.amount + " " : ""}${
+ types[history.type].text
+ } on <t:${Math.round(history.occurredAt.getTime() / 1000)}:F>`;
if (history.moderator) {
s += ` by <@${history.moderator}>`;
}
@@ -71,13 +66,8 @@
return this.content.reduce((acc, cur) => acc + cur.rendered.length, 0);
};
generateName = () => {
- const first = Math.round(
- this.content[0].data.occurredAt.getTime() / 1000
- );
- const last = Math.round(
- this.content[this.content.length - 1].data.occurredAt.getTime() /
- 1000
- );
+ const first = Math.round(this.content[0].data.occurredAt.getTime() / 1000);
+ const last = Math.round(this.content[this.content.length - 1].data.occurredAt.getTime() / 1000);
if (first === last) {
return (this.name = `<t:${first}:F>`);
}
@@ -109,22 +99,14 @@
let openFilterPane = false;
while (true) {
if (refresh) {
- history = await client.database.history.read(
- member.guild.id,
- member.id,
- currentYear
- );
- history = history
- .sort((a, b) => b.occurredAt.getTime() - a.occurredAt.getTime())
- .reverse();
+ history = await client.database.history.read(member.guild.id, member.id, currentYear);
+ history = history.sort((a, b) => b.occurredAt.getTime() - a.occurredAt.getTime()).reverse();
if (openFilterPane) {
let tempFilteredTypes = filteredTypes;
if (filteredTypes.length === 0) {
tempFilteredTypes = Object.keys(types);
}
- history = history.filter((h) =>
- tempFilteredTypes.includes(h.type)
- );
+ history = history.filter((h) => tempFilteredTypes.includes(h.type));
}
refresh = false;
}
@@ -132,11 +114,7 @@
if (history.length > 0) {
current = new TimelineSection();
history.forEach((event) => {
- if (
- current.contentLength() + historyToString(event).length >
- 2000 ||
- current.content.length === 5
- ) {
+ if (current.contentLength() + historyToString(event).length > 2000 || current.content.length === 5) {
groups.push(current);
current.generateName();
current = new TimelineSection();
@@ -162,9 +140,7 @@
label: value.text,
value: key,
default: filteredTypes.includes(key),
- emoji: client.emojis.resolve(
- getEmojiByName(value.emoji, "id")
- )
+ emoji: client.emojis.resolve(getEmojiByName(value.emoji, "id"))
}))
)
.setMinValues(1)
@@ -181,22 +157,13 @@
.setLabel((currentYear - 1).toString())
.setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
.setStyle("SECONDARY"),
- new MessageButton()
- .setCustomId("prevPage")
- .setLabel("Previous page")
- .setStyle("PRIMARY"),
- new MessageButton()
- .setCustomId("today")
- .setLabel("Today")
- .setStyle("PRIMARY"),
+ new MessageButton().setCustomId("prevPage").setLabel("Previous page").setStyle("PRIMARY"),
+ new MessageButton().setCustomId("today").setLabel("Today").setStyle("PRIMARY"),
new MessageButton()
.setCustomId("nextPage")
.setLabel("Next page")
.setStyle("PRIMARY")
- .setDisabled(
- pageIndex >= groups.length - 1 &&
- currentYear === new Date().getFullYear()
- ),
+ .setDisabled(pageIndex >= groups.length - 1 && currentYear === new Date().getFullYear()),
new MessageButton()
.setCustomId("nextYear")
.setLabel((currentYear + 1).toString())
@@ -220,13 +187,8 @@
const end =
"\n\nJanuary " +
currentYear.toString() +
- pageIndicator(
- Math.max(groups.length, 1),
- groups.length === 0 ? 1 : pageIndex
- ) +
- (currentYear === new Date().getFullYear()
- ? monthNames[new Date().getMonth()]
- : "December") +
+ pageIndicator(Math.max(groups.length, 1), groups.length === 0 ? 1 : pageIndex) +
+ (currentYear === new Date().getFullYear() ? monthNames[new Date().getMonth()] : "December") +
" " +
currentYear.toString();
if (groups.length > 0) {
@@ -235,22 +197,13 @@
embeds: [
new EmojiEmbed()
.setEmoji("MEMBER.JOIN")
- .setTitle(
- "Moderation history for " + member.user.username
- )
+ .setTitle("Moderation history for " + member.user.username)
.setDescription(
- `**${toRender.name}**\n\n` +
- toRender.content
- .map((c) => c.rendered)
- .join("\n") +
- end
+ `**${toRender.name}**\n\n` + toRender.content.map((c) => c.rendered).join("\n") + end
)
.setStatus("Success")
.setFooter({
- text:
- openFilterPane && filteredTypes.length
- ? "Filters are currently enabled"
- : ""
+ text: openFilterPane && filteredTypes.length ? "Filters are currently enabled" : ""
})
],
components: components
@@ -260,18 +213,11 @@
embeds: [
new EmojiEmbed()
.setEmoji("MEMBER.JOIN")
- .setTitle(
- "Moderation history for " + member.user.username
- )
- .setDescription(
- `**${currentYear}**\n\n*No events*` + "\n\n" + end
- )
+ .setTitle("Moderation history for " + member.user.username)
+ .setDescription(`**${currentYear}**\n\n*No events*` + "\n\n" + end)
.setStatus("Success")
.setFooter({
- text:
- openFilterPane && filteredTypes.length
- ? "Filters are currently enabled"
- : ""
+ text: openFilterPane && filteredTypes.length ? "Filters are currently enabled" : ""
})
],
components: components
@@ -285,9 +231,7 @@
embeds: [
new EmojiEmbed()
.setEmoji("MEMBER.JOIN")
- .setTitle(
- "Moderation history for " + member.user.username
- )
+ .setTitle("Moderation history for " + member.user.username)
.setDescription(m.embeds[0].description)
.setStatus("Danger")
.setFooter({ text: "Message timed out" })
@@ -342,18 +286,11 @@
}
}
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
let m;
const member = interaction.options.getMember("user") as Discord.GuildMember;
await interaction.reply({
- embeds: [
- new EmojiEmbed()
- .setEmoji("NUCLEUS.LOADING")
- .setTitle("Downloading Data")
- .setStatus("Danger")
- ],
+ embeds: [new EmojiEmbed().setEmoji("NUCLEUS.LOADING").setTitle("Downloading Data").setStatus("Danger")],
ephemeral: true,
fetchReply: true
});
@@ -415,9 +352,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Mod notes for " + member.user.username)
- .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")
],
@@ -443,11 +378,7 @@
}
if (out.fields) {
const toAdd = out.fields.getTextInputValue("note") || null;
- await client.database.notes.create(
- member.guild.id,
- member.id,
- toAdd
- );
+ await client.database.notes.create(member.guild.id, member.id, toAdd);
} else {
continue;
}
@@ -460,8 +391,7 @@
const check = (interaction: CommandInteraction) => {
const member = interaction.member as GuildMember;
- if (!member.permissions.has("MODERATE_MEMBERS"))
- throw "You do not have the *Moderate Members* permission";
+ if (!member.permissions.has("MODERATE_MEMBERS")) throw "You do not have the *Moderate Members* permission";
return true;
};
diff --git a/src/commands/mod/kick.ts b/src/commands/mod/kick.ts
index 59c2f81..f10563e 100644
--- a/src/commands/mod/kick.ts
+++ b/src/commands/mod/kick.ts
@@ -1,9 +1,4 @@
-import {
- CommandInteraction,
- GuildMember,
- MessageActionRow,
- MessageButton
-} from "discord.js";
+import { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
import humanizeDuration from "humanize-duration";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import confirmationMessage from "../../utils/confirmationMessage.js";
@@ -15,16 +10,9 @@
builder
.setName("kick")
.setDescription("Kicks a user from the server")
- .addUserOption((option) =>
- option
- .setName("user")
- .setDescription("The user to kick")
- .setRequired(true)
- );
+ .addUserOption((option) => option.setName("user").setDescription("The user to kick").setRequired(true));
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const { renderUser } = client.logger;
// TODO:[Modals] Replace this with a modal
let reason = null;
@@ -37,15 +25,10 @@
.setDescription(
keyValueList({
user: renderUser(interaction.options.getUser("user")),
- reason: reason
- ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ")
- : "*No reason provided*"
+ reason: reason ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ") : "*No reason provided*"
}) +
`The user **will${notify ? "" : " not"}** be notified\n\n` +
- `Are you sure you want to kick <@!${
- (interaction.options.getMember("user") as GuildMember)
- .id
- }>?`
+ `Are you sure you want to kick <@!${(interaction.options.getMember("user") as GuildMember).id}>?`
)
.setColor("Danger")
.addReasonButton(reason ?? "")
@@ -64,9 +47,7 @@
const config = await client.database.guilds.read(interaction.guild.id);
try {
if (notify) {
- dm = await (
- interaction.options.getMember("user") as GuildMember
- ).send({
+ dm = await (interaction.options.getMember("user") as GuildMember).send({
embeds: [
new EmojiEmbed()
.setEmoji("PUNISH.KICK.RED")
@@ -96,19 +77,10 @@
dmd = false;
}
try {
- (interaction.options.getMember("user") as GuildMember).kick(
- reason ?? "No reason provided."
- );
+ (interaction.options.getMember("user") as GuildMember).kick(reason ?? "No reason provided.");
const member = interaction.options.getMember("user") as GuildMember;
- await client.database.history.create(
- "kick",
- interaction.guild.id,
- member.user,
- interaction.user,
- reason
- );
- const { log, NucleusColors, entry, renderUser, renderDelta } =
- client.logger;
+ await client.database.history.create("kick", interaction.guild.id, member.user, interaction.user, reason);
+ const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
const data = {
meta: {
type: "memberKick",
@@ -121,35 +93,17 @@
list: {
memberId: entry(member.id, `\`${member.id}\``),
name: entry(member.id, renderUser(member.user)),
- joined: entry(
- member.joinedAt,
- renderDelta(member.joinedAt)
- ),
- kicked: entry(
- new Date().getTime(),
- renderDelta(new Date().getTime())
- ),
- kickedBy: entry(
- interaction.user.id,
- renderUser(interaction.user)
- ),
- reason: entry(
- reason,
- reason ? `\n> ${reason}` : "*No reason provided.*"
- ),
+ joined: entry(member.joinedAt, renderDelta(member.joinedAt)),
+ kicked: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+ kickedBy: entry(interaction.user.id, renderUser(interaction.user)),
+ reason: entry(reason, reason ? `\n> ${reason}` : "*No reason provided.*"),
timeInServer: entry(
new Date().getTime() - member.joinedTimestamp,
- humanizeDuration(
- new Date().getTime() - member.joinedTimestamp,
- {
- round: true
- }
- )
+ humanizeDuration(new Date().getTime() - member.joinedTimestamp, {
+ round: true
+ })
),
- accountCreated: entry(
- member.user.createdAt,
- renderDelta(member.user.createdAt)
- ),
+ accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
serverMemberCount: member.guild.memberCount
},
hidden: {
@@ -163,9 +117,7 @@
new EmojiEmbed()
.setEmoji("PUNISH.KICK.RED")
.setTitle("Kick")
- .setDescription(
- "Something went wrong and the user was not kicked"
- )
+ .setDescription("Something went wrong and the user was not kicked")
.setStatus("Danger")
],
components: []
@@ -179,10 +131,7 @@
new EmojiEmbed()
.setEmoji(`PUNISH.KICK.${failed ? "YELLOW" : "GREEN"}`)
.setTitle("Kick")
- .setDescription(
- "The member was kicked" +
- (failed ? ", but could not be notified" : "")
- )
+ .setDescription("The member was kicked" + (failed ? ", but could not be notified" : ""))
.setStatus(failed ? "Warning" : "Success")
],
components: []
@@ -205,30 +154,24 @@
const member = interaction.member as GuildMember;
const me = interaction.guild.me!;
const apply = interaction.options.getMember("user") as GuildMember;
- if (member === null || me === null || apply === null)
- throw "That member is not in the server";
+ if (member === null || me === null || apply === null) throw "That member is not in the server";
const memberPos = member.roles ? member.roles.highest.position : 0;
const mePos = me.roles ? me.roles.highest.position : 0;
const applyPos = apply.roles ? apply.roles.highest.position : 0;
// Do not allow kicking the owner
- if (member.id === interaction.guild.ownerId)
- throw "You cannot kick the owner of the server";
+ if (member.id === interaction.guild.ownerId) throw "You cannot kick the owner of the server";
// Check if Nucleus can kick the member
- if (!(mePos > applyPos))
- throw "I do not have a role higher than that member";
+ if (!(mePos > applyPos)) throw "I do not have a role higher than that member";
// Check if Nucleus has permission to kick
- if (!me.permissions.has("KICK_MEMBERS"))
- throw "I do not have the *Kick Members* permission";
+ if (!me.permissions.has("KICK_MEMBERS")) throw "I do not have the *Kick Members* permission";
// Do not allow kicking Nucleus
if (member.id === interaction.guild.me.id) throw "I cannot kick myself";
// Allow the owner to kick anyone
if (member.id === interaction.guild.ownerId) return true;
// Check if the user has kick_members permission
- if (!member.permissions.has("KICK_MEMBERS"))
- throw "You do not have the *Kick Members* permission";
+ if (!member.permissions.has("KICK_MEMBERS")) throw "You do not have the *Kick Members* permission";
// Check if the user is below on the role list
- if (!(memberPos > applyPos))
- throw "You do not have a role higher than that member";
+ if (!(memberPos > applyPos)) throw "You do not have a role higher than that member";
// Allow kick
return true;
};
diff --git a/src/commands/mod/mute.ts b/src/commands/mod/mute.ts
index b430191..dc44e5a 100644
--- a/src/commands/mod/mute.ts
+++ b/src/commands/mod/mute.ts
@@ -1,11 +1,5 @@
import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, {
- CommandInteraction,
- GuildMember,
- Message,
- MessageActionRow,
- MessageButton
-} from "discord.js";
+import Discord, { CommandInteraction, GuildMember, Message, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
@@ -13,29 +7,17 @@
import keyValueList from "../../utils/generateKeyValueList.js";
import humanizeDuration from "humanize-duration";
import client from "../../utils/client.js";
-import {
- areTicketsEnabled,
- create
-} from "../../actions/createModActionTicket.js";
+import { areTicketsEnabled, create } from "../../actions/createModActionTicket.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
.setName("mute")
- .setDescription(
- "Mutes a member, stopping them from talking in the server"
- )
- .addUserOption((option) =>
- option
- .setName("user")
- .setDescription("The user to mute")
- .setRequired(true)
- )
+ .setDescription("Mutes a member, stopping them from talking in the server")
+ .addUserOption((option) => option.setName("user").setDescription("The user to mute").setRequired(true))
.addIntegerOption((option) =>
option
.setName("days")
- .setDescription(
- "The number of days to mute the user for | Default: 0"
- )
+ .setDescription("The number of days to mute the user for | Default: 0")
.setMinValue(0)
.setMaxValue(27)
.setRequired(false)
@@ -43,9 +25,7 @@
.addIntegerOption((option) =>
option
.setName("hours")
- .setDescription(
- "The number of hours to mute the user for | Default: 0"
- )
+ .setDescription("The number of hours to mute the user for | Default: 0")
.setMinValue(0)
.setMaxValue(23)
.setRequired(false)
@@ -53,9 +33,7 @@
.addIntegerOption((option) =>
option
.setName("minutes")
- .setDescription(
- "The number of minutes to mute the user for | Default: 0"
- )
+ .setDescription("The number of minutes to mute the user for | Default: 0")
.setMinValue(0)
.setMaxValue(59)
.setRequired(false)
@@ -63,17 +41,14 @@
.addIntegerOption((option) =>
option
.setName("seconds")
- .setDescription(
- "The number of seconds to mute the user for | Default: 0"
- )
+ .setDescription("The number of seconds to mute the user for | Default: 0")
.setMinValue(0)
.setMaxValue(59)
.setRequired(false)
);
const callback = async (interaction: CommandInteraction): Promise<unknown> => {
- const { log, NucleusColors, renderUser, entry, renderDelta } =
- client.logger;
+ const { log, NucleusColors, renderUser, entry, renderDelta } = client.logger;
const user = interaction.options.getMember("user") as GuildMember;
const time = {
days: interaction.options.getInteger("days") ?? 0,
@@ -82,19 +57,12 @@
seconds: interaction.options.getInteger("seconds") ?? 0
};
const config = await client.database.guilds.read(interaction.guild.id);
- let serverSettingsDescription = config.moderation.mute.timeout
- ? "given a timeout"
- : "";
+ let serverSettingsDescription = config.moderation.mute.timeout ? "given a timeout" : "";
if (config.moderation.mute.role)
serverSettingsDescription +=
- (serverSettingsDescription ? " and " : "") +
- `given the <@&${config.moderation.mute.role}> role`;
+ (serverSettingsDescription ? " and " : "") + `given the <@&${config.moderation.mute.role}> role`;
- let muteTime =
- time.days * 24 * 60 * 60 +
- time.hours * 60 * 60 +
- time.minutes * 60 +
- time.seconds;
+ let muteTime = time.days * 24 * 60 * 60 + time.hours * 60 * 60 + time.minutes * 60 + time.seconds;
if (muteTime === 0) {
const m = (await interaction.reply({
embeds: [
@@ -106,40 +74,16 @@
],
components: [
new MessageActionRow().addComponents([
- new Discord.MessageButton()
- .setCustomId("1m")
- .setLabel("1 Minute")
- .setStyle("SECONDARY"),
- new Discord.MessageButton()
- .setCustomId("10m")
- .setLabel("10 Minutes")
- .setStyle("SECONDARY"),
- new Discord.MessageButton()
- .setCustomId("30m")
- .setLabel("30 Minutes")
- .setStyle("SECONDARY"),
- new Discord.MessageButton()
- .setCustomId("1h")
- .setLabel("1 Hour")
- .setStyle("SECONDARY")
+ new Discord.MessageButton().setCustomId("1m").setLabel("1 Minute").setStyle("SECONDARY"),
+ new Discord.MessageButton().setCustomId("10m").setLabel("10 Minutes").setStyle("SECONDARY"),
+ new Discord.MessageButton().setCustomId("30m").setLabel("30 Minutes").setStyle("SECONDARY"),
+ new Discord.MessageButton().setCustomId("1h").setLabel("1 Hour").setStyle("SECONDARY")
]),
new MessageActionRow().addComponents([
- new Discord.MessageButton()
- .setCustomId("6h")
- .setLabel("6 Hours")
- .setStyle("SECONDARY"),
- new Discord.MessageButton()
- .setCustomId("12h")
- .setLabel("12 Hours")
- .setStyle("SECONDARY"),
- new Discord.MessageButton()
- .setCustomId("1d")
- .setLabel("1 Day")
- .setStyle("SECONDARY"),
- new Discord.MessageButton()
- .setCustomId("1w")
- .setLabel("1 Week")
- .setStyle("SECONDARY")
+ new Discord.MessageButton().setCustomId("6h").setLabel("6 Hours").setStyle("SECONDARY"),
+ new Discord.MessageButton().setCustomId("12h").setLabel("12 Hours").setStyle("SECONDARY"),
+ new Discord.MessageButton().setCustomId("1d").setLabel("1 Day").setStyle("SECONDARY"),
+ new Discord.MessageButton().setCustomId("1w").setLabel("1 Week").setStyle("SECONDARY")
]),
new MessageActionRow().addComponents([
new Discord.MessageButton()
@@ -228,9 +172,7 @@
time: `${humanizeDuration(muteTime * 1000, {
round: true
})}`,
- reason: reason
- ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ")
- : "*No reason provided*"
+ reason: reason ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ") : "*No reason provided*"
}) +
"The user will be " +
serverSettingsDescription +
@@ -244,12 +186,7 @@
"Create appeal ticket",
!(await areTicketsEnabled(interaction.guild.id)),
async () =>
- await create(
- interaction.guild,
- interaction.options.getUser("user"),
- interaction.user,
- reason
- ),
+ await create(interaction.guild, interaction.options.getUser("user"), interaction.user, reason),
"An appeal ticket will be created when Confirm is clicked",
"CONTROL.TICKET",
createAppealTicket
@@ -291,17 +228,9 @@
? ` for:\n> ${reason}`
: ".\n\n" +
`You will be unmuted at: <t:${
- Math.round(
- new Date().getTime() / 1000
- ) + muteTime
- }:D> at <t:${
- Math.round(
- new Date().getTime() / 1000
- ) + muteTime
- }:T> (<t:${
- Math.round(
- new Date().getTime() / 1000
- ) + muteTime
+ Math.round(new Date().getTime() / 1000) + muteTime
+ }:D> at <t:${Math.round(new Date().getTime() / 1000) + muteTime}:T> (<t:${
+ Math.round(new Date().getTime() / 1000) + muteTime
}:R>)`) +
(confirmation.components.appeal.response
? `You can appeal this here: <#${confirmation.components.appeal.response}>`
@@ -331,10 +260,7 @@
let errors = 0;
try {
if (config.moderation.mute.timeout) {
- await member.timeout(
- muteTime * 1000,
- reason || "No reason provided"
- );
+ await member.timeout(muteTime * 1000, reason || "No reason provided");
if (config.moderation.mute.role !== null) {
await member.roles.add(config.moderation.mute.role);
await client.database.eventScheduler.schedule(
@@ -354,15 +280,11 @@
try {
if (config.moderation.mute.role !== null) {
await member.roles.add(config.moderation.mute.role);
- await client.database.eventScheduler.schedule(
- "unmuteRole",
- new Date().getTime() + muteTime * 1000,
- {
- guild: interaction.guild.id,
- user: user.id,
- role: config.moderation.mute.role
- }
- );
+ await client.database.eventScheduler.schedule("unmuteRole", new Date().getTime() + muteTime * 1000, {
+ guild: interaction.guild.id,
+ user: user.id,
+ role: config.moderation.mute.role
+ });
}
} catch (e) {
console.log(e);
@@ -374,9 +296,7 @@
new EmojiEmbed()
.setEmoji("PUNISH.MUTE.RED")
.setTitle("Mute")
- .setDescription(
- "Something went wrong and the user was not muted"
- )
+ .setDescription("Something went wrong and the user was not muted")
.setStatus("Danger")
],
components: []
@@ -384,13 +304,7 @@
if (dmd) await dm.delete();
return;
}
- await client.database.history.create(
- "mute",
- interaction.guild.id,
- member.user,
- interaction.user,
- reason
- );
+ await client.database.history.create("mute", interaction.guild.id, member.user, interaction.user, reason);
const failed = !dmd && notify;
await interaction.editReply({
embeds: [
@@ -424,14 +338,8 @@
new Date().getTime() + muteTime * 1000,
renderDelta(new Date().getTime() + muteTime * 1000)
),
- muted: entry(
- new Date().getTime(),
- renderDelta(new Date().getTime() - 1000)
- ),
- mutedBy: entry(
- interaction.member.user.id,
- renderUser(interaction.member.user)
- ),
+ muted: entry(new Date().getTime(), renderDelta(new Date().getTime() - 1000)),
+ mutedBy: entry(interaction.member.user.id, renderUser(interaction.member.user)),
reason: entry(reason, reason ? reason : "*No reason provided*")
},
hidden: {
@@ -457,30 +365,24 @@
const member = interaction.member as GuildMember;
const me = interaction.guild.me!;
const apply = interaction.options.getMember("user") as GuildMember;
- if (member === null || me === null || apply === null)
- throw "That member is not in the server";
+ if (member === null || me === null || apply === null) throw "That member is not in the server";
const memberPos = member.roles ? member.roles.highest.position : 0;
const mePos = me.roles ? me.roles.highest.position : 0;
const applyPos = apply.roles ? apply.roles.highest.position : 0;
// Do not allow muting the owner
- if (member.id === interaction.guild.ownerId)
- throw "You cannot mute the owner of the server";
+ if (member.id === interaction.guild.ownerId) throw "You cannot mute the owner of the server";
// Check if Nucleus can mute the member
- if (!(mePos > applyPos))
- throw "I do not have a role higher than that member";
+ if (!(mePos > applyPos)) throw "I do not have a role higher than that member";
// Check if Nucleus has permission to mute
- if (!me.permissions.has("MODERATE_MEMBERS"))
- throw "I do not have the *Moderate Members* permission";
+ if (!me.permissions.has("MODERATE_MEMBERS")) throw "I do not have the *Moderate Members* permission";
// Do not allow muting Nucleus
if (member.id === me.id) throw "I cannot mute myself";
// Allow the owner to mute anyone
if (member.id === interaction.guild.ownerId) return true;
// Check if the user has moderate_members permission
- if (!member.permissions.has("MODERATE_MEMBERS"))
- throw "You do not have the *Moderate Members* permission";
+ if (!member.permissions.has("MODERATE_MEMBERS")) throw "You do not have the *Moderate Members* permission";
// Check if the user is below on the role list
- if (!(memberPos > applyPos))
- throw "You do not have a role higher than that member";
+ if (!(memberPos > applyPos)) throw "You do not have a role higher than that member";
// Allow mute
return true;
};
diff --git a/src/commands/mod/nick.ts b/src/commands/mod/nick.ts
index c3d6b33..cba14f4 100644
--- a/src/commands/mod/nick.ts
+++ b/src/commands/mod/nick.ts
@@ -9,22 +9,12 @@
builder
.setName("nick")
.setDescription("Changes a users nickname")
- .addUserOption((option) =>
- option
- .setName("user")
- .setDescription("The user to change")
- .setRequired(true)
- )
+ .addUserOption((option) => option.setName("user").setDescription("The user to change").setRequired(true))
.addStringOption((option) =>
- option
- .setName("name")
- .setDescription("The name to set | Leave blank to clear")
- .setRequired(false)
+ option.setName("name").setDescription("The name to set | Leave blank to clear").setRequired(false)
);
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const { renderUser } = client.logger;
// TODO:[Modals] Replace this with a modal
let notify = true;
@@ -37,19 +27,12 @@
keyValueList({
user: renderUser(interaction.options.getUser("user")),
"new nickname": `${
- interaction.options.getString("name")
- ? interaction.options.getString("name")
- : "*No nickname*"
+ interaction.options.getString("name") ? interaction.options.getString("name") : "*No nickname*"
}`
}) +
`The user **will${notify ? "" : " not"}** be notified\n\n` +
- `Are you sure you want to ${
- interaction.options.getString("name")
- ? "change"
- : "clear"
- } <@!${
- (interaction.options.getMember("user") as GuildMember)
- .id
+ `Are you sure you want to ${interaction.options.getString("name") ? "change" : "clear"} <@!${
+ (interaction.options.getMember("user") as GuildMember).id
}>'s nickname?`
)
.setColor("Danger")
@@ -74,23 +57,17 @@
let dm;
try {
if (notify) {
- dm = await (
- interaction.options.getMember("user") as GuildMember
- ).send({
+ dm = await (interaction.options.getMember("user") as GuildMember).send({
embeds: [
new EmojiEmbed()
.setEmoji("PUNISH.NICKNAME.RED")
.setTitle("Nickname changed")
.setDescription(
`Your nickname was ${
- interaction.options.getString("name")
- ? "changed"
- : "cleared"
+ interaction.options.getString("name") ? "changed" : "cleared"
} in ${interaction.guild.name}.` +
(interaction.options.getString("name")
- ? ` it is now: ${interaction.options.getString(
- "name"
- )}`
+ ? ` it is now: ${interaction.options.getString("name")}`
: "") +
"\n\n" +
(confirmation.components.appeal.response
@@ -119,8 +96,7 @@
before,
nickname
);
- const { log, NucleusColors, entry, renderUser, renderDelta } =
- client.logger;
+ const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
const data = {
meta: {
type: "memberUpdate",
@@ -134,14 +110,8 @@
memberId: entry(member.id, `\`${member.id}\``),
before: entry(before, before ? before : "*None*"),
after: entry(nickname, nickname ? nickname : "*None*"),
- updated: entry(
- new Date().getTime(),
- renderDelta(new Date().getTime())
- ),
- updatedBy: entry(
- interaction.user.id,
- renderUser(interaction.user)
- )
+ updated: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+ updatedBy: entry(interaction.user.id, renderUser(interaction.user))
},
hidden: {
guild: interaction.guild.id
@@ -154,9 +124,7 @@
new EmojiEmbed()
.setEmoji("PUNISH.NICKNAME.RED")
.setTitle("Nickname")
- .setDescription(
- "Something went wrong and the users nickname could not be changed."
- )
+ .setDescription("Something went wrong and the users nickname could not be changed.")
.setStatus("Danger")
],
components: []
@@ -199,30 +167,24 @@
const member = interaction.member as GuildMember;
const me = interaction.guild.me!;
const apply = interaction.options.getMember("user") as GuildMember;
- if (member === null || me === null || apply === null)
- throw "That member is not in the server";
+ if (member === null || me === null || apply === null) throw "That member is not in the server";
const memberPos = member.roles ? member.roles.highest.position : 0;
const mePos = me.roles ? me.roles.highest.position : 0;
const applyPos = apply.roles ? apply.roles.highest.position : 0;
// Do not allow any changing of the owner
- if (member.id === interaction.guild.ownerId)
- throw "You cannot change the owner's nickname";
+ if (member.id === interaction.guild.ownerId) throw "You cannot change the owner's nickname";
// Check if Nucleus can change the nickname
- if (!(mePos > applyPos))
- throw "I do not have a role higher than that member";
+ if (!(mePos > applyPos)) throw "I do not have a role higher than that member";
// Check if Nucleus has permission to change the nickname
- if (!me.permissions.has("MANAGE_NICKNAMES"))
- throw "I do not have the *Manage Nicknames* permission";
+ if (!me.permissions.has("MANAGE_NICKNAMES")) throw "I do not have the *Manage Nicknames* permission";
// Allow the owner to change anyone's nickname
if (member.id === interaction.guild.ownerId) return true;
// Check if the user has manage_nicknames permission
- if (!member.permissions.has("MANAGE_NICKNAMES"))
- throw "You do not have the *Manage Nicknames* permission";
+ if (!member.permissions.has("MANAGE_NICKNAMES")) throw "You do not have the *Manage Nicknames* permission";
// Allow changing your own nickname
if (member === apply) return true;
// Check if the user is below on the role list
- if (!(memberPos > applyPos))
- throw "You do not have a role higher than that member";
+ if (!(memberPos > applyPos)) throw "You do not have a role higher than that member";
// Allow change
return true;
};
diff --git a/src/commands/mod/purge.ts b/src/commands/mod/purge.ts
index b78c423..63a919c 100644
--- a/src/commands/mod/purge.ts
+++ b/src/commands/mod/purge.ts
@@ -1,9 +1,4 @@
-import Discord, {
- CommandInteraction,
- GuildChannel,
- GuildMember,
- TextChannel
-} from "discord.js";
+import Discord, { CommandInteraction, GuildChannel, GuildMember, TextChannel } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -24,31 +19,19 @@
.setMaxValue(100)
)
.addUserOption((option) =>
- option
- .setName("user")
- .setDescription("The user to purge messages from")
- .setRequired(false)
+ option.setName("user").setDescription("The user to purge messages from").setRequired(false)
)
.addStringOption((option) =>
- option
- .setName("reason")
- .setDescription("The reason for the purge")
- .setRequired(false)
+ option.setName("reason").setDescription("The reason for the purge").setRequired(false)
);
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const user = (interaction.options.getMember("user") as GuildMember) ?? null;
const channel = interaction.channel as GuildChannel;
if (
- ![
- "GUILD_TEXT",
- "GUILD_NEWS",
- "GUILD_NEWS_THREAD",
- "GUILD_PUBLIC_THREAD",
- "GUILD_PRIVATE_THREAD"
- ].includes(channel.type.toString())
+ !["GUILD_TEXT", "GUILD_NEWS", "GUILD_NEWS_THREAD", "GUILD_PUBLIC_THREAD", "GUILD_PRIVATE_THREAD"].includes(
+ channel.type.toString()
+ )
) {
return await interaction.reply({
embeds: [
@@ -90,32 +73,14 @@
],
components: [
new Discord.MessageActionRow().addComponents([
- new Discord.MessageButton()
- .setCustomId("1")
- .setLabel("1")
- .setStyle("SECONDARY"),
- new Discord.MessageButton()
- .setCustomId("3")
- .setLabel("3")
- .setStyle("SECONDARY"),
- new Discord.MessageButton()
- .setCustomId("5")
- .setLabel("5")
- .setStyle("SECONDARY")
+ new Discord.MessageButton().setCustomId("1").setLabel("1").setStyle("SECONDARY"),
+ new Discord.MessageButton().setCustomId("3").setLabel("3").setStyle("SECONDARY"),
+ new Discord.MessageButton().setCustomId("5").setLabel("5").setStyle("SECONDARY")
]),
new Discord.MessageActionRow().addComponents([
- new Discord.MessageButton()
- .setCustomId("10")
- .setLabel("10")
- .setStyle("SECONDARY"),
- new Discord.MessageButton()
- .setCustomId("25")
- .setLabel("25")
- .setStyle("SECONDARY"),
- new Discord.MessageButton()
- .setCustomId("50")
- .setLabel("50")
- .setStyle("SECONDARY")
+ new Discord.MessageButton().setCustomId("10").setLabel("10").setStyle("SECONDARY"),
+ new Discord.MessageButton().setCustomId("25").setLabel("25").setStyle("SECONDARY"),
+ new Discord.MessageButton().setCustomId("50").setLabel("50").setStyle("SECONDARY")
]),
new Discord.MessageActionRow().addComponents([
new Discord.MessageButton()
@@ -144,17 +109,12 @@
break;
}
let messages;
- await (interaction.channel as TextChannel).messages
- .fetch({ limit: amount })
- .then(async (ms) => {
- if (user) {
- ms = ms.filter((m) => m.author.id === user.id);
- }
- messages = await (channel as TextChannel).bulkDelete(
- ms,
- true
- );
- });
+ await (interaction.channel as TextChannel).messages.fetch({ limit: amount }).then(async (ms) => {
+ if (user) {
+ ms = ms.filter((m) => m.author.id === user.id);
+ }
+ messages = await (channel as TextChannel).bulkDelete(ms, true);
+ });
if (messages) {
deleted = deleted.concat(messages.map((m) => m));
}
@@ -181,8 +141,7 @@
deleted.length
);
}
- const { log, NucleusColors, entry, renderUser, renderChannel } =
- client.logger;
+ const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
const data = {
meta: {
type: "channelPurge",
@@ -193,18 +152,9 @@
timestamp: new Date().getTime()
},
list: {
- memberId: entry(
- interaction.user.id,
- `\`${interaction.user.id}\``
- ),
- purgedBy: entry(
- interaction.user.id,
- renderUser(interaction.user)
- ),
- channel: entry(
- interaction.channel.id,
- renderChannel(interaction.channel)
- ),
+ memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
+ purgedBy: entry(interaction.user.id, renderUser(interaction.user)),
+ channel: entry(interaction.channel.id, renderChannel(interaction.channel)),
messagesCleared: entry(deleted.length, deleted.length)
},
hidden: {
@@ -214,9 +164,7 @@
log(data);
let out = "";
deleted.reverse().forEach((message) => {
- out += `${message.author.username}#${
- message.author.discriminator
- } (${message.author.id}) [${new Date(
+ out += `${message.author.username}#${message.author.discriminator} (${message.author.id}) [${new Date(
message.createdTimestamp
).toISOString()}]\n`;
const lines = message.content.split("\n");
@@ -304,29 +252,19 @@
let messages;
try {
if (!user) {
- const toDelete = await (
- interaction.channel as TextChannel
- ).messages.fetch({
+ const toDelete = await (interaction.channel as TextChannel).messages.fetch({
limit: interaction.options.getInteger("amount")
});
- messages = await (channel as TextChannel).bulkDelete(
- toDelete,
- true
- );
+ messages = await (channel as TextChannel).bulkDelete(toDelete, true);
} else {
const toDelete = (
await (
- await (
- interaction.channel as TextChannel
- ).messages.fetch({
+ await (interaction.channel as TextChannel).messages.fetch({
limit: 100
})
).filter((m) => m.author.id === user.id)
).first(interaction.options.getInteger("amount"));
- messages = await (channel as TextChannel).bulkDelete(
- toDelete,
- true
- );
+ messages = await (channel as TextChannel).bulkDelete(toDelete, true);
}
} catch (e) {
await interaction.editReply({
@@ -334,9 +272,7 @@
new EmojiEmbed()
.setEmoji("CHANNEL.PURGE.RED")
.setTitle("Purge")
- .setDescription(
- "Something went wrong and no messages were deleted"
- )
+ .setDescription("Something went wrong and no messages were deleted")
.setStatus("Danger")
],
components: []
@@ -353,8 +289,7 @@
messages.size
);
}
- const { log, NucleusColors, entry, renderUser, renderChannel } =
- client.logger;
+ const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
const data = {
meta: {
type: "channelPurge",
@@ -365,18 +300,9 @@
timestamp: new Date().getTime()
},
list: {
- memberId: entry(
- interaction.user.id,
- `\`${interaction.user.id}\``
- ),
- purgedBy: entry(
- interaction.user.id,
- renderUser(interaction.user)
- ),
- channel: entry(
- interaction.channel.id,
- renderChannel(interaction.channel)
- ),
+ memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
+ purgedBy: entry(interaction.user.id, renderUser(interaction.user)),
+ channel: entry(interaction.channel.id, renderChannel(interaction.channel)),
messagesCleared: entry(messages.size, messages.size)
},
hidden: {
@@ -386,9 +312,7 @@
log(data);
let out = "";
messages.reverse().forEach((message) => {
- out += `${message.author.username}#${
- message.author.discriminator
- } (${message.author.id}) [${new Date(
+ out += `${message.author.username}#${message.author.discriminator} (${message.author.id}) [${new Date(
message.createdTimestamp
).toISOString()}]\n`;
const lines = message.content.split("\n");
@@ -472,13 +396,11 @@
const member = interaction.member as GuildMember;
const me = interaction.guild.me!;
// Check if nucleus has the manage_messages permission
- if (!me.permissions.has("MANAGE_MESSAGES"))
- throw "I do not have the *Manage Messages* permission";
+ if (!me.permissions.has("MANAGE_MESSAGES")) throw "I do not have the *Manage Messages* permission";
// Allow the owner to purge
if (member.id === interaction.guild.ownerId) return true;
// Check if the user has manage_messages permission
- if (!member.permissions.has("MANAGE_MESSAGES"))
- throw "You do not have the *Manage Messages* permission";
+ if (!member.permissions.has("MANAGE_MESSAGES")) throw "You do not have the *Manage Messages* permission";
// Allow purge
return true;
};
diff --git a/src/commands/mod/slowmode.ts b/src/commands/mod/slowmode.ts
index 1a06db1..5565534 100644
--- a/src/commands/mod/slowmode.ts
+++ b/src/commands/mod/slowmode.ts
@@ -34,10 +34,7 @@
const callback = async (interaction: CommandInteraction): Promise<void> => {
let time = parseInt(interaction.options.getString("time") ?? "0");
- if (
- time === 0 &&
- (interaction.channel as TextChannel).rateLimitPerUser === 0
- ) {
+ if (time === 0 && (interaction.channel as TextChannel).rateLimitPerUser === 0) {
time = 10;
}
const confirmation = await new confirmationMessage(interaction)
@@ -45,9 +42,7 @@
.setTitle("Slowmode")
.setDescription(
keyValueList({
- time: time
- ? humanizeDuration(time * 1000, { round: true })
- : "No delay"
+ time: time ? humanizeDuration(time * 1000, { round: true }) : "No delay"
}) + "Are you sure you want to set the slowmode in this channel?"
)
.setColor("Danger")
@@ -62,9 +57,7 @@
new EmojiEmbed()
.setEmoji("CHANNEL.SLOWMODE.OFF")
.setTitle("Slowmode")
- .setDescription(
- "Something went wrong while setting the slowmode"
- )
+ .setDescription("Something went wrong while setting the slowmode")
.setStatus("Danger")
],
components: []
@@ -100,8 +93,7 @@
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;
};
diff --git a/src/commands/mod/softban.ts b/src/commands/mod/softban.ts
index f3c475e..57a70dc 100644
--- a/src/commands/mod/softban.ts
+++ b/src/commands/mod/softban.ts
@@ -1,9 +1,4 @@
-import {
- CommandInteraction,
- GuildMember,
- MessageActionRow,
- MessageButton
-} from "discord.js";
+import { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -15,12 +10,7 @@
builder
.setName("softban")
.setDescription("Kicks a user and deletes their messages")
- .addUserOption((option) =>
- option
- .setName("user")
- .setDescription("The user to softban")
- .setRequired(true)
- )
+ .addUserOption((option) => option.setName("user").setDescription("The user to softban").setRequired(true))
.addIntegerOption((option) =>
option
.setName("delete")
@@ -30,9 +20,7 @@
.setRequired(false)
);
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const { renderUser } = client.logger;
// TODO:[Modals] Replace this with a modal
let reason = null;
@@ -45,21 +33,14 @@
.setDescription(
keyValueList({
user: renderUser(interaction.options.getUser("user")),
- reason: reason
- ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ")
- : "*No reason provided*"
+ reason: reason ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ") : "*No reason provided*"
}) +
`The user **will${notify ? "" : " not"}** be notified\n` +
`${addPlural(
- interaction.options.getInteger("delete")
- ? interaction.options.getInteger("delete")
- : 0,
+ interaction.options.getInteger("delete") ? interaction.options.getInteger("delete") : 0,
"day"
)} of messages will be deleted\n\n` +
- `Are you sure you want to softban <@!${
- (interaction.options.getMember("user") as GuildMember)
- .id
- }>?`
+ `Are you sure you want to softban <@!${(interaction.options.getMember("user") as GuildMember).id}>?`
)
.setColor("Danger")
.addCustomBoolean(
@@ -86,9 +67,7 @@
const config = await client.database.guilds.read(interaction.guild.id);
try {
if (notify) {
- await (
- interaction.options.getMember("user") as GuildMember
- ).send({
+ await (interaction.options.getMember("user") as GuildMember).send({
embeds: [
new EmojiEmbed()
.setEmoji("PUNISH.BAN.RED")
@@ -130,30 +109,20 @@
new EmojiEmbed()
.setEmoji("PUNISH.BAN.RED")
.setTitle("Softban")
- .setDescription(
- "Something went wrong and the user was not softbanned"
- )
+ .setDescription("Something went wrong and the user was not softbanned")
.setStatus("Danger")
],
components: []
});
}
- await client.database.history.create(
- "softban",
- interaction.guild.id,
- member.user,
- reason
- );
+ await client.database.history.create("softban", interaction.guild.id, member.user, reason);
const failed = !dmd && notify;
await interaction.editReply({
embeds: [
new EmojiEmbed()
.setEmoji(`PUNISH.BAN.${failed ? "YELLOW" : "GREEN"}`)
.setTitle("Softban")
- .setDescription(
- "The member was softbanned" +
- (failed ? ", but could not be notified" : "")
- )
+ .setDescription("The member was softbanned" + (failed ? ", but could not be notified" : ""))
.setStatus(failed ? "Warning" : "Success")
],
components: []
@@ -176,30 +145,24 @@
const member = interaction.member as GuildMember;
const me = interaction.guild.me!;
const apply = interaction.options.getMember("user") as GuildMember;
- if (member === null || me === null || apply === null)
- throw "That member is not in the server";
+ if (member === null || me === null || apply === null) throw "That member is not in the server";
const memberPos = member.roles ? member.roles.highest.position : 0;
const mePos = me.roles ? me.roles.highest.position : 0;
const applyPos = apply.roles ? apply.roles.highest.position : 0;
// Do not allow softbanning the owner
- if (member.id === interaction.guild.ownerId)
- throw "You cannot softban the owner of the server";
+ if (member.id === interaction.guild.ownerId) throw "You cannot softban the owner of the server";
// Check if Nucleus can ban the member
- if (!(mePos > applyPos))
- throw "I do not have a role higher than that member";
+ if (!(mePos > applyPos)) throw "I do not have a role higher than that member";
// Check if Nucleus has permission to ban
- if (!me.permissions.has("BAN_MEMBERS"))
- throw "I do not have the *Ban Members* permission";
+ if (!me.permissions.has("BAN_MEMBERS")) throw "I do not have the *Ban Members* permission";
// Do not allow softbanning Nucleus
if (member.id === me.id) throw "I cannot softban myself";
// Allow the owner to softban anyone
if (member.id === interaction.guild.ownerId) return true;
// Check if the user has ban_members permission
- if (!member.permissions.has("BAN_MEMBERS"))
- throw "You do not have the *Ban Members* permission";
+ if (!member.permissions.has("BAN_MEMBERS")) throw "You do not have the *Ban Members* permission";
// Check if the user is below on the role list
- if (!(memberPos > applyPos))
- throw "You do not have a role higher than that member";
+ if (!(memberPos > applyPos)) throw "You do not have a role higher than that member";
// Allow softban
return true;
};
diff --git a/src/commands/mod/unban.ts b/src/commands/mod/unban.ts
index 06fe647..9ba10e1 100644
--- a/src/commands/mod/unban.ts
+++ b/src/commands/mod/unban.ts
@@ -10,34 +10,21 @@
.setName("unban")
.setDescription("Unbans a user")
.addStringOption((option) =>
- option
- .setName("user")
- .setDescription("The user to unban (Username or ID)")
- .setRequired(true)
+ option.setName("user").setDescription("The user to unban (Username or ID)").setRequired(true)
);
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const bans = await interaction.guild.bans.fetch();
const user = interaction.options.getString("user");
let resolved = bans.find((ban) => ban.user.id === user);
- if (!resolved)
- resolved = bans.find(
- (ban) => ban.user.username.toLowerCase() === user.toLowerCase()
- );
- if (!resolved)
- resolved = bans.find(
- (ban) => ban.user.tag.toLowerCase() === user.toLowerCase()
- );
+ if (!resolved) resolved = bans.find((ban) => ban.user.username.toLowerCase() === user.toLowerCase());
+ if (!resolved) resolved = bans.find((ban) => ban.user.tag.toLowerCase() === user.toLowerCase());
if (!resolved) {
return interaction.reply({
embeds: [
new EmojiEmbed()
.setTitle("Unban")
- .setDescription(
- `Could not find any user called \`${user}\``
- )
+ .setDescription(`Could not find any user called \`${user}\``)
.setEmoji("PUNISH.UNBAN.RED")
.setStatus("Danger")
],
@@ -58,19 +45,10 @@
if (confirmation.cancelled) return;
if (confirmation.success) {
try {
- await interaction.guild.members.unban(
- resolved.user as User,
- "Unban"
- );
+ await interaction.guild.members.unban(resolved.user as User, "Unban");
const member = resolved.user as User;
- await client.database.history.create(
- "unban",
- interaction.guild.id,
- member,
- interaction.user
- );
- const { log, NucleusColors, entry, renderUser, renderDelta } =
- client.logger;
+ await client.database.history.create("unban", interaction.guild.id, member, interaction.user);
+ const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
const data = {
meta: {
type: "memberUnban",
@@ -83,18 +61,9 @@
list: {
memberId: entry(member.id, `\`${member.id}\``),
name: entry(member.id, renderUser(member)),
- unbanned: entry(
- new Date().getTime(),
- renderDelta(new Date().getTime())
- ),
- unbannedBy: entry(
- interaction.user.id,
- renderUser(interaction.user)
- ),
- accountCreated: entry(
- member.createdAt,
- renderDelta(member.createdAt)
- )
+ unbanned: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+ unbannedBy: entry(interaction.user.id, renderUser(interaction.user)),
+ accountCreated: entry(member.createdAt, renderDelta(member.createdAt))
},
hidden: {
guild: interaction.guild.id
@@ -107,9 +76,7 @@
new EmojiEmbed()
.setEmoji("PUNISH.UNBAN.RED")
.setTitle("Unban")
- .setDescription(
- "Something went wrong and the user was not unbanned"
- )
+ .setDescription("Something went wrong and the user was not unbanned")
.setStatus("Danger")
],
components: []
@@ -143,13 +110,11 @@
const member = interaction.member as GuildMember;
const me = interaction.guild.me!;
// Check if Nucleus can unban members
- if (!me.permissions.has("BAN_MEMBERS"))
- throw "I do not have the *Ban Members* permission";
+ if (!me.permissions.has("BAN_MEMBERS")) throw "I do not have the *Ban Members* permission";
// Allow the owner to unban anyone
if (member.id === interaction.guild.ownerId) return true;
// Check if the user has ban_members permission
- if (!member.permissions.has("BAN_MEMBERS"))
- throw "You do not have the *Ban Members* permission";
+ if (!member.permissions.has("BAN_MEMBERS")) throw "You do not have the *Ban Members* permission";
// Allow unban
return true;
};
diff --git a/src/commands/mod/unmute.ts b/src/commands/mod/unmute.ts
index f625461..40a2093 100644
--- a/src/commands/mod/unmute.ts
+++ b/src/commands/mod/unmute.ts
@@ -9,18 +9,10 @@
builder
.setName("unmute")
.setDescription("Unmutes a user")
- .addUserOption((option) =>
- option
- .setName("user")
- .setDescription("The user to unmute")
- .setRequired(true)
- );
+ .addUserOption((option) => option.setName("user").setDescription("The user to unmute").setRequired(true));
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
- const { log, NucleusColors, renderUser, entry, renderDelta } =
- client.logger;
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
+ const { log, NucleusColors, renderUser, entry, renderDelta } = client.logger;
// TODO:[Modals] Replace this with a modal
let reason = null;
let notify = false;
@@ -35,10 +27,7 @@
reason: `\n> ${reason ? reason : "*No reason provided*"}`
}) +
`The user **will${notify ? "" : " not"}** be notified\n\n` +
- `Are you sure you want to unmute <@!${
- (interaction.options.getMember("user") as GuildMember)
- .id
- }>?`
+ `Are you sure you want to unmute <@!${(interaction.options.getMember("user") as GuildMember).id}>?`
)
.setColor("Danger")
.addReasonButton(reason ?? "")
@@ -55,18 +44,14 @@
let dm;
try {
if (notify) {
- dm = await (
- interaction.options.getMember("user") as GuildMember
- ).send({
+ dm = await (interaction.options.getMember("user") as GuildMember).send({
embeds: [
new EmojiEmbed()
.setEmoji("PUNISH.MUTE.GREEN")
.setTitle("Unmuted")
.setDescription(
`You have been unmuted in ${interaction.guild.name}` +
- (reason
- ? ` for:\n> ${reason}`
- : " with no reason provided.")
+ (reason ? ` for:\n> ${reason}` : " with no reason provided.")
)
.setStatus("Success")
]
@@ -85,9 +70,7 @@
new EmojiEmbed()
.setEmoji("PUNISH.MUTE.RED")
.setTitle("Unmute")
- .setDescription(
- "Something went wrong and the user was not unmuted"
- )
+ .setDescription("Something went wrong and the user was not unmuted")
.setStatus("Danger")
],
components: []
@@ -114,14 +97,8 @@
list: {
memberId: entry(member.user.id, `\`${member.user.id}\``),
name: entry(member.user.id, renderUser(member.user)),
- unmuted: entry(
- new Date().getTime(),
- renderDelta(new Date().getTime())
- ),
- unmutedBy: entry(
- interaction.user.id,
- renderUser(interaction.user)
- )
+ unmuted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+ unmutedBy: entry(interaction.user.id, renderUser(interaction.user))
},
hidden: {
guild: interaction.guild.id
@@ -134,10 +111,7 @@
new EmojiEmbed()
.setEmoji(`PUNISH.MUTE.${failed ? "YELLOW" : "GREEN"}`)
.setTitle("Unmute")
- .setDescription(
- "The member was unmuted" +
- (failed ? ", but could not be notified" : "")
- )
+ .setDescription("The member was unmuted" + (failed ? ", but could not be notified" : ""))
.setStatus(failed ? "Warning" : "Success")
],
components: []
@@ -160,28 +134,22 @@
const member = interaction.member as GuildMember;
const me = interaction.guild.me!;
const apply = interaction.options.getMember("user") as GuildMember;
- if (member === null || me === null || apply === null)
- throw "That member is not in the server";
+ if (member === null || me === null || apply === null) throw "That member is not in the server";
const memberPos = member.roles ? member.roles.highest.position : 0;
const mePos = me.roles ? me.roles.highest.position : 0;
const applyPos = apply.roles ? apply.roles.highest.position : 0;
// Do not allow unmuting the owner
- if (member.id === interaction.guild.ownerId)
- throw "You cannot unmute the owner of the server";
+ if (member.id === interaction.guild.ownerId) throw "You cannot unmute the owner of the server";
// Check if Nucleus can unmute the member
- if (!(mePos > applyPos))
- throw "I do not have a role higher than that member";
+ if (!(mePos > applyPos)) throw "I do not have a role higher than that member";
// Check if Nucleus has permission to unmute
- if (!me.permissions.has("MODERATE_MEMBERS"))
- throw "I do not have the *Moderate Members* permission";
+ if (!me.permissions.has("MODERATE_MEMBERS")) throw "I do not have the *Moderate Members* permission";
// Allow the owner to unmute anyone
if (member.id === interaction.guild.ownerId) return true;
// Check if the user has moderate_members permission
- if (!member.permissions.has("MODERATE_MEMBERS"))
- throw "You do not have the *Moderate Members* permission";
+ if (!member.permissions.has("MODERATE_MEMBERS")) throw "You do not have the *Moderate Members* permission";
// Check if the user is below on the role list
- if (!(memberPos > applyPos))
- throw "You do not have a role higher than that member";
+ if (!(memberPos > applyPos)) throw "You do not have a role higher than that member";
// Allow unmute
return true;
};
diff --git a/src/commands/mod/viewas.ts b/src/commands/mod/viewas.ts
index f0b2047..577192f 100644
--- a/src/commands/mod/viewas.ts
+++ b/src/commands/mod/viewas.ts
@@ -15,19 +15,13 @@
builder
.setName("viewas")
.setDescription("View the server as a specific member")
- .addUserOption((option) =>
- option
- .setName("member")
- .setDescription("The member to view as")
- .setRequired(true)
- );
+ .addUserOption((option) => option.setName("member").setDescription("The member to view as").setRequired(true));
const callback = async (interaction: CommandInteraction): Promise<void> => {
let channels = [];
let m;
interaction.guild.channels.cache.forEach((channel) => {
- if (!channel.parent && channel.type !== "GUILD_CATEGORY")
- channels.push(channel);
+ if (!channel.parent && channel.type !== "GUILD_CATEGORY") channels.push(channel);
});
channels = [channels];
channels = channels.concat(
@@ -38,11 +32,7 @@
const autoSortBelow = ["GUILD_VOICE", "GUILD_STAGE_VOICE"];
channels = channels.map((c) =>
c.sort((a, b) => {
- if (
- autoSortBelow.includes(a.type) &&
- autoSortBelow.includes(b.type)
- )
- return a.position - b.position;
+ if (autoSortBelow.includes(a.type) && autoSortBelow.includes(b.type)) return a.position - b.position;
if (autoSortBelow.includes(a.type)) return 1;
if (autoSortBelow.includes(b.type)) return -1;
return a.position - b.position;
@@ -54,9 +44,7 @@
if (!b[0].parent) return 1;
return a[0].parent.position - b[0].parent.position;
});
- const member = interaction.options.getMember(
- "member"
- ) as Discord.GuildMember;
+ const member = interaction.options.getMember("member") as Discord.GuildMember;
m = await interaction.reply({
embeds: [
new EmojiEmbed()
@@ -76,48 +64,26 @@
.setTitle("Viewing as " + member.displayName)
.setStatus("Success")
.setDescription(
- `**${
- channels[page][0].parent
- ? channels[page][0].parent.name
- : "Uncategorised"
- }**` +
+ `**${channels[page][0].parent ? channels[page][0].parent.name : "Uncategorised"}**` +
"\n" +
channels[page]
.map((c) => {
let channelType = c.type;
- if (
- interaction.guild.rulesChannelId ===
- c.id
- )
- channelType = "RULES";
- else if ("nsfw" in c && c.nsfw)
- channelType += "_NSFW";
- return c
- .permissionsFor(member)
- .has("VIEW_CHANNEL")
- ? `${getEmojiByName(
- "ICONS.CHANNEL." + channelType
- )} ${c.name}\n` +
+ if (interaction.guild.rulesChannelId === c.id) channelType = "RULES";
+ else if ("nsfw" in c && c.nsfw) channelType += "_NSFW";
+ return c.permissionsFor(member).has("VIEW_CHANNEL")
+ ? `${getEmojiByName("ICONS.CHANNEL." + channelType)} ${c.name}\n` +
(() => {
- if (
- "threads" in c &&
- c.threads.cache.size > 0
- ) {
+ if ("threads" in c && c.threads.cache.size > 0) {
return (
c.threads.cache
.map(
(t) =>
` ${
- getEmojiByName(
- "ICONS.CHANNEL.THREAD_PIPE"
- ) +
+ getEmojiByName("ICONS.CHANNEL.THREAD_PIPE") +
" " +
- getEmojiByName(
- "ICONS.CHANNEL.THREAD_CHANNEL"
- )
- } ${
- t.name
- }`
+ getEmojiByName("ICONS.CHANNEL.THREAD_CHANNEL")
+ } ${t.name}`
)
.join("\n") + "\n"
);
@@ -136,9 +102,7 @@
new MessageSelectMenu()
.setOptions(
channels.map((c, index) => ({
- label: c[0].parent
- ? c[0].parent.name
- : "Uncategorised",
+ label: c[0].parent ? c[0].parent.name : "Uncategorised",
value: index.toString(),
default: page === index
}))
@@ -195,8 +159,7 @@
const check = (interaction: CommandInteraction) => {
const member = interaction.member as GuildMember;
- if (!member.permissions.has("MANAGE_ROLES"))
- throw "You do not have the *Manage Roles* permission";
+ if (!member.permissions.has("MANAGE_ROLES")) throw "You do not have the *Manage Roles* permission";
return true;
};
diff --git a/src/commands/mod/warn.ts b/src/commands/mod/warn.ts
index 91c876e..5e321d0 100644
--- a/src/commands/mod/warn.ts
+++ b/src/commands/mod/warn.ts
@@ -1,33 +1,18 @@
-import Discord, {
- CommandInteraction,
- GuildMember,
- MessageActionRow,
- MessageButton
-} from "discord.js";
+import Discord, { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
-import {
- create,
- areTicketsEnabled
-} from "../../actions/createModActionTicket.js";
+import { create, areTicketsEnabled } from "../../actions/createModActionTicket.js";
import client from "../../utils/client.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
.setName("warn")
.setDescription("Warns a user")
- .addUserOption((option) =>
- option
- .setName("user")
- .setDescription("The user to warn")
- .setRequired(true)
- );
+ .addUserOption((option) => option.setName("user").setDescription("The user to warn").setRequired(true));
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const { log, NucleusColors, renderUser, entry } = client.logger;
// TODO:[Modals] Replace this with a modal
let reason = null;
@@ -41,15 +26,10 @@
.setDescription(
keyValueList({
user: renderUser(interaction.options.getUser("user")),
- reason: reason
- ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ")
- : "*No reason provided*"
+ reason: reason ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ") : "*No reason provided*"
}) +
`The user **will${notify ? "" : " not"}** be notified\n\n` +
- `Are you sure you want to warn <@!${
- (interaction.options.getMember("user") as GuildMember)
- .id
- }>?`
+ `Are you sure you want to warn <@!${(interaction.options.getMember("user") as GuildMember).id}>?`
)
.setColor("Danger")
.addCustomBoolean(
@@ -57,12 +37,7 @@
"Create appeal ticket",
!(await areTicketsEnabled(interaction.guild.id)),
async () =>
- await create(
- interaction.guild,
- interaction.options.getUser("user"),
- interaction.user,
- reason
- ),
+ await create(interaction.guild, interaction.options.getUser("user"), interaction.user, reason),
"An appeal ticket will be created when Confirm is clicked",
"CONTROL.TICKET",
createAppealTicket
@@ -91,12 +66,8 @@
let dmd = false;
try {
if (notify) {
- const config = await client.database.guilds.read(
- interaction.guild.id
- );
- await (
- interaction.options.getMember("user") as GuildMember
- ).send({
+ const config = await client.database.guilds.read(interaction.guild.id);
+ await (interaction.options.getMember("user") as GuildMember).send({
embeds: [
new EmojiEmbed()
.setEmoji("PUNISH.WARN.RED")
@@ -145,17 +116,10 @@
},
list: {
user: entry(
- (interaction.options.getMember("user") as GuildMember).user
- .id,
- renderUser(
- (interaction.options.getMember("user") as GuildMember)
- .user
- )
+ (interaction.options.getMember("user") as GuildMember).user.id,
+ renderUser((interaction.options.getMember("user") as GuildMember).user)
),
- warnedBy: entry(
- interaction.member.user.id,
- renderUser(interaction.member.user)
- ),
+ warnedBy: entry(interaction.member.user.id, renderUser(interaction.member.user)),
reason: reason ? `\n> ${reason}` : "No reason provided"
},
hidden: {
@@ -188,9 +152,7 @@
components: []
});
} else {
- const canSeeChannel = (
- interaction.options.getMember("user") as GuildMember
- )
+ const canSeeChannel = (interaction.options.getMember("user") as GuildMember)
.permissionsIn(interaction.channel as Discord.TextChannel)
.has("VIEW_CHANNEL");
const m = (await interaction.editReply({
@@ -198,17 +160,12 @@
new EmojiEmbed()
.setEmoji("PUNISH.WARN.RED")
.setTitle("Warn")
- .setDescription(
- "The user's DMs are not open\n\nWhat would you like to do?"
- )
+ .setDescription("The user's DMs are not open\n\nWhat would you like to do?")
.setStatus("Danger")
],
components: [
new MessageActionRow().addComponents([
- new Discord.MessageButton()
- .setCustomId("log")
- .setLabel("Ignore and log")
- .setStyle("SECONDARY"),
+ new Discord.MessageButton().setCustomId("log").setLabel("Ignore and log").setStyle("SECONDARY"),
new Discord.MessageButton()
.setCustomId("here")
.setLabel("Warn here")
@@ -245,24 +202,12 @@
new EmojiEmbed()
.setEmoji("PUNISH.WARN.RED")
.setTitle("Warn")
- .setDescription(
- "You have been warned" +
- (reason ? ` for:\n> ${reason}` : ".")
- )
+ .setDescription("You have been warned" + (reason ? ` for:\n> ${reason}` : "."))
.setStatus("Danger")
],
- content: `<@!${
- (interaction.options.getMember("user") as GuildMember)
- .id
- }>`,
+ content: `<@!${(interaction.options.getMember("user") as GuildMember).id}>`,
allowedMentions: {
- users: [
- (
- interaction.options.getMember(
- "user"
- ) as GuildMember
- ).id
- ]
+ users: [(interaction.options.getMember("user") as GuildMember).id]
}
});
return await interaction.editReply({
@@ -316,9 +261,7 @@
new EmojiEmbed()
.setEmoji("PUNISH.WARN.GREEN")
.setTitle("Warn")
- .setDescription(
- `A ticket was created in <#${ticketChannel}>`
- )
+ .setDescription(`A ticket was created in <#${ticketChannel}>`)
.setStatus("Success")
],
components: []
@@ -343,8 +286,7 @@
const member = interaction.member as GuildMember;
const me = interaction.guild.me!;
const apply = interaction.options.getMember("user") as GuildMember;
- if (member === null || me === null || apply === null)
- throw "That member is not in the server";
+ if (member === null || me === null || apply === null) throw "That member is not in the server";
const memberPos = member.roles ? member.roles.highest.position : 0;
const applyPos = apply.roles ? apply.roles.highest.position : 0;
// Do not allow warning bots
@@ -352,11 +294,9 @@
// Allow the owner to warn anyone
if (member.id === interaction.guild.ownerId) return true;
// Check if the user has moderate_members permission
- if (!member.permissions.has("MODERATE_MEMBERS"))
- throw "You do not have the *Moderate Members* permission";
+ if (!member.permissions.has("MODERATE_MEMBERS")) throw "You do not have the *Moderate Members* permission";
// Check if the user is below on the role list
- if (!(memberPos > applyPos))
- throw "You do not have a role higher than that member";
+ if (!(memberPos > applyPos)) throw "You do not have a role higher than that member";
// Allow warn
return true;
};
diff --git a/src/commands/nucleus/guide.ts b/src/commands/nucleus/guide.ts
index b9df446..ffc441a 100644
--- a/src/commands/nucleus/guide.ts
+++ b/src/commands/nucleus/guide.ts
@@ -2,9 +2,7 @@
import guide from "../../reflex/guide.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
- builder
- .setName("guide")
- .setDescription("Shows the welcome guide for the bot");
+ builder.setName("guide").setDescription("Shows the welcome guide for the bot");
const callback = async (interaction) => {
guide(interaction.guild, interaction);
diff --git a/src/commands/nucleus/invite.ts b/src/commands/nucleus/invite.ts
index 8ae8c1a..341f7d2 100644
--- a/src/commands/nucleus/invite.ts
+++ b/src/commands/nucleus/invite.ts
@@ -1,8 +1,4 @@
-import {
- CommandInteraction,
- MessageActionRow,
- MessageButton
-} from "discord.js";
+import { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import client from "../../utils/client.js";
@@ -15,9 +11,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Invite")
- .setDescription(
- "You can invite Nucleus to your server by clicking the button below"
- )
+ .setDescription("You can invite Nucleus to your server by clicking the button below")
.setEmoji("NUCLEUS.LOGO")
.setStatus("Danger")
],
diff --git a/src/commands/nucleus/ping.ts b/src/commands/nucleus/ping.ts
index 105cda5..59b6393 100644
--- a/src/commands/nucleus/ping.ts
+++ b/src/commands/nucleus/ping.ts
@@ -20,9 +20,7 @@
.setDescription(
`**Ping:** \`${ping}ms\`\n` +
`**To Discord:** \`${client.ws.ping}ms\`\n` +
- `**From Expected:** \`±${Math.abs(
- ping / 2 - client.ws.ping
- )}ms\``
+ `**From Expected:** \`±${Math.abs(ping / 2 - client.ws.ping)}ms\``
)
.setEmoji("CHANNEL.SLOWMODE.OFF")
.setStatus("Danger")
diff --git a/src/commands/nucleus/premium.ts b/src/commands/nucleus/premium.ts
index 83ba327..9bbc36e 100644
--- a/src/commands/nucleus/premium.ts
+++ b/src/commands/nucleus/premium.ts
@@ -3,9 +3,7 @@
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
- builder
- .setName("premium")
- .setDescription("Information about Nucleus Premium");
+ builder.setName("premium").setDescription("Information about Nucleus Premium");
const callback = async (interaction: CommandInteraction): Promise<void> => {
interaction.reply({
diff --git a/src/commands/nucleus/stats.ts b/src/commands/nucleus/stats.ts
index 68eeaa9..a67cd36 100644
--- a/src/commands/nucleus/stats.ts
+++ b/src/commands/nucleus/stats.ts
@@ -11,10 +11,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Stats")
- .setDescription(
- `**Servers:** ${client.guilds.cache.size}\n` +
- `**Ping:** \`${client.ws.ping * 2}ms\``
- )
+ .setDescription(`**Servers:** ${client.guilds.cache.size}\n` + `**Ping:** \`${client.ws.ping * 2}ms\``)
.setStatus("Success")
.setEmoji("GUILD.GRAPHS")
],
diff --git a/src/commands/nucleus/suggest.ts b/src/commands/nucleus/suggest.ts
index 0f40501..bdd55af 100644
--- a/src/commands/nucleus/suggest.ts
+++ b/src/commands/nucleus/suggest.ts
@@ -10,10 +10,7 @@
.setName("suggest")
.setDescription("Sends a suggestion to the developers")
.addStringOption((option) =>
- option
- .setName("suggestion")
- .setDescription("The suggestion to send")
- .setRequired(true)
+ option.setName("suggestion").setDescription("The suggestion to send").setRequired(true)
);
const callback = async (interaction: CommandInteraction): Promise<void> => {
@@ -31,18 +28,12 @@
.send();
if (confirmation.cancelled) return;
if (confirmation.success) {
- await (
- client.channels.cache.get(
- "955161206459600976"
- ) as Discord.TextChannel
- ).send({
+ await (client.channels.cache.get("955161206459600976") as Discord.TextChannel).send({
embeds: [
new EmojiEmbed()
.setTitle("Suggestion")
.setDescription(
- `**From:** ${renderUser(
- interaction.member.user
- )}\n**Suggestion:**\n> ${suggestion}`
+ `**From:** ${renderUser(interaction.member.user)}\n**Suggestion:**\n> ${suggestion}`
)
.setStatus("Danger")
.setEmoji("NUCLEUS.LOGO")
@@ -72,10 +63,7 @@
}
};
-const check = (
- _interaction: CommandInteraction,
- _defaultCheck: WrappedCheck
-) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
return true;
};
diff --git a/src/commands/privacy.ts b/src/commands/privacy.ts
index 3c36ea1..7903666 100644
--- a/src/commands/privacy.ts
+++ b/src/commands/privacy.ts
@@ -1,9 +1,5 @@
import { LoadingEmbed } from "./../utils/defaultEmbeds.js";
-import Discord, {
- CommandInteraction,
- MessageActionRow,
- MessageButton
-} from "discord.js";
+import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
import { SelectMenuOption, SlashCommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
@@ -14,9 +10,7 @@
const command = new SlashCommandBuilder()
.setName("privacy")
- .setDescription(
- "Information and options for you and your server's settings"
- );
+ .setDescription("Information and options for you and your server's settings");
class Embed {
embed: Discord.MessageEmbed;
@@ -91,22 +85,16 @@
.setStatus("Danger")
)
.setTitle("Link scanning and Transcripts")
- .setDescription(
- "Regarding Facebook and AMP filter types, and ticket transcripts"
- )
+ .setDescription("Regarding Facebook and AMP filter types, and ticket transcripts")
.setPageId(2)
].concat(
- (interaction.member as Discord.GuildMember).permissions.has(
- "ADMINISTRATOR"
- )
+ (interaction.member as Discord.GuildMember).permissions.has("ADMINISTRATOR")
? [
new Embed()
.setEmbed(
new EmojiEmbed()
.setTitle("Options")
- .setDescription(
- "Below are buttons for controlling this servers privacy settings"
- )
+ .setDescription("Below are buttons for controlling this servers privacy settings")
.setEmoji("NUCLEUS.LOGO")
.setStatus("Danger")
)
@@ -178,9 +166,7 @@
])
]);
const em = new Discord.MessageEmbed(pages[page].embed);
- em.setDescription(
- em.description + "\n\n" + createPageIndicator(pages.length, page)
- );
+ em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
em.setFooter({ text: nextFooter ?? "" });
await interaction.editReply({
embeds: [em],
@@ -229,20 +215,14 @@
}
} else {
const em = new Discord.MessageEmbed(pages[page].embed);
- em.setDescription(
- em.description +
- "\n\n" +
- createPageIndicator(pages.length, page)
- );
+ em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
em.setFooter({ text: "Message closed" });
interaction.editReply({ embeds: [em], components: [] });
return;
}
}
const em = new Discord.MessageEmbed(pages[page].embed);
- em.setDescription(
- em.description + "\n\n" + createPageIndicator(pages.length, page)
- );
+ em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
em.setFooter({ text: "Message timed out" });
await interaction.editReply({
embeds: [em],
@@ -250,10 +230,7 @@
});
};
-const check = (
- _interaction: CommandInteraction,
- _defaultCheck: WrappedCheck
-) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
return true;
};
diff --git a/src/commands/role/user.ts b/src/commands/role/user.ts
index 2557b4b..3b3eb79 100644
--- a/src/commands/role/user.ts
+++ b/src/commands/role/user.ts
@@ -11,16 +11,10 @@
.setName("user")
.setDescription("Gives or removes a role from someone")
.addUserOption((option) =>
- option
- .setName("user")
- .setDescription("The member to give or remove the role from")
- .setRequired(true)
+ option.setName("user").setDescription("The member to give or remove the role from").setRequired(true)
)
.addRoleOption((option) =>
- option
- .setName("role")
- .setDescription("The role to give or remove")
- .setRequired(true)
+ option.setName("role").setDescription("The role to give or remove").setRequired(true)
)
.addStringOption((option) =>
option
@@ -33,9 +27,7 @@
])
);
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const { renderUser, renderRole } = client.logger;
const action = interaction.options.getString("action");
// TODO:[Modals] Replace this with a modal
@@ -48,9 +40,7 @@
role: renderRole(interaction.options.getRole("role"))
}) +
`\nAre you sure you want to ${
- action === "give"
- ? "give the role to"
- : "remove the role from"
+ action === "give" ? "give the role to" : "remove the role from"
} ${interaction.options.getUser("user")}?`
)
.setColor("Danger")
@@ -70,9 +60,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Role")
- .setDescription(
- "Something went wrong and the role could not be added"
- )
+ .setDescription("Something went wrong and the role could not be added")
.setStatus("Danger")
.setEmoji("CONTROL.BLOCKCROSS")
],
@@ -83,11 +71,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Role")
- .setDescription(
- `The role has been ${
- action === "give" ? "given" : "removed"
- } successfully`
- )
+ .setDescription(`The role has been ${action === "give" ? "given" : "removed"} successfully`)
.setStatus("Success")
.setEmoji("GUILD.ROLES.CREATE")
],
@@ -107,23 +91,17 @@
}
};
-const check = (
- interaction: CommandInteraction,
- _defaultCheck: WrappedCheck
-) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
const member = interaction.member as GuildMember;
const me = interaction.guild.me!;
const apply = interaction.options.getMember("user") as GuildMember;
- if (member === null || me === null || apply === null)
- throw "That member is not in the server";
+ if (member === null || me === null || apply === null) throw "That member is not in the server";
// Check if Nucleus has permission to role
- if (!me.permissions.has("MANAGE_ROLES"))
- throw "I do not have the *Manage Roles* permission";
+ if (!me.permissions.has("MANAGE_ROLES")) throw "I do not have the *Manage Roles* permission";
// Allow the owner to role anyone
if (member.id === interaction.guild.ownerId) return true;
// Check if the user has manage_roles permission
- if (!member.permissions.has("MANAGE_ROLES"))
- throw "You do not have the *Manage Roles* permission";
+ if (!member.permissions.has("MANAGE_ROLES")) throw "You do not have the *Manage Roles* permission";
// Allow role
return true;
};
diff --git a/src/commands/rolemenu.ts b/src/commands/rolemenu.ts
index 8566966..dd3cb34 100644
--- a/src/commands/rolemenu.ts
+++ b/src/commands/rolemenu.ts
@@ -11,10 +11,7 @@
await roleMenu(interaction);
};
-const check = (
- _interaction: CommandInteraction,
- _defaultCheck: WrappedCheck
-) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
return true;
};
diff --git a/src/commands/server/about.ts b/src/commands/server/about.ts
index 0a1cc6f..4465be5 100644
--- a/src/commands/server/about.ts
+++ b/src/commands/server/about.ts
@@ -3,9 +3,7 @@
import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
-import generateKeyValueList, {
- toCapitals
-} from "../../utils/generateKeyValueList.js";
+import generateKeyValueList, { toCapitals } from "../../utils/generateKeyValueList.js";
import client from "../../utils/client.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
@@ -31,18 +29,9 @@
(guild.emojis.cache.size > 1
? `\n> ${guild.emojis.cache
.first(10)
- .map(
- (emoji) =>
- `<${emoji.animated ? "a" : ""}:${
- emoji.name
- }:${emoji.id}>`
- )
+ .map((emoji) => `<${emoji.animated ? "a" : ""}:${emoji.name}:${emoji.id}>`)
.join(" ")}` +
- (guild.emojis.cache.size > 10
- ? ` and ${
- guild.emojis.cache.size - 10
- } more`
- : "")
+ (guild.emojis.cache.size > 10 ? ` and ${guild.emojis.cache.size - 10} more` : "")
: ""),
icon: `[Discord](${guild.iconURL()})`,
"2 factor authentication": `${
@@ -50,19 +39,11 @@
? `${getEmojiByName("CONTROL.CROSS")} No`
: `${getEmojiByName("CONTROL.TICK")} Yes`
}`,
- "verification level": `${toCapitals(
- guild.verificationLevel
- )}`,
+ "verification level": `${toCapitals(guild.verificationLevel)}`,
"explicit content filter": `${toCapitals(
- guild.explicitContentFilter
- .toString()
- .replace(/_/, " ")
+ guild.explicitContentFilter.toString().replace(/_/, " ")
)}`,
- "nitro boost level": `${
- guild.premiumTier !== "NONE"
- ? guild.premiumTier.toString()[-1]
- : "0"
- }`,
+ "nitro boost level": `${guild.premiumTier !== "NONE" ? guild.premiumTier.toString()[-1] : "0"}`,
channels: `${guild.channels.cache.size}`,
roles: `${guild.roles.cache.size}`,
members: `${guild.memberCount}`
@@ -74,10 +55,7 @@
});
};
-const check = (
- _interaction: CommandInteraction,
- _defaultCheck: WrappedCheck
-) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
return true;
};
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;
};
diff --git a/src/commands/tag.ts b/src/commands/tag.ts
index 34c3152..d65109d 100644
--- a/src/commands/tag.ts
+++ b/src/commands/tag.ts
@@ -1,9 +1,4 @@
-import {
- AutocompleteInteraction,
- CommandInteraction,
- MessageActionRow,
- MessageButton
-} from "discord.js";
+import { AutocompleteInteraction, CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandBuilder } from "@discordjs/builders";
import client from "../utils/client.js";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
@@ -11,13 +6,7 @@
const command = new SlashCommandBuilder()
.setName("tag")
.setDescription("Get and manage the servers tags")
- .addStringOption((o) =>
- o
- .setName("tag")
- .setDescription("The tag to get")
- .setAutocomplete(true)
- .setRequired(true)
- );
+ .addStringOption((o) => o.setName("tag").setDescription("The tag to get").setAutocomplete(true).setRequired(true));
const callback = async (interaction: CommandInteraction): Promise<void> => {
const config = await client.database.guilds.read(interaction.guild.id);
@@ -28,11 +17,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Tag")
- .setDescription(
- `Tag \`${interaction.options.getString(
- "tag"
- )}\` does not exist`
- )
+ .setDescription(`Tag \`${interaction.options.getString("tag")}\` does not exist`)
.setEmoji("PUNISH.NICKNAME.RED")
.setStatus("Danger")
],
@@ -44,12 +29,7 @@
if (tag.match(/^(http|https):\/\/[^ "]+$/)) {
url = tag;
components = [
- new MessageActionRow().addComponents([
- new MessageButton()
- .setLabel("Open")
- .setURL(url)
- .setStyle("LINK")
- ])
+ new MessageActionRow().addComponents([new MessageButton().setLabel("Open").setURL(url).setStyle("LINK")])
];
}
return await interaction.reply({
@@ -70,9 +50,7 @@
return true;
};
-const autocomplete = async (
- interaction: AutocompleteInteraction
-): Promise<string[]> => {
+const autocomplete = async (interaction: AutocompleteInteraction): Promise<string[]> => {
if (!interaction.guild) return [];
const config = await client.database.guilds.read(interaction.guild.id);
const tags = Object.keys(config.getKey("tags"));
diff --git a/src/commands/tags/create.ts b/src/commands/tags/create.ts
index 5d6621b..6350ad7 100644
--- a/src/commands/tags/create.ts
+++ b/src/commands/tags/create.ts
@@ -9,24 +9,12 @@
builder
.setName("create")
.setDescription("Creates a tag")
+ .addStringOption((o) => o.setName("name").setRequired(true).setDescription("The name of the tag"))
.addStringOption((o) =>
- o
- .setName("name")
- .setRequired(true)
- .setDescription("The name of the tag")
- )
- .addStringOption((o) =>
- o
- .setName("value")
- .setRequired(true)
- .setDescription(
- "The value of the tag, shown after running /tag name"
- )
+ o.setName("value").setRequired(true).setDescription("The value of the tag, shown after running /tag name")
);
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const name = interaction.options.getString("name");
const value = interaction.options.getString("value");
if (name.length > 100)
@@ -34,9 +22,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Tag Create")
- .setDescription(
- "Tag names cannot be longer than 100 characters"
- )
+ .setDescription("Tag names cannot be longer than 100 characters")
.setStatus("Danger")
.setEmoji("PUNISH.NICKNAME.RED")
],
@@ -47,9 +33,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Tag Create")
- .setDescription(
- "Tag values cannot be longer than 1000 characters"
- )
+ .setDescription("Tag values cannot be longer than 1000 characters")
.setStatus("Danger")
.setEmoji("PUNISH.NICKNAME.RED")
],
@@ -110,9 +94,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Tag Create")
- .setDescription(
- "Something went wrong and the tag was not created"
- )
+ .setDescription("Something went wrong and the tag was not created")
.setStatus("Danger")
.setEmoji("PUNISH.NICKNAME.RED")
],
diff --git a/src/commands/tags/delete.ts b/src/commands/tags/delete.ts
index 4d1a1aa..1abdc48 100644
--- a/src/commands/tags/delete.ts
+++ b/src/commands/tags/delete.ts
@@ -9,16 +9,9 @@
builder
.setName("delete")
.setDescription("Deletes a tag")
- .addStringOption((o) =>
- o
- .setName("name")
- .setRequired(true)
- .setDescription("The name of the tag")
- );
+ .addStringOption((o) => o.setName("name").setRequired(true).setDescription("The name of the tag"));
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const name = interaction.options.getString("name");
const data = await client.database.guilds.read(interaction.guild.id);
if (!data.tags[name])
@@ -56,18 +49,14 @@
]
});
try {
- await client.database.guilds.write(interaction.guild.id, null, [
- "tags." + name
- ]);
+ await client.database.guilds.write(interaction.guild.id, null, ["tags." + name]);
} catch (e) {
console.log(e);
return await interaction.editReply({
embeds: [
new EmojiEmbed()
.setTitle("Tag Delete")
- .setDescription(
- "Something went wrong and the tag was not deleted"
- )
+ .setDescription("Something went wrong and the tag was not deleted")
.setStatus("Danger")
.setEmoji("PUNISH.NICKNAME.RED")
],
diff --git a/src/commands/tags/edit.ts b/src/commands/tags/edit.ts
index 5aaec40..0ce306f 100644
--- a/src/commands/tags/edit.ts
+++ b/src/commands/tags/edit.ts
@@ -9,23 +9,12 @@
builder
.setName("edit")
.setDescription("Edits or renames a tag")
+ .addStringOption((o) => o.setName("name").setRequired(true).setDescription("The tag to edit"))
.addStringOption((o) =>
- o
- .setName("name")
- .setRequired(true)
- .setDescription("The tag to edit")
+ o.setName("value").setRequired(false).setDescription("The new value of the tag / Rename")
)
.addStringOption((o) =>
- o
- .setName("value")
- .setRequired(false)
- .setDescription("The new value of the tag / Rename")
- )
- .addStringOption((o) =>
- o
- .setName("newname")
- .setRequired(false)
- .setDescription("The new name of the tag / Edit")
+ o.setName("newname").setRequired(false).setDescription("The new name of the tag / Edit")
);
const callback = async (interaction: CommandInteraction): Promise<unknown> => {
@@ -49,9 +38,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Tag Edit")
- .setDescription(
- "Tag names cannot be longer than 100 characters"
- )
+ .setDescription("Tag names cannot be longer than 100 characters")
.setStatus("Danger")
.setEmoji("PUNISH.NICKNAME.RED")
],
@@ -62,9 +49,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Tag Edit")
- .setDescription(
- "Tag values cannot be longer than 2000 characters"
- )
+ .setDescription("Tag values cannot be longer than 2000 characters")
.setStatus("Danger")
.setEmoji("PUNISH.NICKNAME.RED")
],
@@ -124,19 +109,13 @@
toUnset.push(`tags.${name}`);
toSet[`tags.${newname}`] = data.tags[name];
}
- await client.database.guilds.write(
- interaction.guild.id,
- toSet === {} ? null : toSet,
- toUnset
- );
+ await client.database.guilds.write(interaction.guild.id, toSet === {} ? null : toSet, toUnset);
} catch (e) {
return await interaction.editReply({
embeds: [
new EmojiEmbed()
.setTitle("Tag Edit")
- .setDescription(
- "Something went wrong and the tag was not edited"
- )
+ .setDescription("Something went wrong and the tag was not edited")
.setStatus("Danger")
.setEmoji("PUNISH.NICKNAME.RED")
],
@@ -158,9 +137,7 @@
const check = (interaction: CommandInteraction) => {
const member = interaction.member as GuildMember;
if (!member.permissions.has("MANAGE_MESSAGES"))
- throw new Error(
- "You must have the *Manage Messages* permission to use this command"
- );
+ throw new Error("You must have the *Manage Messages* permission to use this command");
return true;
};
diff --git a/src/commands/tags/list.ts b/src/commands/tags/list.ts
index 070aa8b..e62dee8 100644
--- a/src/commands/tags/list.ts
+++ b/src/commands/tags/list.ts
@@ -106,9 +106,7 @@
];
}
const em = new Discord.MessageEmbed(pages[page].embed);
- em.setDescription(
- em.description + "\n\n" + createPageIndicator(pages.length, page)
- );
+ em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
await interaction.editReply({
embeds: [em],
components: selectPane.concat([
@@ -145,28 +143,17 @@
if ((i.component as MessageActionRowComponent).customId === "left") {
if (page > 0) page--;
selectPaneOpen = false;
- } else if (
- (i.component as MessageActionRowComponent).customId === "right"
- ) {
+ } else if ((i.component as MessageActionRowComponent).customId === "right") {
if (page < pages.length - 1) page++;
selectPaneOpen = false;
- } else if (
- (i.component as MessageActionRowComponent).customId === "select"
- ) {
+ } else if ((i.component as MessageActionRowComponent).customId === "select") {
selectPaneOpen = !selectPaneOpen;
- } else if (
- (i.component as MessageActionRowComponent).customId === "page"
- ) {
+ } else if ((i.component as MessageActionRowComponent).customId === "page") {
page = parseInt((i as SelectMenuInteraction).values[0]);
selectPaneOpen = false;
} else {
const em = new Discord.MessageEmbed(pages[page].embed);
- em.setDescription(
- em.description +
- "\n\n" +
- createPageIndicator(pages.length, page) +
- " | Message closed"
- );
+ em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page) + " | Message closed");
await interaction.editReply({
embeds: [em],
components: [
@@ -198,12 +185,7 @@
}
}
const em = new Discord.MessageEmbed(pages[page].embed);
- em.setDescription(
- em.description +
- "\n\n" +
- createPageIndicator(pages.length, page) +
- " | Message timed out"
- );
+ em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page) + " | Message timed out");
await interaction.editReply({
embeds: [em],
components: [
diff --git a/src/commands/ticket/close.ts b/src/commands/ticket/close.ts
index 71044dd..e2efcc3 100644
--- a/src/commands/ticket/close.ts
+++ b/src/commands/ticket/close.ts
@@ -2,8 +2,7 @@
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import close from "../../actions/tickets/delete.js";
-const command = (builder: SlashCommandSubcommandBuilder) =>
- builder.setName("close").setDescription("Closes a ticket");
+const command = (builder: SlashCommandSubcommandBuilder) => builder.setName("close").setDescription("Closes a ticket");
const callback = async (interaction: CommandInteraction): Promise<void> => {
await close(interaction);
diff --git a/src/commands/ticket/create.ts b/src/commands/ticket/create.ts
index 10ec842..3d0b5ce 100644
--- a/src/commands/ticket/create.ts
+++ b/src/commands/ticket/create.ts
@@ -7,10 +7,7 @@
.setName("create")
.setDescription("Creates a new modmail ticket")
.addStringOption((option) =>
- option
- .setName("message")
- .setDescription("The content of the ticket")
- .setRequired(false)
+ option.setName("message").setDescription("The content of the ticket").setRequired(false)
);
const callback = async (interaction: CommandInteraction): Promise<void> => {
diff --git a/src/commands/user/about.ts b/src/commands/user/about.ts
index 129359f..64c1ceb 100644
--- a/src/commands/user/about.ts
+++ b/src/commands/user/about.ts
@@ -9,10 +9,7 @@
MessageComponentInteraction,
SelectMenuInteraction
} from "discord.js";
-import {
- SelectMenuOption,
- SlashCommandSubcommandBuilder
-} from "@discordjs/builders";
+import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
import generateKeyValueList from "../../utils/generateKeyValueList.js";
@@ -24,11 +21,7 @@
.setName("about")
.setDescription("Shows info about a user")
.addUserOption((option) =>
- option
- .setName("user")
- .setDescription(
- "The user to get info about | Default: Yourself"
- )
+ option.setName("user").setDescription("The user to get info about | Default: Yourself")
);
class Embed {
@@ -57,8 +50,7 @@
const callback = async (interaction: CommandInteraction): Promise<void> => {
if (!interaction.guild) return;
const { renderUser, renderDelta } = client.logger;
- const member = (interaction.options.getMember("user") ??
- interaction.member) as Discord.GuildMember;
+ const member = (interaction.options.getMember("user") ?? interaction.member) as Discord.GuildMember;
const flags: string[] = [];
if (
[
@@ -72,9 +64,7 @@
}
if (
(await client.guilds.cache.get("684492926528651336")?.members.fetch())
- ?.filter((m: GuildMember) =>
- m.roles.cache.has("760896837866749972")
- )
+ ?.filter((m: GuildMember) => m.roles.cache.has("760896837866749972"))
?.map((m: GuildMember) => m.id)
.includes(member.user.id)
) {
@@ -115,9 +105,7 @@
});
const joinPos = membersArray.findIndex((m) => m.id === member.user.id);
- const roles = member.roles.cache
- .filter((r) => r.id !== interaction.guild!.id)
- .sort();
+ const roles = member.roles.cache.filter((r) => r.id !== interaction.guild!.id).sort();
let s = "";
let count = 0;
let ended = false;
@@ -149,12 +137,8 @@
MENTION_EVERYONE: "Mention Everyone"
};
Object.keys(permsArray).map((perm) => {
- const hasPerm = member.permissions.has(
- perm as Discord.PermissionString
- );
- perms += `${getEmojiByName(
- "CONTROL." + (hasPerm ? "TICK" : "CROSS")
- )} ${permsArray[perm]}\n`;
+ const hasPerm = member.permissions.has(perm as Discord.PermissionString);
+ perms += `${getEmojiByName("CONTROL." + (hasPerm ? "TICK" : "CROSS"))} ${permsArray[perm]}\n`;
});
let selectPaneOpen = false;
@@ -170,11 +154,7 @@
flags
.map((flag) => {
if (nameReplacements[flag]) {
- return (
- getEmojiByName(`BADGES.${flag}`) +
- " " +
- nameReplacements[flag]
- );
+ return getEmojiByName(`BADGES.${flag}`) + " " + nameReplacements[flag];
}
})
.join("\n") +
@@ -183,26 +163,16 @@
member: renderUser(member.user),
nickname: member.nickname || "*None set*",
id: `\`${member.id}\``,
- "joined the server": renderDelta(
- member.joinedTimestamp
- ),
- "joined discord": renderDelta(
- member.user.createdTimestamp
- ),
+ "joined the server": renderDelta(member.joinedTimestamp),
+ "joined discord": renderDelta(member.user.createdTimestamp),
"boost status": member.premiumSince
- ? `Started boosting ${renderDelta(
- member.premiumSinceTimestamp
- )}`
+ ? `Started boosting ${renderDelta(member.premiumSinceTimestamp)}`
: "*Not boosting*",
"join position": `${joinPos + 1}`
})
)
- .setThumbnail(
- member.user.displayAvatarURL({ dynamic: true })
- )
- .setImage(
- (await member.user.fetch()).bannerURL({ format: "gif" })
- )
+ .setThumbnail(member.user.displayAvatarURL({ dynamic: true }))
+ .setImage((await member.user.fetch()).bannerURL({ format: "gif" }))
)
.setTitle("General")
.setDescription("General information about the user")
@@ -223,9 +193,7 @@
(s.length > 0 ? s : "*None*") +
"\n"
)
- .setThumbnail(
- member.user.displayAvatarURL({ dynamic: true })
- )
+ .setThumbnail(member.user.displayAvatarURL({ dynamic: true }))
)
.setTitle("Roles")
.setDescription("Roles the user has")
@@ -244,9 +212,7 @@
"\n" +
perms
)
- .setThumbnail(
- member.user.displayAvatarURL({ dynamic: true })
- )
+ .setThumbnail(member.user.displayAvatarURL({ dynamic: true }))
)
.setTitle("Key Permissions")
.setDescription("Key permissions the user has")
@@ -261,9 +227,7 @@
let breakReason = "";
while (true) {
const em = new Discord.MessageEmbed(embeds[page].embed);
- em.setDescription(
- em.description + "\n" + createPageIndicator(embeds.length, page)
- );
+ em.setDescription(em.description + "\n" + createPageIndicator(embeds.length, page));
let selectPane = [];
if (selectPaneOpen) {
@@ -324,23 +288,15 @@
if ((i.component as MessageActionRowComponent).customId === "left") {
if (page > 0) page--;
selectPaneOpen = false;
- } else if (
- (i.component as MessageActionRowComponent).customId === "right"
- ) {
+ } else if ((i.component as MessageActionRowComponent).customId === "right") {
if (page < embeds.length - 1) page++;
selectPaneOpen = false;
- } else if (
- (i.component as MessageActionRowComponent).customId === "select"
- ) {
+ } else if ((i.component as MessageActionRowComponent).customId === "select") {
selectPaneOpen = !selectPaneOpen;
- } else if (
- (i.component as MessageActionRowComponent).customId === "close"
- ) {
+ } else if ((i.component as MessageActionRowComponent).customId === "close") {
breakReason = "Message closed";
break;
- } else if (
- (i.component as MessageActionRowComponent).customId === "page"
- ) {
+ } else if ((i.component as MessageActionRowComponent).customId === "page") {
page = parseInt((i as SelectMenuInteraction).values[0]);
selectPaneOpen = false;
} else {
@@ -349,13 +305,7 @@
}
}
const em = new Discord.MessageEmbed(embeds[page].embed);
- em.setDescription(
- em.description +
- "\n" +
- createPageIndicator(embeds.length, page) +
- " | " +
- breakReason
- );
+ em.setDescription(em.description + "\n" + createPageIndicator(embeds.length, page) + " | " + breakReason);
await interaction.editReply({
embeds: [em],
components: [
diff --git a/src/commands/user/avatar.ts b/src/commands/user/avatar.ts
index 502e9c8..a6c319d 100644
--- a/src/commands/user/avatar.ts
+++ b/src/commands/user/avatar.ts
@@ -10,17 +10,12 @@
.setName("avatar")
.setDescription("Shows the avatar of a user")
.addUserOption((option) =>
- option
- .setName("user")
- .setDescription(
- "The user to get the avatar of | Default: Yourself"
- )
+ option.setName("user").setDescription("The user to get the avatar of | Default: Yourself")
);
const callback = async (interaction: CommandInteraction): Promise<void> => {
const { renderUser } = client.logger;
- const member = (interaction.options.getMember("user") ??
- interaction.member) as Discord.GuildMember;
+ const member = (interaction.options.getMember("user") ?? interaction.member) as Discord.GuildMember;
await interaction.reply({
embeds: [
new EmojiEmbed()
@@ -40,10 +35,7 @@
});
};
-const check = (
- _interaction: CommandInteraction,
- _defaultCheck: WrappedCheck
-) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
return true;
};
diff --git a/src/commands/user/track.ts b/src/commands/user/track.ts
index 1a4c308..da62880 100644
--- a/src/commands/user/track.ts
+++ b/src/commands/user/track.ts
@@ -1,15 +1,6 @@
import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, {
- CommandInteraction,
- GuildMember,
- Message,
- MessageActionRow,
- MessageButton
-} from "discord.js";
-import {
- SelectMenuOption,
- SlashCommandSubcommandBuilder
-} from "@discordjs/builders";
+import Discord, { CommandInteraction, GuildMember, Message, MessageActionRow, MessageButton } from "discord.js";
+import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders";
// @ts-expect-error
import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -21,25 +12,13 @@
builder
.setName("track")
.setDescription("Moves a user along a role track")
- .addUserOption((option) =>
- option
- .setName("user")
- .setDescription("The user to manage")
- .setRequired(true)
- );
+ .addUserOption((option) => option.setName("user").setDescription("The user to manage").setRequired(true));
-const generateFromTrack = (
- position: number,
- active: string | boolean,
- size: number,
- disabled: string | boolean
-) => {
+const generateFromTrack = (position: number, active: string | boolean, size: number, disabled: string | boolean) => {
active = active ? "ACTIVE" : "INACTIVE";
disabled = disabled ? "GREY." : "";
- if (position === 0 && size === 1)
- return "TRACKS.SINGLE." + disabled + active;
- if (position === size - 1)
- return "TRACKS.VERTICAL.BOTTOM." + disabled + active;
+ if (position === 0 && size === 1) return "TRACKS.SINGLE." + disabled + active;
+ if (position === size - 1) return "TRACKS.VERTICAL.BOTTOM." + disabled + active;
if (position === 0) return "TRACKS.VERTICAL.TOP." + disabled + active;
return "TRACKS.VERTICAL.MIDDLE." + disabled + active;
};
@@ -66,25 +45,16 @@
const dropdown = new Discord.MessageSelectMenu()
.addOptions(
config.tracks.map((option, index) => {
- const hasRoleInTrack = option.track.some(
- (element: string) => {
- return memberRoles.cache.has(element);
- }
- );
+ const hasRoleInTrack = option.track.some((element: string) => {
+ return memberRoles.cache.has(element);
+ });
return new SelectMenuOption({
default: index === track,
label: option.name,
value: index.toString(),
- description:
- option.track.length === 0
- ? "No"
- : addPlural(option.track.length, "role"),
+ description: option.track.length === 0 ? "No" : addPlural(option.track.length, "role"),
emoji: client.emojis.resolve(
- getEmojiByName(
- "TRACKS.SINGLE." +
- (hasRoleInTrack ? "ACTIVE" : "INACTIVE"),
- "id"
- )
+ getEmojiByName("TRACKS.SINGLE." + (hasRoleInTrack ? "ACTIVE" : "INACTIVE"), "id")
)
});
})
@@ -92,17 +62,9 @@
.setCustomId("select")
.setMaxValues(1);
const allowed = [];
- generated =
- "**Track:** " +
- data.name +
- "\n" +
- "**Member:** " +
- renderUser(member.user) +
- "\n";
+ generated = "**Track:** " + data.name + "\n" + "**Member:** " + renderUser(member.user) + "\n";
generated +=
- (data.nullable
- ? "Members do not need a role in this track"
- : "A role in this track is required") + "\n";
+ (data.nullable ? "Members do not need a role in this track" : "A role in this track is required") + "\n";
generated +=
(data.retainPrevious
? "When promoted, the user keeps previous roles"
@@ -112,18 +74,12 @@
data.track
.map((role, index) => {
const allow =
- roles.get(role).position >=
- (interaction.member as GuildMember).roles.highest
- .position && !managed;
+ roles.get(role).position >= (interaction.member as GuildMember).roles.highest.position &&
+ !managed;
allowed.push(!allow);
return (
getEmojiByName(
- generateFromTrack(
- index,
- memberRoles.cache.has(role),
- data.track.length,
- allow
- )
+ generateFromTrack(index, memberRoles.cache.has(role), data.track.length, allow)
) +
" " +
roles.get(role).name +
@@ -141,15 +97,11 @@
let conflictDropdown;
let currentRoleIndex;
if (conflict) {
- generated += `\n\n${getEmojiByName(
- `PUNISH.WARN.${managed ? "YELLOW" : "RED"}`
- )} This user has ${selected.length} roles from this track. `;
+ generated += `\n\n${getEmojiByName(`PUNISH.WARN.${managed ? "YELLOW" : "RED"}`)} This user has ${
+ selected.length
+ } roles from this track. `;
conflictDropdown = [];
- if (
- roles.get(selected[0]).position <
- memberRoles.highest.position ||
- managed
- ) {
+ if (roles.get(selected[0]).position < memberRoles.highest.position || managed) {
generated +=
"In order to promote or demote this user, you must select which role the member should keep.";
selected.forEach((role) => {
@@ -172,10 +124,7 @@
"You don't have permission to manage one or more of the users roles, and therefore can't select one to keep.";
}
} else {
- currentRoleIndex =
- selected.length === 0
- ? -1
- : data.track.indexOf(selected[0].toString());
+ currentRoleIndex = selected.length === 0 ? -1 : data.track.indexOf(selected[0].toString());
}
const m = (await interaction.editReply({
embeds: [
@@ -187,13 +136,7 @@
],
components: [new MessageActionRow().addComponents(dropdown)]
.concat(
- conflict && conflictDropdown.length
- ? [
- new MessageActionRow().addComponents(
- conflictDropdown
- )
- ]
- : []
+ conflict && conflictDropdown.length ? [new MessageActionRow().addComponents(conflictDropdown)] : []
)
.concat([
new MessageActionRow().addComponents([
@@ -205,9 +148,7 @@
.setDisabled(
conflict ||
currentRoleIndex === 0 ||
- (currentRoleIndex === -1
- ? false
- : !allowed[currentRoleIndex - 1])
+ (currentRoleIndex === -1 ? false : !allowed[currentRoleIndex - 1])
),
new MessageButton()
.setEmoji(getEmojiByName("CONTROL.DOWN", "id"))
@@ -218,9 +159,7 @@
conflict ||
(data.nullable
? currentRoleIndex <= -1
- : currentRoleIndex ===
- data.track.length - 1 ||
- currentRoleIndex <= -1) ||
+ : currentRoleIndex === data.track.length - 1 || currentRoleIndex <= -1) ||
!allowed[currentRoleIndex]
)
])
@@ -234,9 +173,7 @@
}
component.deferUpdate();
if (component.customId === "conflict") {
- const rolesToRemove = selected.filter(
- (role) => role !== component.values[0]
- );
+ const rolesToRemove = selected.filter((role) => role !== component.values[0]);
await member.roles.remove(rolesToRemove);
} else if (component.customId === "promote") {
if (
@@ -247,16 +184,14 @@
if (currentRoleIndex === -1) {
await member.roles.add(data.track[data.track.length - 1]);
} else if (currentRoleIndex < data.track.length) {
- if (!data.retainPrevious)
- await member.roles.remove(data.track[currentRoleIndex]);
+ if (!data.retainPrevious) await member.roles.remove(data.track[currentRoleIndex]);
await member.roles.add(data.track[currentRoleIndex - 1]);
}
}
} else if (component.customId === "demote") {
if (allowed[currentRoleIndex]) {
if (currentRoleIndex === data.track.length - 1) {
- if (data.nullable)
- await member.roles.remove(data.track[currentRoleIndex]);
+ if (data.nullable) await member.roles.remove(data.track[currentRoleIndex]);
} else if (currentRoleIndex > -1) {
await member.roles.remove(data.track[currentRoleIndex]);
await member.roles.add(data.track[currentRoleIndex + 1]);
@@ -268,14 +203,9 @@
}
};
-const check = async (
- interaction: CommandInteraction,
- _defaultCheck: WrappedCheck
-) => {
- const tracks = (await client.database.guilds.read(interaction.guild.id))
- .tracks;
- if (tracks.length === 0)
- throw new Error("This server does not have any tracks");
+const check = async (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
+ const tracks = (await client.database.guilds.read(interaction.guild.id)).tracks;
+ if (tracks.length === 0) throw new Error("This server does not have any tracks");
const member = interaction.member as GuildMember;
// Allow the owner to promote anyone
if (member.id === interaction.guild.ownerId) return true;
@@ -283,12 +213,7 @@
let managed = false;
for (const element of tracks) {
if (!element.track.manageableBy) continue;
- if (
- !element.track.manageableBy.some((role) =>
- member.roles.cache.has(role)
- )
- )
- continue;
+ if (!element.track.manageableBy.some((role) => member.roles.cache.has(role))) continue;
managed = true;
break;
}
diff --git a/src/commands/verify.ts b/src/commands/verify.ts
index 2319284..f2c9c9d 100644
--- a/src/commands/verify.ts
+++ b/src/commands/verify.ts
@@ -4,18 +4,13 @@
import { WrappedCheck } from "jshaiku";
import verify from "../reflex/verify.js";
-const command = new SlashCommandBuilder()
- .setName("verify")
- .setDescription("Get verified in the server");
+const command = new SlashCommandBuilder().setName("verify").setDescription("Get verified in the server");
const callback = async (interaction: CommandInteraction): Promise<void> => {
verify(interaction);
};
-const check = (
- _interaction: CommandInteraction,
- _defaultCheck: WrappedCheck
-) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
return true;
};