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/settings/commands.ts b/src/commands/settings/commands.ts
index df2cdb4..23d5c66 100644
--- a/src/commands/settings/commands.ts
+++ b/src/commands/settings/commands.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../utils/defaultEmbeds.js';
import Discord, { CommandInteraction, MessageActionRow, MessageButton, TextInputComponent } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
@@ -15,11 +16,7 @@
.addRoleOption(o => o.setName("role").setDescription("The role given when a member is muted"))
const callback = async (interaction: CommandInteraction): Promise<any> => {
- await interaction.reply({embeds: [new EmojiEmbed()
- .setTitle("Loading")
- .setStatus("Danger")
- .setEmoji("NUCLEUS.LOADING")
- ], ephemeral: true, fetchReply: true});
+ await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
let m;
let clicked = "";
if (interaction.options.getRole("role")) {
@@ -49,7 +46,7 @@
.setEmoji("PUNISH.BAN.GREEN")
.setStatus("Success")
.setDescription(
- "These links are shown below the message sent in a user's DM when they are warned, banned, etc.\n\n" +
+ "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*")
)
], components: [new MessageActionRow().addComponents([
@@ -76,13 +73,16 @@
} catch (e) { return }
let chosen = moderation[i.customId] ?? {text: null, url: null};
if (i.component.customId === "clearMuteRole") {
+ i.deferUpdate()
if (clicked === "clearMuteRole") {
- await client.database.guilds.write(interaction.guild.id, { moderation: { mute: { role: null } } });
+ await client.database.guilds.write(interaction.guild.id, {"moderation.mute.role": null });
} else { clicked = "clearMuteRole" }
+ continue
} else { clicked = "" }
if (i.component.customId === "timeout") {
await i.deferUpdate()
- await client.database.guilds.write(interaction.guild.id, { moderation: { mute: { timeout: !moderation.mute.timeout } } });
+ await client.database.guilds.write(interaction.guild.id, {"moderation.mute.timeout": !moderation.mute.timeout } );
+ continue
} else if (i.customId) {
await i.showModal(new Discord.Modal().setCustomId("modal").setTitle(`Options for ${i.customId}`).addComponents(
new MessageActionRow<TextInputComponent>().addComponents(new TextInputComponent()
@@ -117,7 +117,7 @@
});
let out;
try {
- out = await modalInteractionCollector(m, (m) => m.channel.id == interaction.channel.id, (m) => true)
+ out = await modalInteractionCollector(m, (m) => m.channel.id === interaction.channel.id, (m) => true)
} catch (e) { continue }
if (out.fields) {
let buttonText = out.fields.getTextInputValue("name");
@@ -125,7 +125,7 @@
let current = chosen;
if (current.text !== buttonText || current.link !== buttonLink) {
chosen = { text: buttonText, link: buttonLink };
- await client.database.guilds.write(interaction.guild.id, { ["moderation" + i.customId]: { text: buttonText, link: buttonLink }});
+ await client.database.guilds.write(interaction.guild.id, { ["moderation." + i.customId]: { text: buttonText, link: buttonLink }});
}
} else { continue }
}
@@ -135,7 +135,7 @@
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
let member = (interaction.member as Discord.GuildMember)
- if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the Manage server permission to use this command"
+ if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the *Manage Server* permission to use this command"
return true;
}
diff --git a/src/commands/settings/logs/attachment.ts b/src/commands/settings/logs/attachment.ts
index 0842923..2dae74e 100644
--- a/src/commands/settings/logs/attachment.ts
+++ b/src/commands/settings/logs/attachment.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../../utils/defaultEmbeds.js';
import { ChannelType } from 'discord-api-types';
import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
@@ -17,11 +18,7 @@
const callback = async (interaction: CommandInteraction): Promise<any> => {
let m;
- m = await interaction.reply({embeds: [new EmojiEmbed()
- .setTitle("Loading")
- .setStatus("Danger")
- .setEmoji("NUCLEUS.LOADING")
- ], ephemeral: true, fetchReply: true});
+ m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
if (interaction.options.getChannel("channel")) {
let channel
try {
@@ -35,7 +32,7 @@
]})
}
channel = channel as Discord.TextChannel
- if (channel.guild.id != interaction.guild.id) {
+ if (channel.guild.id !== interaction.guild.id) {
return interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Attachment Log Channel")
.setDescription(`You must choose a channel in this server`)
@@ -120,11 +117,11 @@
i = await m.awaitMessageComponent({time: 300000});
} catch(e) { break }
i.deferUpdate()
- if (i.component.customId == "clear") {
+ if (i.component.customId === "clear") {
clicks += 1;
- if (clicks == 2) {
+ if (clicks === 2) {
clicks = 0;
- await client.database.guilds.write(interaction.guild.id, {}, ["logging.announcements.channel"])
+ await client.database.guilds.write(interaction.guild.id, null, ["logging.announcements.channel"])
channel = undefined;
}
} else {
@@ -148,7 +145,7 @@
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
let member = (interaction.member as Discord.GuildMember)
- if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the Manage Server permission to use this command"
+ if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the *Manage Server* permission to use this command"
return true;
}
diff --git a/src/commands/settings/logs/channel.ts b/src/commands/settings/logs/channel.ts
index aacc2e7..4030108 100644
--- a/src/commands/settings/logs/channel.ts
+++ b/src/commands/settings/logs/channel.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../../utils/defaultEmbeds.js';
import { ChannelType } from 'discord-api-types';
import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
@@ -17,11 +18,7 @@
const callback = async (interaction: CommandInteraction): Promise<any> => {
let m;
- m = await interaction.reply({embeds: [new EmojiEmbed()
- .setTitle("Loading")
- .setStatus("Danger")
- .setEmoji("NUCLEUS.LOADING")
- ], ephemeral: true, fetchReply: true});
+ m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
if (interaction.options.getChannel("channel")) {
let channel
try {
@@ -35,7 +32,7 @@
]})
}
channel = channel as Discord.TextChannel
- if (channel.guild.id != interaction.guild.id) {
+ if (channel.guild.id !== interaction.guild.id) {
return interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Log Channel")
.setDescription(`You must choose a channel in this server`)
@@ -115,11 +112,11 @@
i = await m.awaitMessageComponent({time: 300000});
} catch(e) { break }
i.deferUpdate()
- if (i.component.customId == "clear") {
+ if (i.component.customId === "clear") {
clicks += 1;
- if (clicks == 2) {
+ if (clicks === 2) {
clicks = 0;
- await client.database.guilds.write(interaction.guild.id, {}, ["logging.logs.channel"])
+ await client.database.guilds.write(interaction.guild.id, null, ["logging.logs.channel"])
channel = undefined;
}
} else {
@@ -143,7 +140,7 @@
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
let member = (interaction.member as Discord.GuildMember)
- if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the Manage Server permission to use this command"
+ if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the *Manage Server* permission to use this command"
return true;
}
diff --git a/src/commands/settings/logs/staff.ts b/src/commands/settings/logs/staff.ts
index 3cb7230..5867338 100644
--- a/src/commands/settings/logs/staff.ts
+++ b/src/commands/settings/logs/staff.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../../utils/defaultEmbeds.js';
import { ChannelType } from 'discord-api-types';
import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
@@ -17,11 +18,7 @@
const callback = async (interaction: CommandInteraction): Promise<any> => {
let m;
- m = await interaction.reply({embeds: [new EmojiEmbed()
- .setTitle("Loading")
- .setStatus("Danger")
- .setEmoji("NUCLEUS.LOADING")
- ], ephemeral: true, fetchReply: true});
+ m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
if (interaction.options.getChannel("channel")) {
let channel
try {
@@ -35,7 +32,7 @@
]})
}
channel = channel as Discord.TextChannel
- if (channel.guild.id != interaction.guild.id) {
+ if (channel.guild.id !== interaction.guild.id) {
return interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Staff Notifications Channel")
.setDescription(`You must choose a channel in this server`)
@@ -117,11 +114,11 @@
i = await m.awaitMessageComponent({time: 300000});
} catch(e) { break }
i.deferUpdate()
- if (i.component.customId == "clear") {
+ if (i.component.customId === "clear") {
clicks += 1;
- if (clicks == 2) {
+ if (clicks === 2) {
clicks = 0;
- await client.database.guilds.write(interaction.guild.id, {}, ["logging.staff.channel"])
+ await client.database.guilds.write(interaction.guild.id, null, ["logging.staff.channel"])
channel = undefined;
}
} else {
@@ -145,7 +142,7 @@
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
let member = (interaction.member as Discord.GuildMember)
- if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the Manage Server permission to use this command"
+ if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the *Manage Server* permission to use this command"
return true;
}
diff --git a/src/commands/settings/rolemenu.ts b/src/commands/settings/rolemenu.ts
index ec54820..6f95b46 100644
--- a/src/commands/settings/rolemenu.ts
+++ b/src/commands/settings/rolemenu.ts
@@ -17,7 +17,7 @@
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
let member = (interaction.member as Discord.GuildMember)
- if (!member.permissions.has("MANAGE_ROLES")) throw "You must have the Manage roles permission to use this command"
+ if (!member.permissions.has("MANAGE_ROLES")) throw "You must have the *Manage Roles* permission to use this command"
return true;
}
diff --git a/src/commands/settings/stats.ts b/src/commands/settings/stats.ts
index 3159e2d..d972674 100644
--- a/src/commands/settings/stats.ts
+++ b/src/commands/settings/stats.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../utils/defaultEmbeds.js';
import { ChannelType } from 'discord-api-types';
import Discord, { AutocompleteInteraction, CommandInteraction, Message, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -8,6 +9,7 @@
import client from "../../utils/client.js";
import convertCurlyBracketString from '../../utils/convertCurlyBracketString.js';
import {callback as statsChannelAddCallback} from "../../reflex/statsChannelUpdate.js";
+import singleNotify from '../../utils/singleNotify.js';
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
@@ -17,14 +19,20 @@
.addStringOption(option => option.setName("name").setDescription("The new channel name | Enter any text or use the extra variables like {memberCount}").setAutocomplete(true))
const callback = async (interaction: CommandInteraction): Promise<any> => {
+ singleNotify("statsChannelDeleted", interaction.guild.id, true)
let m;
- m = await interaction.reply({embeds: [new EmojiEmbed()
- .setTitle("Loading")
- .setStatus("Danger")
- .setEmoji("NUCLEUS.LOADING")
- ], ephemeral: true, fetchReply: true});
+ m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
+ let config = await client.database.guilds.read(interaction.guild.id);
if (interaction.options.getString("name")) {
- let channel
+ let channel;
+ if (Object.keys(config.getKey("stats")).length >= 25) {
+ return await interaction.editReply({embeds: [new EmojiEmbed()
+ .setEmoji("CHANNEL.TEXT.DELETE")
+ .setTitle("Stats Channel")
+ .setDescription("You can only have 25 stats channels in a server")
+ .setStatus("Danger")
+ ]})
+ }
try {
channel = interaction.options.getChannel("channel")
} catch {
@@ -36,7 +44,7 @@
]})
}
channel = channel as Discord.TextChannel
- if (channel.guild.id != interaction.guild.id) {
+ if (channel.guild.id !== interaction.guild.id) {
return interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Stats Channel")
.setDescription(`You must choose a channel in this server`)
@@ -51,7 +59,7 @@
let confirmation = await new confirmationMessage(interaction)
.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}*`)
+ .setDescription(`Are you sure you want to set <#${channel.id}> to a stats channel?\n\n*Preview: ${newName.replace(/^ +| $/g, "")}*`)
.setColor("Warning")
.setInverted(true)
.send(true)
@@ -104,7 +112,7 @@
await statsChannelAddCallback(client, interaction.member);
}
while (true) {
- let config = await client.database.guilds.read(interaction.guild.id);
+ config = await client.database.guilds.read(interaction.guild.id);
let stats = config.getKey("stats")
let selectMenu = new MessageSelectMenu()
.setCustomId("remove")
@@ -133,8 +141,7 @@
i.deferUpdate()
if (i.customId === "remove") {
let toRemove = i.values;
- console.log(toRemove.map(k => `stats.${k}`))
- await client.database.guilds.write(interaction.guild.id, {}, toRemove.map(k => `stats.${k}`));
+ await client.database.guilds.write(interaction.guild.id, null, toRemove.map(k => `stats.${k}`));
}
}
await interaction.editReply({embeds: [new EmojiEmbed()
@@ -147,7 +154,7 @@
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
let member = (interaction.member as Discord.GuildMember)
- if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the Manage Server permission to use this command"
+ if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the *Manage Server* permission to use this command"
return true;
}
diff --git a/src/commands/settings/tickets.ts b/src/commands/settings/tickets.ts
index 16d5f3b..f199ac3 100644
--- a/src/commands/settings/tickets.ts
+++ b/src/commands/settings/tickets.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../utils/defaultEmbeds.js';
import getEmojiByName from "../../utils/getEmojiByName.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
@@ -21,13 +22,7 @@
const callback = async (interaction: CommandInteraction): Promise<any> => {
let m;
- m = await interaction.reply({
- embeds: [new EmojiEmbed()
- .setTitle("Loading")
- .setStatus("Danger")
- .setEmoji("NUCLEUS.LOADING")
- ], ephemeral: true, fetchReply: true
- });
+ m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
let options = {
enabled: interaction.options.getString("enabled") as string | boolean,
category: interaction.options.getChannel("category"),
@@ -51,7 +46,7 @@
})
}
channel = channel as Discord.CategoryChannel
- if (channel.guild.id != interaction.guild.id) return interaction.editReply({
+ if (channel.guild.id !== interaction.guild.id) return interaction.editReply({
embeds: [new EmojiEmbed()
.setTitle("Tickets > Category")
.setDescription(`You must choose a category in this server`)
@@ -85,7 +80,7 @@
})
}
role = role as Discord.Role
- if (role.guild.id != interaction.guild.id) return interaction.editReply({
+ if (role.guild.id !== interaction.guild.id) return interaction.editReply({
embeds: [new EmojiEmbed()
.setTitle("Tickets > Support Ping")
.setDescription(`You must choose a role in this server`)
@@ -174,23 +169,23 @@
.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),
+ .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),
+ .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")
- .setDisabled(data.supportRole == null),
+ .setDisabled(data.supportRole === null),
]), new MessageActionRow().addComponents([
new MessageButton()
.setLabel("Manage types")
@@ -204,28 +199,28 @@
i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { break }
i.deferUpdate()
- if (i.component.customId == "clearCategory") {
- if (lastClicked == "cat") {
+ if (i.component.customId === "clearCategory") {
+ if (lastClicked === "cat") {
lastClicked = "";
- await client.database.guilds.write(interaction.guild.id, {}, ["tickets.category"])
+ await client.database.guilds.write(interaction.guild.id, null, ["tickets.category"])
data.category = undefined;
} else lastClicked = "cat";
- } else if (i.component.customId == "clearMaxTickets") {
- if (lastClicked == "max") {
+ } else if (i.component.customId === "clearMaxTickets") {
+ if (lastClicked === "max") {
lastClicked = "";
- await client.database.guilds.write(interaction.guild.id, {}, ["tickets.maxTickets"])
+ await client.database.guilds.write(interaction.guild.id, null, ["tickets.maxTickets"])
data.maxTickets = 5;
} else lastClicked = "max";
- } else if (i.component.customId == "clearSupportPing") {
- if (lastClicked == "sup") {
+ } else if (i.component.customId === "clearSupportPing") {
+ if (lastClicked === "sup") {
lastClicked = "";
- await client.database.guilds.write(interaction.guild.id, {}, ["tickets.supportRole"])
+ await client.database.guilds.write(interaction.guild.id, null, ["tickets.supportRole"])
data.supportRole = undefined;
} else lastClicked = "sup";
- } else if (i.component.customId == "enabled") {
+ } else if (i.component.customId === "enabled") {
await client.database.guilds.write(interaction.guild.id, { "tickets.enabled": !data.enabled })
data.enabled = !data.enabled;
- } else if (i.component.customId == "manageTypes") {
+ } else if (i.component.customId === "manageTypes") {
data = await manageTypes(interaction, data, m);
} else {
break
@@ -329,12 +324,12 @@
try {
i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { break }
- if (i.component.customId == "types") {
+ if (i.component.customId === "types") {
i.deferUpdate()
let types = toHexInteger(i.values, ticketTypes);
await client.database.guilds.write(interaction.guild.id, { "tickets.types": types })
data.types = types;
- } else if (i.component.customId == "removeTypes") {
+ } else if (i.component.customId === "removeTypes") {
i.deferUpdate()
let types = i.values
let customTypes = data.customTypes;
@@ -344,7 +339,7 @@
await client.database.guilds.write(interaction.guild.id, { "tickets.customTypes": customTypes })
data.customTypes = customTypes;
}
- } else if (i.component.customId == "addType") {
+ } else if (i.component.customId === "addType") {
await i.showModal(new Discord.Modal().setCustomId("modal").setTitle("Enter a name for the new type").addComponents(
new MessageActionRow<TextInputComponent>().addComponents(new TextInputComponent()
.setCustomId("type")
@@ -371,7 +366,7 @@
});
let out;
try {
- out = await modalInteractionCollector(m, (m) => m.channel.id == interaction.channel.id, (m) => m.customId == "addType")
+ out = await modalInteractionCollector(m, (m) => m.channel.id === interaction.channel.id, (m) => m.customId === "addType")
} catch (e) { continue }
if (out.fields) {
let toAdd = out.fields.getTextInputValue("type");
@@ -385,11 +380,11 @@
data.customTypes.push(toAdd);
}
} else { continue }
- } else if (i.component.customId == "switchToDefault") {
+ } else if (i.component.customId === "switchToDefault") {
i.deferUpdate()
await client.database.guilds.write(interaction.guild.id, { "tickets.useCustom": false }, [])
data.useCustom = false;
- } else if (i.component.customId == "switchToCustom") {
+ } else if (i.component.customId === "switchToCustom") {
i.deferUpdate()
await client.database.guilds.write(interaction.guild.id, { "tickets.useCustom": true }, [])
data.useCustom = true;
@@ -404,7 +399,7 @@
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
let member = (interaction.member as Discord.GuildMember)
- if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the Manage Server permission to use this command"
+ if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the *Manage Server* permission to use this command"
return true;
}
diff --git a/src/commands/settings/verify.ts b/src/commands/settings/verify.ts
index d71fdf0..14dfe8d 100644
--- a/src/commands/settings/verify.ts
+++ b/src/commands/settings/verify.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../utils/defaultEmbeds.js';
import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
@@ -14,11 +15,7 @@
const callback = async (interaction: CommandInteraction): Promise<any> => {
let m;
- m = await interaction.reply({embeds: [new EmojiEmbed()
- .setTitle("Loading")
- .setStatus("Danger")
- .setEmoji("NUCLEUS.LOADING")
- ], ephemeral: true, fetchReply: true});
+ m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
if (interaction.options.getRole("role")) {
let role
try {
@@ -32,7 +29,7 @@
]})
}
role = role as Discord.Role
- if (role.guild.id != interaction.guild.id) {
+ if (role.guild.id !== interaction.guild.id) {
return interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Verify Role")
.setDescription(`You must choose a role in this server`)
@@ -100,23 +97,24 @@
.setDescription(role ? `Your verify role is currently set to <@&${role}>` : `You have not set a verify role`)
.setStatus("Success")
.setEmoji("GUILD.ROLES.CREATE")
- ], components: [new MessageActionRow().addComponents([new MessageButton()
- .setCustomId("clear")
- .setLabel(clicks ? "Click again to confirm" : "Reset role")
- .setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
- .setStyle("DANGER")
- .setDisabled(!role)
+ ], components: [new MessageActionRow().addComponents([
+ new MessageButton()
+ .setCustomId("clear")
+ .setLabel(clicks ? "Click again to confirm" : "Reset role")
+ .setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
+ .setStyle("DANGER")
+ .setDisabled(!role)
])]});
let i;
try {
i = await m.awaitMessageComponent({time: 300000});
} catch(e) { break }
i.deferUpdate()
- if (i.component.customId == "clear") {
+ if (i.component.customId === "clear") {
clicks += 1;
- if (clicks == 2) {
+ if (clicks === 2) {
clicks = 0;
- await client.database.guilds.write(interaction.guild.id, {}, ["verify.role", "verify.enabled"])
+ await client.database.guilds.write(interaction.guild.id, null, ["verify.role", "verify.enabled"])
role = undefined;
}
} else {
@@ -134,13 +132,13 @@
.setLabel("Clear")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
.setStyle("SECONDARY")
- .setDisabled(true)
+ .setDisabled(true),
])]});
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
let member = (interaction.member as Discord.GuildMember)
- if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the Manage Server permission to use this command"
+ if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the *Manage Server* permission to use this command"
return true;
}