I hereby decree that this document shall no longer contain the substring " == ", and hereafter shall be referred to as " === ". This amendment shall take effect immediately.
Signed-off-by: pineafan <pineapplefanyt@gmail.com>
diff --git a/src/actions/createModActionTicket.ts b/src/actions/createModActionTicket.ts
index 40f99b9..72ba011 100644
--- a/src/actions/createModActionTicket.ts
+++ b/src/actions/createModActionTicket.ts
@@ -16,7 +16,7 @@
deny: ["VIEW_CHANNEL"],
type: "role"
})
- if (config.tickets.supportRole != null) {
+ if (config.tickets.supportRole !== null) {
overwrites.push({
id: guild.roles.cache.get(config.tickets.supportRole),
allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
@@ -40,10 +40,10 @@
try {
await c.send(
{
- content: (`<@${member.id}>` + (config.tickets.supportRole != null ? ` • <@&${config.tickets.supportRole}>` : "")),
+ content: (`<@${member.id}>` + (config.tickets.supportRole !== null ? ` • <@&${config.tickets.supportRole}>` : "")),
allowedMentions: {
users: [member.id],
- roles: (config.tickets.supportRole != null ? [config.tickets.supportRole] : [])
+ roles: (config.tickets.supportRole !== null ? [config.tickets.supportRole] : [])
}
}
)
@@ -51,7 +51,7 @@
.setTitle("New Ticket")
.setDescription(
`Ticket created by a Moderator\n` +
- `**Support type:** Appeal submission\n` + (reason != null ? `**Reason:**\n> ${reason}\n` : "") +
+ `**Support type:** Appeal submission\n` + (reason !== null ? `**Reason:**\n> ${reason}\n` : "") +
`**Ticket ID:** \`${c.id}\`\n` +
`Type \`/ticket close\` to close this ticket.`,
)
diff --git a/src/actions/roleMenu.ts b/src/actions/roleMenu.ts
index a4397a3..7432a3a 100644
--- a/src/actions/roleMenu.ts
+++ b/src/actions/roleMenu.ts
@@ -3,6 +3,7 @@
import { MessageActionRow, MessageSelectMenu } from 'discord.js';
import getEmojiByName from "../utils/getEmojiByName.js";
import client from "../utils/client.js";
+import { LoadingEmbed } from "../utils/defaultEmbeds.js";
export async function callback(interaction) {
let config = await client.database.guilds.read(interaction.guild.id);
@@ -18,12 +19,7 @@
.setStatus("Danger")
.setEmoji("CONTROL.BLOCKCROSS")
], ephemeral: true})
- await interaction.reply({embeds: [new EmojiEmbed()
- .setTitle("Roles")
- .setDescription("Loading...")
- .setStatus("Success")
- .setEmoji("NUCLEUS.LOADING")
- ], ephemeral: true})
+ await interaction.reply({embeds: LoadingEmbed, ephemeral: true})
let m;
if (config.roleMenu.allowWebUI) {
let code = ""
@@ -54,7 +50,7 @@
let up = true
try {
let status = await fetch(client.config.baseUrl).then(res => res.status);
- if (status != 200) up = false
+ if (status !== 200) up = false
} catch { up = false }
m = await interaction.editReply({
embeds: [new EmojiEmbed()
@@ -88,7 +84,7 @@
.setTitle("Roles")
.setEmoji("GUILD.GREEN")
.setDescription(`**${object.name}**` + (object.description ? `\n${object.description}` : ``) +
- `\n\nSelect ${object.min}` + (object.min != object.max ? ` to ${object.max}` : ``) + ` role${object.max == 1 ? '' : 's'} to add.`)
+ `\n\nSelect ${object.min}` + (object.min !== object.max ? ` to ${object.max}` : ``) + ` role${object.max === 1 ? '' : 's'} to add.`)
.setStatus("Success")
.setFooter({text: `Step ${i + 1}/${config.roleMenu.options.length}`})
],
@@ -99,7 +95,7 @@
.setStyle("DANGER")
.setCustomId("cancel")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
- ].concat(object.min == 0 ? [
+ ].concat(object.min === 0 ? [
new MessageButton()
.setLabel("Skip")
.setStyle("SECONDARY")
@@ -121,9 +117,9 @@
return
}
component.deferUpdate()
- if (component.customId == "rolemenu") {
+ if (component.customId === "rolemenu") {
rolesToAdd = rolesToAdd.concat(component.values)
- } else if (component.customId == "cancel") {
+ } else if (component.customId === "cancel") {
return await interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Roles")
.setDescription("Cancelled. No changes were made.")
diff --git a/src/actions/tickets/create.ts b/src/actions/tickets/create.ts
index e21aa3e..722eb3f 100644
--- a/src/actions/tickets/create.ts
+++ b/src/actions/tickets/create.ts
@@ -24,7 +24,7 @@
let category = interaction.guild.channels.cache.get(config.tickets.category) as Discord.CategoryChannel;
let count = 0;
category.children.forEach(element => {
- if (!(element.type == "GUILD_TEXT")) return;
+ if (!(element.type === "GUILD_TEXT")) return;
if ((element as Discord.TextChannel).topic.includes(`${interaction.member.user.id}`)) {
if ((element as Discord.TextChannel).topic.endsWith("Active")) {
count++;
@@ -84,13 +84,13 @@
if (custom) {
return new MessageButton()
.setLabel(type)
- .setStyle(chosenType == type ? "SUCCESS" : "SECONDARY")
+ .setStyle(chosenType === type ? "SUCCESS" : "SECONDARY")
.setCustomId(type)
.setDisabled(true)
} else {
return new MessageButton()
.setLabel(capitalize(type))
- .setStyle(chosenType == type ? "SUCCESS" : "SECONDARY")
+ .setStyle(chosenType === type ? "SUCCESS" : "SECONDARY")
.setCustomId(type)
.setEmoji(getEmojiByName(("TICKETS." + type.toString().toUpperCase()), "id"))
.setDisabled(true)
@@ -122,7 +122,7 @@
deny: ["VIEW_CHANNEL"],
type: "role"
})
- if (config.tickets.supportRole != null) {
+ if (config.tickets.supportRole !== null) {
overwrites.push({
id: interaction.guild.roles.cache.get(config.tickets.supportRole),
allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
@@ -151,10 +151,10 @@
try {
await c.send(
{
- content: (`<@${interaction.member.user.id}>` + (config.tickets.supportRole != null ? ` • <@&${config.tickets.supportRole}>` : "")),
+ content: (`<@${interaction.member.user.id}>` + (config.tickets.supportRole !== null ? ` • <@&${config.tickets.supportRole}>` : "")),
allowedMentions: {
users: [(interaction.member as Discord.GuildMember).id],
- roles: (config.tickets.supportRole != null ? [config.tickets.supportRole] : [])
+ roles: (config.tickets.supportRole !== null ? [config.tickets.supportRole] : [])
}
}
)
@@ -165,7 +165,7 @@
.setTitle("New Ticket")
.setDescription(
`Ticket created by <@${interaction.member.user.id}>\n` +
- `**Support type:** ${chosenType != null ? (emoji) + " " + capitalize(chosenType) : "General"}\n` +
+ `**Support type:** ${chosenType !== null ? (emoji) + " " + capitalize(chosenType) : "General"}\n` +
`**Ticket ID:** \`${c.id}\`\n${content}\n` +
`Type \`/ticket close\` to close this ticket.`,
)
diff --git a/src/actions/tickets/delete.ts b/src/actions/tickets/delete.ts
index c14cf0c..d86396a 100644
--- a/src/actions/tickets/delete.ts
+++ b/src/actions/tickets/delete.ts
@@ -10,7 +10,7 @@
let thread = false; let threadChannel
if (interaction.channel instanceof Discord.ThreadChannel) thread = true; threadChannel = interaction.channel as Discord.ThreadChannel
let channel = (interaction.channel as Discord.TextChannel)
- if (!channel.parent || config.tickets.category != channel.parent.id || (thread ? (threadChannel.parent.parent.id != config.tickets.category) : false)) {
+ if (!channel.parent || config.tickets.category !== channel.parent.id || (thread ? (threadChannel.parent.parent.id !== config.tickets.category) : false)) {
return interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Deleting Ticket...")
.setDescription("This ticket is not in your tickets category, so cannot be deleted. You cannot run close in a thread.")
@@ -19,7 +19,7 @@
], ephemeral: true});
}
let status = channel.topic.split(" ")[1];
- if (status == "Archived") {
+ if (status === "Archived") {
await interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Delete Ticket")
.setDescription("Your ticket is being deleted...")
@@ -47,7 +47,7 @@
log(data);
interaction.channel.delete();
return;
- } else if (status == "Active") {
+ } else if (status === "Active") {
await interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Close Ticket")
.setDescription("Your ticket is being closed...")
@@ -66,7 +66,7 @@
type: "role"
}
] as Discord.OverwriteResolvable[];
- if (config.tickets.supportRole != null) {
+ if (config.tickets.supportRole !== null) {
overwrites.push({
id: interaction.guild.roles.cache.get(config.tickets.supportRole),
allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
@@ -127,8 +127,8 @@
let ticketChannels = tickets.children;
let deleted = 0
ticketChannels.forEach(element => {
- if (element.type != "GUILD_TEXT") return;
- if (element.topic.split(" ")[0] == member) {
+ if (element.type !== "GUILD_TEXT") return;
+ if (element.topic.split(" ")[0] === member) {
try { element.delete(); } catch {}
deleted++
}