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/commands/mod/ban.ts b/src/commands/mod/ban.ts
index 2068b15..5da8693 100644
--- a/src/commands/mod/ban.ts
+++ b/src/commands/mod/ban.ts
@@ -104,7 +104,7 @@
if (dmd) await dm.delete()
return
}
- let failed = (dmd == false && notify)
+ let failed = (dmd === false && notify)
await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji(`PUNISH.BAN.${failed ? "YELLOW" : "GREEN"}`)
.setTitle(`Ban`)
@@ -125,20 +125,20 @@
let member = (interaction.member as GuildMember)
let me = (interaction.guild.me as GuildMember)
let 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"
let memberPos = member.roles ? member.roles.highest.position : 0
let mePos = me.roles ? me.roles.highest.position : 0
let applyPos = apply.roles ? apply.roles.highest.position : 0
// Check if Nucleus can ban the 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"
+ 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
+ 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"
// Allow ban
diff --git a/src/commands/mod/info.ts b/src/commands/mod/info.ts
index 0ea93d8..c50c6f4 100644
--- a/src/commands/mod/info.ts
+++ b/src/commands/mod/info.ts
@@ -143,7 +143,7 @@
let 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"
+ ) + (currentYear === new Date().getFullYear() ? monthNames[new Date().getMonth()] : "December"
) + " " + currentYear.toString()
if (groups.length > 0) {
let toRender = groups[Math.min(pageIndex, groups.length - 1)]
@@ -204,8 +204,8 @@
let member = (interaction.options.getMember("user")) as Discord.GuildMember;
await interaction.reply({embeds: [new EmojiEmbed()
.setEmoji("NUCLEUS.LOADING")
- .setTitle("Downloading data...")
- .setStatus("Success")
+ .setTitle("Downloading Data")
+ .setStatus("Danger")
], ephemeral: true, fetchReply: true});
let note;
let firstLoad = true;
@@ -260,7 +260,7 @@
});
let out;
try {
- out = await modalInteractionCollector(m, (m) => m.channel.id == interaction.channel.id, (m) => m.customId == "modify")
+ out = await modalInteractionCollector(m, (m) => m.channel.id === interaction.channel.id, (m) => m.customId === "modify")
} catch (e) { continue }
if (out.fields) {
let toAdd = out.fields.getTextInputValue("note") || null;
@@ -275,7 +275,7 @@
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
let 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 eac7ca3..a0b9a97 100644
--- a/src/commands/mod/kick.ts
+++ b/src/commands/mod/kick.ts
@@ -103,7 +103,7 @@
if (dmd) await dm.delete()
return
}
- let failed = (dmd == false && notify)
+ let failed = (dmd === false && notify)
await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji(`PUNISH.KICK.${failed ? "YELLOW" : "GREEN"}`)
.setTitle(`Kick`)
@@ -124,20 +124,20 @@
let member = (interaction.member as GuildMember)
let me = (interaction.guild.me as GuildMember)
let 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"
let memberPos = member.roles ? member.roles.highest.position : 0
let mePos = me.roles ? me.roles.highest.position : 0
let applyPos = apply.roles ? apply.roles.highest.position : 0
// Check if Nucleus can kick the 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"
+ 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
+ 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"
// Allow kick
diff --git a/src/commands/mod/mute.ts b/src/commands/mod/mute.ts
index f98bd6a..8bb6854 100644
--- a/src/commands/mod/mute.ts
+++ b/src/commands/mod/mute.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../utils/defaultEmbeds.js';
import Discord, { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
@@ -33,7 +34,7 @@
if (config.moderation.mute.role) serverSettingsDescription += (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
- if (muteTime == 0) {
+ if (muteTime === 0) {
let m = await interaction.reply({embeds: [
new EmojiEmbed()
.setEmoji("PUNISH.MUTE.GREEN")
@@ -90,7 +91,7 @@
component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
} catch { return }
component.deferUpdate();
- if (component.customId == "cancel") return interaction.editReply({embeds: [new EmojiEmbed()
+ if (component.customId === "cancel") return interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji("PUNISH.MUTE.RED")
.setTitle("Mute")
.setDescription("Mute cancelled")
@@ -107,13 +108,7 @@
case "1w": { muteTime = 60 * 60 * 24 * 7; break; }
}
} else {
- await interaction.reply({embeds: [
- new EmojiEmbed()
- .setEmoji("PUNISH.MUTE.GREEN")
- .setTitle("Mute")
- .setDescription("Loading...")
- .setStatus("Success")
- ], ephemeral: true, fetchReply: true})
+ await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true})
}
// TODO:[Modals] Replace this with a modal
let reason = null;
@@ -199,7 +194,7 @@
})
}
} catch (e){ console.log(e); errors++ }
- if (errors == 2) {
+ if (errors === 2) {
await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji("PUNISH.MUTE.RED")
.setTitle(`Mute`)
@@ -210,7 +205,7 @@
return
}
try { await client.database.history.create("mute", interaction.guild.id, member.user, interaction.user, reason) } catch {}
- let failed = (dmd == false && notify)
+ let failed = (dmd === false && notify)
await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji(`PUNISH.MUTE.${failed ? "YELLOW" : "GREEN"}`)
.setTitle(`Mute`)
@@ -253,22 +248,22 @@
let member = (interaction.member as GuildMember)
let me = (interaction.guild.me as GuildMember)
let 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"
let memberPos = member.roles ? member.roles.highest.position : 0
let mePos = me.roles ? me.roles.highest.position : 0
let applyPos = apply.roles ? apply.roles.highest.position : 0
// Check if Nucleus can mute the 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 the user to have admin or be the owner
- if (apply.permissions.has("ADMINISTRATOR") || (interaction.options.getMember("user") as GuildMember).id == interaction.guild.ownerId) throw "You cannot mute an admin or the owner"
+ if (apply.permissions.has("ADMINISTRATOR") || (interaction.options.getMember("user") as GuildMember).id === interaction.guild.ownerId) throw "You cannot mute an admin or the owner"
// Do not allow muting Nucleus
- if (member.id == me.id) throw "I cannot mute myself"
+ if (member.id === me.id) throw "I cannot mute myself"
// Allow the owner to mute anyone
- if (member.id == interaction.guild.ownerId) return true
+ 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"
// Allow mute
diff --git a/src/commands/mod/nick.ts b/src/commands/mod/nick.ts
index 3ff18ec..cf33109 100644
--- a/src/commands/mod/nick.ts
+++ b/src/commands/mod/nick.ts
@@ -96,7 +96,7 @@
if (dmd) await dm.delete()
return
}
- let failed = (dmd == false && notify)
+ let failed = (dmd === false && notify)
await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji(`PUNISH.NICKNAME.${failed ? "YELLOW" : "GREEN"}`)
.setTitle(`Nickname`)
@@ -117,20 +117,20 @@
let member = (interaction.member as GuildMember)
let me = (interaction.guild.me as GuildMember)
let 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"
let memberPos = member.roles ? member.roles.highest.position : 0
let mePos = me.roles ? me.roles.highest.position : 0
let applyPos = apply.roles ? apply.roles.highest.position : 0
// Check if Nucleus can change the nickname
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
+ 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
+ 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"
// Allow change
diff --git a/src/commands/mod/purge.ts b/src/commands/mod/purge.ts
index af7beb3..e1e4de9 100644
--- a/src/commands/mod/purge.ts
+++ b/src/commands/mod/purge.ts
@@ -314,11 +314,11 @@
let member = (interaction.member as GuildMember)
let me = (interaction.guild.me as GuildMember)
// Allow the owner to purge
- if (member.id == interaction.guild.ownerId) return true
+ 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";
// 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 warn
return true
}
diff --git a/src/commands/mod/slowmode.ts b/src/commands/mod/slowmode.ts
index 2b386fd..6b33e12 100644
--- a/src/commands/mod/slowmode.ts
+++ b/src/commands/mod/slowmode.ts
@@ -62,9 +62,9 @@
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
let member = (interaction.member as GuildMember)
// Check if Nucleus can set the slowmode
- if (! interaction.guild.me.permissions.has("MANAGE_CHANNELS")) throw "I do not have the Manage channels permission";
+ if (! interaction.guild.me.permissions.has("MANAGE_CHANNELS")) throw "I do not have the *Manage Channels* permission";
// Check if the user has manage_channel permission
- if (! member.permissions.has("MANAGE_CHANNELS")) throw "You do not have the Manage channels permission";
+ if (! member.permissions.has("MANAGE_CHANNELS")) throw "You do not have the *Manage Channels* permission";
// Allow slowmode
return true
}
diff --git a/src/commands/mod/softban.ts b/src/commands/mod/softban.ts
index 7fefb1b..5c7e8c4 100644
--- a/src/commands/mod/softban.ts
+++ b/src/commands/mod/softban.ts
@@ -81,7 +81,7 @@
], components: []})
}
try { await client.database.history.create("softban", interaction.guild.id, member.user, reason) } catch {}
- let failed = (dmd == false && notify)
+ let failed = (dmd === false && notify)
await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji(`PUNISH.BAN.${failed ? "YELLOW" : "GREEN"}`)
.setTitle(`Softban`)
@@ -102,20 +102,20 @@
let member = (interaction.member as GuildMember)
let me = (interaction.guild.me as GuildMember)
let 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"
let memberPos = member.roles ? member.roles.highest.position : 0
let mePos = me.roles ? me.roles.highest.position : 0
let applyPos = apply.roles ? apply.roles.highest.position : 0
// Check if Nucleus can ban the 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"
+ if (member.id === me.id) throw "I cannot softban myself"
// Allow the owner to ban anyone
- if (member.id == interaction.guild.ownerId) return true
+ 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"
// Allow softban
diff --git a/src/commands/mod/unban.ts b/src/commands/mod/unban.ts
index 035b809..2605d28 100644
--- a/src/commands/mod/unban.ts
+++ b/src/commands/mod/unban.ts
@@ -15,9 +15,9 @@
const callback = async (interaction: CommandInteraction): Promise<any> => {
let bans = await interaction.guild.bans.fetch()
let 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())
+ 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) {
return interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Unban")
@@ -92,11 +92,11 @@
let member = (interaction.member as GuildMember)
let me = (interaction.guild.me as GuildMember)
// 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
+ 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 56a0b56..25aacfa 100644
--- a/src/commands/mod/unmute.ts
+++ b/src/commands/mod/unmute.ts
@@ -89,7 +89,7 @@
}
}
log(data);
- let failed = (dmd == false && notify)
+ let failed = (dmd === false && notify)
await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji(`PUNISH.MUTE.${failed ? "YELLOW" : "GREEN"}`)
.setTitle(`Unmute`)
@@ -110,20 +110,20 @@
let member = (interaction.member as GuildMember)
let me = (interaction.guild.me as GuildMember)
let 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"
let memberPos = member.roles ? member.roles.highest.position : 0
let mePos = me.roles ? me.roles.highest.position : 0
let applyPos = apply.roles ? apply.roles.highest.position : 0
// Check if Nucleus can unmute the 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";
// Do not allow the user to have admin or be the owner
- if (apply.permissions.has("ADMINISTRATOR") || apply.id == interaction.guild.ownerId) throw "You cannot unmute an admin or the owner"
+ if (apply.permissions.has("ADMINISTRATOR") || apply.id === interaction.guild.ownerId) throw "You cannot unmute an admin or the owner"
// Allow the owner to unmute anyone
- if (member.id == interaction.guild.ownerId) return true
+ 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"
// Allow unmute
diff --git a/src/commands/mod/viewas.ts b/src/commands/mod/viewas.ts
index 684fc3a..2f5cacc 100644
--- a/src/commands/mod/viewas.ts
+++ b/src/commands/mod/viewas.ts
@@ -51,7 +51,7 @@
`**${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"
+ 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` + (() => {
@@ -98,7 +98,7 @@
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
let 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 3e76321..5a42911 100644
--- a/src/commands/mod/warn.ts
+++ b/src/commands/mod/warn.ts
@@ -98,7 +98,7 @@
interaction.user, reason
)} catch {}
log(data);
- let failed = (dmd == false && notify)
+ let failed = (dmd === false && notify)
if (!failed) {
await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji(`PUNISH.WARN.GREEN`)
@@ -138,7 +138,7 @@
.setStatus("Success")
], components: []})
}
- if ( component.customId == "here" ) {
+ if ( component.customId === "here" ) {
await interaction.channel.send({
embeds: [new EmojiEmbed()
.setEmoji(`PUNISH.WARN.RED`)
@@ -179,16 +179,16 @@
let member = (interaction.member as GuildMember)
let me = (interaction.guild.me as GuildMember)
let 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"
let memberPos = member.roles ? member.roles.highest.position : 0
let mePos = me.roles ? me.roles.highest.position : 0
let applyPos = apply.roles ? apply.roles.highest.position : 0
// Do not allow warning bots
if (member.user.bot) throw "I cannot warn bots"
// Allow the owner to warn anyone
- if (member.id == interaction.guild.ownerId) return true
+ 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"
// Allow warn