removed discordjs/builders, worked on help
diff --git a/src/commands/help.ts b/src/commands/help.ts
index 26d86c5..c1bad9b 100644
--- a/src/commands/help.ts
+++ b/src/commands/help.ts
@@ -1,33 +1,71 @@
-import { ActionRowBuilder, CommandInteraction, StringSelectMenuBuilder, ApplicationCommand, ApplicationCommandOptionType } from "discord.js";
-import { SlashCommandBuilder } from "@discordjs/builders";
+import {
+ ActionRowBuilder,
+ CommandInteraction,
+ StringSelectMenuBuilder,
+ ApplicationCommandOptionType,
+ ApplicationCommandType,
+ StringSelectMenuOptionBuilder,
+ SlashCommandBuilder,
+ StringSelectMenuInteraction,
+ ComponentType,
+ APIMessageComponentEmoji,
+ ApplicationCommandSubGroup,
+ PermissionsBitField,
+ Interaction,
+ ApplicationCommandOption,
+ ApplicationCommandSubCommand
+} from "discord.js";
import client from "../utils/client.js";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
import { LoadingEmbed } from "../utils/defaults.js";
+import { capitalize } from "../utils/generateKeyValueList.js";
+import { getCommandByName, getCommandMentionByName } from "../utils/getCommandDataByName.js";
+import getEmojiByName from "../utils/getEmojiByName.js";
const command = new SlashCommandBuilder()
.setName("help")
.setDescription("Shows help for commands");
+const styles: Record<string, {emoji: string}> = {
+ "help": {emoji: "NUCLEUS.LOGO"},
+ "mod": {emoji: "PUNISH.BAN.RED"},
+ "nucleus": {emoji: "NUCLEUS.LOGO"},
+ "privacy": {emoji: "NUCLEUS.LOGO"},
+ "role": {emoji: "GUILD.ROLES.DELETE"},
+ "rolemenu": {emoji: "GUILD.ROLES.DELETE"},
+ "server": {emoji: "GUILD.RED"},
+ "settings": {emoji: "GUILD.SETTINGS.RED"},
+ "tag": {emoji: "PUNISH.NICKNAME.RED"},
+ "tags": {emoji: "PUNISH.NICKNAME.RED"},
+ "ticket": {emoji: "GUILD.TICKET.CLOSE"},
+ "user": {emoji: "MEMBER.LEAVE"},
+ "verify": {emoji: "CONTROL.BLOCKTICK"}
+}
+
const callback = async (interaction: CommandInteraction): Promise<void> => {
- const m = await interaction.reply({ embeds: LoadingEmbed, fetchReply: true });
+ const m = await interaction.reply({ embeds: LoadingEmbed, ephemeral: true, fetchReply: true });
const commands = client.fetchedCommands;
- const commandRow = new ActionRowBuilder<StringSelectMenuBuilder>()
- .addComponents(
- commands.map((command) => {
- return new StringSelectMenuBuilder()
- .setCustomId(command.name)
- .setPlaceholder("Select a command")
- .addOptions({
- label: command.name,
- value: command.name
- })
- })
- );
-
let closed = false;
+ let currentPath: [string, string, string] = ["","",""]
do {
- let current: ApplicationCommand | undefined;
+ const commandRow = new ActionRowBuilder<StringSelectMenuBuilder>()
+ .addComponents(
+ new StringSelectMenuBuilder()
+ .setCustomId("commandRow")
+ .setPlaceholder("Select a command")
+ .addOptions(
+ ...commands.filter(command => command.type === ApplicationCommandType.ChatInput).map((command) => {
+ const builder = new StringSelectMenuOptionBuilder()
+ .setLabel(capitalize(command.name))
+ .setValue(command.name)
+ .setDescription(command.description)
+ .setDefault(currentPath[0] === command.name)
+ if (styles[command.name]) builder.setEmoji(getEmojiByName(styles[command.name]!.emoji, "id") as APIMessageComponentEmoji)
+ return builder
+ })
+ )
+ );
const subcommandGroupRow = new ActionRowBuilder<StringSelectMenuBuilder>()
.addComponents(
new StringSelectMenuBuilder()
@@ -40,58 +78,96 @@
);
const embed = new EmojiEmbed()
.setTitle("Help")
- .setStatus("Success")
- .setEmoji("📖")
+ .setStatus("Danger")
+ .setEmoji("NUCLEUS.LOGO")
- if(!current) {
+ if(currentPath[0] === "" || currentPath[0] === "help") {
embed.setDescription(
- `**${"Help Menu Home"}**\n\n` +
- `${"Select a command to get started"}`
+ `Welcome to Nucleus\n\n` +
+ `Select a command to get started${(interaction.member?.permissions as PermissionsBitField).has("ManageGuild") ? `, or run ${getCommandMentionByName("nucleus/guide")} for commands to set up your server` : ``}` // FIXME
)
} else {
+ let currentData = getCommandByName(currentPath.filter(value => value !== "" && value !== "none").join('/'));
+ let current = commands.find((command) => command.name === currentPath[0])!;
+
+ let optionString = ``
+ let options: (ApplicationCommandOption & {
+ nameLocalized?: string;
+ descriptionLocalized?: string;
+ })[] = [];
+ //options
+ for(const option of options) {
+ optionString += `> ${option.name} (${option.type})- ${option.description}\n`
+ }
+ const APICommand = client.commands["commands/" + currentPath.filter(value => value !== "" && value !== "none").join("/")]![0]
+ let allowedToRun = true;
+ if(APICommand?.check) {
+ APICommand?.check(interaction as Interaction, true)
+ }
embed.setDescription(
- `**${current.name}**\n\n` +
- `${current.description}`
+ `${getEmojiByName(styles[currentPath[0]]!.emoji)} **${capitalize(currentData.name)}**\n> ${currentData.mention}\n\n` +
+ `> ${currentData.description}\n\n` +
+ (APICommand ? (`${getEmojiByName(allowedToRun ? "CONTROL.TICK" : "CONTROL.CROSS")} You ${allowedToRun ? "" : "don't "}` +
+ `have permission to use this command\n\n`) : "") +
+ ((optionString.length > 0) ? "**Options:**\n" + optionString : "")
)
const subcommands = current.options.filter((option) => option.type === ApplicationCommandOptionType.Subcommand);
const subcommandGroups = current.options.filter((option) => option.type === ApplicationCommandOptionType.SubcommandGroup);
+
if(subcommandGroups.length > 0) {
subcommandGroupRow.components[0]!
.addOptions(
- subcommandGroups.map((option) => {
- return {
- label: option.name,
- value: option.name
- }
- })
+ new StringSelectMenuOptionBuilder().setLabel("Select a subcommand").setValue("none").setDefault(currentPath[1] === "none"),
+ ...subcommandGroups.map((option) => new StringSelectMenuOptionBuilder().setLabel(capitalize(option.name)).setValue(option.name).setDefault(currentPath[1] === option.name))
)
- } else {
- if(subcommands.length > 0) {
+ if(subcommandGroupRow.components[0]!.options.find((option) => option.data.default)) {
+ let subsubcommands = (subcommandGroups.find((option) => option.name === currentPath[1])! as ApplicationCommandSubGroup).options?.filter((option) => option.type === ApplicationCommandOptionType.Subcommand) || [];
subcommandRow.components[0]!
.addOptions(
- subcommands.map((option) => {
- return {
- label: option.name,
- value: option.name
- }
- })
+ new StringSelectMenuOptionBuilder().setLabel("Select a subcommand").setValue("none").setDefault(currentPath[2] === "none"),
+ ...subsubcommands.map((option) => new StringSelectMenuOptionBuilder().setLabel(capitalize(option.name)).setValue(option.name).setDefault(currentPath[2] === option.name))
)
}
}
+ if(subcommands.length > 0) {
+ subcommandGroupRow.components[0]!
+ .addOptions(
+ ...subcommands.map((option) => new StringSelectMenuOptionBuilder().setLabel(capitalize(option.name)).setValue(option.name).setDefault(currentPath[1] === option.name))
+ )
+ }
}
+
let cmps = [commandRow];
if(subcommandGroupRow.components[0]!.options.length > 0) cmps.push(subcommandGroupRow);
if(subcommandRow.components[0]!.options.length > 0) cmps.push(subcommandRow);
await interaction.editReply({ embeds: [embed], components: cmps });
+ let i: StringSelectMenuInteraction;
+ try {
+ i = await m.awaitMessageComponent<ComponentType.StringSelect>({filter: (newInteraction) => interaction.user.id === newInteraction.user.id,time: 300000})
+ } catch (e) {
+ closed = true;
+ break;
+ }
+ await i.deferUpdate();
+ let value = i.values[0]!;
+ switch(i.customId) {
+ case "commandRow":
+ currentPath = [value, "", ""];
+ break;
+ case "subcommandGroupRow":
+ currentPath = [currentPath[0], value , ""];
+ break;
+ case "subcommandRow":
+ currentPath[2] = value;
+ break;
+ }
+ console.log(currentPath)
+
} while (!closed);
};
-const check = () => {
- return true;
-};
-export { command };
+export { command as command };
export { callback };
-export { check };
diff --git a/src/commands/mod/about.ts b/src/commands/mod/about.ts
index 4277918..d34b634 100644
--- a/src/commands/mod/about.ts
+++ b/src/commands/mod/about.ts
@@ -12,8 +12,8 @@
ButtonStyle,
TextInputStyle,
APIMessageComponentEmoji,
+ SlashCommandSubcommandBuilder
} from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
import client from "../../utils/client.js";
diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts
index ebc44ad..362bde8 100644
--- a/src/commands/mod/ban.ts
+++ b/src/commands/mod/ban.ts
@@ -1,5 +1,4 @@
-import Discord, { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, User, ButtonStyle } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import Discord, { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, User, ButtonStyle, SlashCommandSubcommandBuilder } from "discord.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -166,9 +165,12 @@
});
};
-const check = async (interaction: CommandInteraction) => {
+const check = async (interaction: CommandInteraction, partial: boolean = false) => {
if (!interaction.guild) return;
const member = interaction.member as GuildMember;
+ // Check if the user has ban_members permission
+ if (!member.permissions.has("BanMembers")) return "You do not have the *Ban Members* permission";
+ if(partial) return true;
const me = interaction.guild.members.me!;
let apply = interaction.options.getUser("user") as User | GuildMember;
const memberPos = member.roles.cache.size > 1 ? member.roles.highest.position : 0;
@@ -190,8 +192,6 @@
if (member.id === me.id) return "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("BanMembers")) return "You do not have the *Ban Members* permission";
// Check if the user is below on the role list
if (!(memberPos > applyPos)) return "You do not have a role higher than that member";
// Allow ban
diff --git a/src/commands/mod/kick.ts b/src/commands/mod/kick.ts
index 380bcc9..d9418e6 100644
--- a/src/commands/mod/kick.ts
+++ b/src/commands/mod/kick.ts
@@ -1,8 +1,7 @@
import { LinkWarningFooter } from '../../utils/defaults.js';
-import { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
+import { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle, SlashCommandSubcommandBuilder } from "discord.js";
// @ts-expect-error
import humanizeDuration from "humanize-duration";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import type Discord from "discord.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -168,26 +167,29 @@
});
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, partial: boolean = false) => {
if (!interaction.guild) return;
+
const member = interaction.member as GuildMember;
+ // Check if the user has kick_members permission
+ if (!member.permissions.has("KickMembers")) return "You do not have the *Kick Members* permission";
+ if (partial) return true;
+
const me = interaction.guild.members.me!;
const apply = interaction.options.getMember("user") as GuildMember;
const memberPos = member.roles.cache.size > 1 ? member.roles.highest.position : 0;
const mePos = me.roles.cache.size > 1 ? me.roles.highest.position : 0;
const applyPos = apply.roles.cache.size > 1 ? apply.roles.highest.position : 0;
+ // Check if Nucleus has permission to kick
+ if (!me.permissions.has("KickMembers")) return "I do not have the *Kick Members* permission";
+ // Allow the owner to kick anyone
+ if (member.id === interaction.guild.ownerId) return true;
// Do not allow kicking the owner
if (member.id === interaction.guild.ownerId) return "You cannot kick the owner of the server";
// Check if Nucleus can kick the member
if (!(mePos > applyPos)) return "I do not have a role higher than that member";
- // Check if Nucleus has permission to kick
- if (!me.permissions.has("KickMembers")) return "I do not have the *Kick Members* permission";
// Do not allow kicking Nucleus
if (member.id === interaction.guild.members.me!.id) return "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("KickMembers")) return "You do not have the *Kick Members* permission";
// Check if the user is below on the role list
if (!(memberPos > applyPos)) return "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 0e080c3..ef677df 100644
--- a/src/commands/mod/mute.ts
+++ b/src/commands/mod/mute.ts
@@ -1,6 +1,6 @@
import { LinkWarningFooter, LoadingEmbed } from "../../utils/defaults.js";
import Discord, { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
@@ -361,9 +361,12 @@
});
};
-const check = (interaction: CommandInteraction) => {
+const check = async (interaction: CommandInteraction, partial: boolean = false) => {
if (!interaction.guild) return;
const member = interaction.member as GuildMember;
+ // Check if the user has moderate_members permission
+ if (!member.permissions.has("ModerateMembers")) return "You do not have the *Moderate Members* permission";
+ if (partial) return true;
const me = interaction.guild.members.me!;
const apply = interaction.options.getMember("user") as GuildMember;
const memberPos = member.roles.cache.size > 1 ? member.roles.highest.position : 0;
@@ -379,9 +382,6 @@
if (member.id === me.id) return "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("ModerateMembers"))
- return "You do not have the *Moderate Members* permission";
// Check if the user is below on the role list
if (!(memberPos > applyPos)) return "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 abb695d..2787a51 100644
--- a/src/commands/mod/nick.ts
+++ b/src/commands/mod/nick.ts
@@ -1,6 +1,6 @@
import { LinkWarningFooter } from './../../utils/defaults.js';
import { ActionRowBuilder, ButtonBuilder, CommandInteraction, GuildMember, ButtonStyle, Message } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -189,8 +189,11 @@
});
};
-const check = (interaction: CommandInteraction) => {
+const check = async (interaction: CommandInteraction, partial: boolean = false) => {
const member = interaction.member as GuildMember;
+ // Check if the user has manage_nicknames permission
+ if (!member.permissions.has("ManageNicknames")) return "You do not have the *Manage Nicknames* permission";
+ if (partial) return true;
const me = interaction.guild!.members.me!;
const apply = interaction.options.getMember("user") as GuildMember;
const memberPos = member.roles.cache.size ? member.roles.highest.position : 0;
@@ -205,9 +208,6 @@
if (!me.permissions.has("ManageNicknames")) return "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("ManageNicknames"))
- return "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
diff --git a/src/commands/mod/purge.ts b/src/commands/mod/purge.ts
index cc72efb..89f311f 100644
--- a/src/commands/mod/purge.ts
+++ b/src/commands/mod/purge.ts
@@ -1,6 +1,6 @@
import { JSONTranscriptFromMessageArray, JSONTranscriptToHumanReadable } from '../../utils/logTranscripts.js';
import Discord, { CommandInteraction, GuildChannel, GuildMember, TextChannel, ButtonStyle, ButtonBuilder } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -391,16 +391,17 @@
}
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, partial: boolean = false) => {
if (!interaction.guild) return false;
const member = interaction.member as GuildMember;
+ // Check if the user has manage_messages permission
+ if (!member.permissions.has("ManageMessages")) return "You do not have the *Manage Messages* permission";
+ if (partial) return true;
const me = interaction.guild.members.me!;
// Check if nucleus has the manage_messages permission
if (!me.permissions.has("ManageMessages")) return "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("ManageMessages")) return "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 9792827..886d4bb 100644
--- a/src/commands/mod/slowmode.ts
+++ b/src/commands/mod/slowmode.ts
@@ -1,7 +1,7 @@
// @ts-expect-error
import humanizeDuration from "humanize-duration";
import type { CommandInteraction, GuildMember, TextChannel } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import keyValueList from "../../utils/generateKeyValueList.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -76,12 +76,13 @@
});
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, partial: boolean = false) => {
const member = interaction.member as GuildMember;
- // Check if Nucleus can set the slowmode
- if (!interaction.guild!.members.me!.permissions.has("ManageChannels")) return "I do not have the *Manage Channels* permission";
// Check if the user has manage_channel permission
if (!member.permissions.has("ManageChannels")) return "You do not have the *Manage Channels* permission";
+ if (partial) return true;
+ // Check if Nucleus can set the slowmode
+ if (!interaction.guild!.members.me!.permissions.has("ManageChannels")) return "I 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 2c87420..bd940fa 100644
--- a/src/commands/mod/softban.ts
+++ b/src/commands/mod/softban.ts
@@ -1,5 +1,5 @@
import Discord, { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, User, ButtonStyle } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -167,9 +167,12 @@
});
};
-const check = async (interaction: CommandInteraction) => {
+const check = async (interaction: CommandInteraction, partial: boolean = false) => {
if (!interaction.guild) return;
const member = interaction.member as GuildMember;
+ // Check if the user has ban_members permission
+ if (!member.permissions.has("BanMembers")) return "You do not have the *Ban Members* permission";
+ if (partial) return true;
const me = interaction.guild.members.me!;
let apply = interaction.options.getUser("user") as User | GuildMember;
const memberPos = member.roles.cache.size > 1 ? member.roles.highest.position : 0;
@@ -191,8 +194,6 @@
if (member.id === me.id) return "I cannot softban 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("BanMembers")) return "You do not have the *Ban Members* permission";
// Check if the user is below on the role list
if (!(memberPos > applyPos)) return "You do not have a role higher than that member";
// Allow ban
diff --git a/src/commands/mod/unban.ts b/src/commands/mod/unban.ts
index 37fee99..ac4823e 100644
--- a/src/commands/mod/unban.ts
+++ b/src/commands/mod/unban.ts
@@ -1,5 +1,5 @@
import type { CommandInteraction, GuildMember, User } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
@@ -107,16 +107,17 @@
}
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, partial: boolean = false) => {
if (!interaction.guild) return;
const member = interaction.member as GuildMember;
+ // Check if the user has ban_members permission
+ if (!member.permissions.has("BanMembers")) return "You do not have the *Ban Members* permission";
+ if (partial) return true;
const me = interaction.guild.members.me!;
// Check if Nucleus can unban members
if (!me.permissions.has("BanMembers")) return "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("BanMembers")) return "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 e2585e1..4327019 100644
--- a/src/commands/mod/unmute.ts
+++ b/src/commands/mod/unmute.ts
@@ -1,5 +1,5 @@
import type { CommandInteraction, GuildMember } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -131,9 +131,13 @@
});
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, partial: boolean = false) => {
if (!interaction.guild) return;
const member = interaction.member as GuildMember;
+ // Check if the user has moderate_members permission
+ if (!member.permissions.has("ModerateMembers"))
+ return "You do not have the *Moderate Members* permission";
+ if (partial) return true;
const me = interaction.guild.members.me!;
const apply = interaction.options.getMember("user") as GuildMember;
const memberPos = member.roles.cache.size > 1 ? member.roles.highest.position : 0;
@@ -147,9 +151,6 @@
if (!me.permissions.has("ModerateMembers")) return "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("ModerateMembers"))
- return "You do not have the *Moderate Members* permission";
// Check if the user is below on the role list
if (!(memberPos > applyPos)) return "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 f01834c..ef62816 100644
--- a/src/commands/mod/viewas.ts
+++ b/src/commands/mod/viewas.ts
@@ -10,7 +10,7 @@
StringSelectMenuBuilder,
APIMessageComponentEmoji
} from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import type { GuildBasedChannel } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
@@ -169,7 +169,7 @@
}
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, _partial: boolean = false) => {
const member = interaction.member as GuildMember;
if (!member.permissions.has("ManageRoles")) return "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 8f67477..c6b4a56 100644
--- a/src/commands/mod/warn.ts
+++ b/src/commands/mod/warn.ts
@@ -1,5 +1,5 @@
import Discord, { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -275,9 +275,12 @@
}
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, partial: boolean = false) => {
if (!interaction.guild) return;
const member = interaction.member as GuildMember;
+ if (!member.permissions.has("ModerateMembers"))
+ return "You do not have the *Moderate Members* permission";
+ if(partial) return true;
const apply = interaction.options.getMember("user") as GuildMember | null;
if (apply === null) return "That member is not in the server";
const memberPos = member.roles.cache.size ? member.roles.highest.position : 0;
@@ -287,8 +290,6 @@
// 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("ModerateMembers"))
- return "You do not have the *Moderate Members* permission";
// Check if the user is below on the role list
if (!(memberPos > applyPos)) return "You do not have a role higher than that member";
// Allow warn
diff --git a/src/commands/nucleus/guide.ts b/src/commands/nucleus/guide.ts
index d3370ba..270ee62 100644
--- a/src/commands/nucleus/guide.ts
+++ b/src/commands/nucleus/guide.ts
@@ -1,5 +1,5 @@
import type { CommandInteraction } from 'discord.js';
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import guide from "../../reflex/guide.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
@@ -9,10 +9,5 @@
guide(interaction.guild!, interaction);
};
-const check = () => {
- return true;
-};
-
export { command };
export { callback };
-export { check };
diff --git a/src/commands/nucleus/invite.ts b/src/commands/nucleus/invite.ts
index fd65e51..b89425a 100644
--- a/src/commands/nucleus/invite.ts
+++ b/src/commands/nucleus/invite.ts
@@ -1,5 +1,5 @@
import { CommandInteraction, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import client from "../../utils/client.js";
@@ -29,10 +29,5 @@
});
};
-const check = () => {
- return true;
-};
-
export { command };
export { callback };
-export { check };
diff --git a/src/commands/nucleus/ping.ts b/src/commands/nucleus/ping.ts
index 12f1c6b..1107f34 100644
--- a/src/commands/nucleus/ping.ts
+++ b/src/commands/nucleus/ping.ts
@@ -1,6 +1,6 @@
import { LoadingEmbed } from "../../utils/defaults.js";
import type { CommandInteraction } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import client from "../../utils/client.js";
@@ -28,10 +28,5 @@
});
};
-const check = () => {
- return true;
-};
-
export { command };
export { callback };
-export { check };
diff --git a/src/commands/nucleus/premium.ts b/src/commands/nucleus/premium.ts
index e74e23c..1c9db24 100644
--- a/src/commands/nucleus/premium.ts
+++ b/src/commands/nucleus/premium.ts
@@ -1,5 +1,5 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, CommandInteraction } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import client from "../../utils/client.js";
import { LoadingEmbed } from "../../utils/defaults.js";
@@ -118,10 +118,5 @@
} while (!closed);
};
-const check = () => {
- return true;
-};
-
export { command };
export { callback };
-export { check };
diff --git a/src/commands/nucleus/stats.ts b/src/commands/nucleus/stats.ts
index 8330fbe..19c0949 100644
--- a/src/commands/nucleus/stats.ts
+++ b/src/commands/nucleus/stats.ts
@@ -1,5 +1,5 @@
import type { CommandInteraction } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import client from "../../utils/client.js";
@@ -19,10 +19,5 @@
});
};
-const check = () => {
- return true;
-};
-
export { command };
export { callback };
-export { check };
diff --git a/src/commands/nucleus/suggest.ts b/src/commands/nucleus/suggest.ts
index de0e69b..6ba3445 100644
--- a/src/commands/nucleus/suggest.ts
+++ b/src/commands/nucleus/suggest.ts
@@ -1,7 +1,7 @@
import { LoadingEmbed } from '../../utils/defaults.js';
import { ButtonStyle, CommandInteraction } from "discord.js";
import Discord from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import client from "../../utils/client.js";
@@ -66,10 +66,5 @@
});
};
-const check = () => {
- return true;
-};
-
export { command };
export { callback };
-export { check };
diff --git a/src/commands/privacy.ts b/src/commands/privacy.ts
index e20bf34..cb6054d 100644
--- a/src/commands/privacy.ts
+++ b/src/commands/privacy.ts
@@ -1,6 +1,5 @@
import { LoadingEmbed } from "../utils/defaults.js";
-import Discord, { CommandInteraction, ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuOptionBuilder, SelectMenuOptionBuilder, StringSelectMenuBuilder } from "discord.js";
-import { SlashCommandBuilder } from "@discordjs/builders";
+import Discord, { SlashCommandBuilder, CommandInteraction, ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuOptionBuilder, SelectMenuOptionBuilder, StringSelectMenuBuilder } from "discord.js";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
import getEmojiByName from "../utils/getEmojiByName.js";
import createPageIndicator from "../utils/createPageIndicator.js";
@@ -209,10 +208,6 @@
});
};
-const check = () => {
- return true;
-};
export { command };
export { callback };
-export { check };
diff --git a/src/commands/role/user.ts b/src/commands/role/user.ts
index ad29811..4ec7f3e 100644
--- a/src/commands/role/user.ts
+++ b/src/commands/role/user.ts
@@ -1,5 +1,5 @@
import type { CommandInteraction, GuildMember, Role, User } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import client from "../../utils/client.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -78,8 +78,11 @@
});
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, partial: boolean = false) => {
const member = interaction.member as GuildMember;
+ // Check if the user has manage_roles permission
+ if (!member.permissions.has("ManageRoles")) return "You do not have the *Manage Roles* permission";
+ if (partial) return true;
if (!interaction.guild) return
const me = interaction.guild.members.me!;
const apply = interaction.options.getMember("user") as GuildMember | null;
@@ -88,8 +91,6 @@
if (!me.permissions.has("ManageRoles")) return "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("ManageRoles")) return "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 c1ceb2e..2861e05 100644
--- a/src/commands/rolemenu.ts
+++ b/src/commands/rolemenu.ts
@@ -1,5 +1,4 @@
-import type { CommandInteraction } from "discord.js";
-import { SlashCommandBuilder } from "@discordjs/builders";
+import { CommandInteraction, SlashCommandBuilder } from "discord.js";
import { callback as roleMenu } from "../actions/roleMenu.js";
const command = new SlashCommandBuilder()
@@ -10,10 +9,5 @@
await roleMenu(interaction);
};
-const check = () => {
- return true;
-};
-
export { command };
export { callback };
-export { check };
diff --git a/src/commands/server/about.ts b/src/commands/server/about.ts
index 23a53b7..4c88365 100644
--- a/src/commands/server/about.ts
+++ b/src/commands/server/about.ts
@@ -1,5 +1,5 @@
import { CommandInteraction, GuildMFALevel } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
import generateKeyValueList, { toCapitals } from "../../utils/generateKeyValueList.js";
@@ -74,10 +74,5 @@
});
};
-const check = () => {
- return true;
-};
-
export { command };
export { callback };
-export { check };
diff --git a/src/commands/settings/commands.ts b/src/commands/settings/commands.ts
index f3a3538..bbbb24a 100644
--- a/src/commands/settings/commands.ts
+++ b/src/commands/settings/commands.ts
@@ -2,7 +2,7 @@
import Discord, { CommandInteraction, ActionRowBuilder, ButtonBuilder, Role, ButtonStyle, ButtonComponent, TextInputBuilder, Message } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import client from "../../utils/client.js";
import { modalInteractionCollector } from "../../utils/dualCollector.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
@@ -208,7 +208,7 @@
}
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, _partial: boolean = false) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("ManageGuild"))
return "You must have the *Manage Server* permission to use this command";
diff --git a/src/commands/settings/filters.ts b/src/commands/settings/filters.ts
index 2e6f4c5..7636f91 100644
--- a/src/commands/settings/filters.ts
+++ b/src/commands/settings/filters.ts
@@ -1,6 +1,6 @@
import type Discord from "discord.js";
import type { CommandInteraction } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
builder.setName("filter").setDescription("Setting for message filters");
@@ -9,7 +9,7 @@
console.log("Filters");
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, _partial: boolean = false) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("ManageMessages"))
return "You must have the *Manage Messages* permission to use this command";
diff --git a/src/commands/settings/logs/attachment.ts b/src/commands/settings/logs/attachment.ts
index f0ecbe9..6f825bc 100644
--- a/src/commands/settings/logs/attachment.ts
+++ b/src/commands/settings/logs/attachment.ts
@@ -4,7 +4,7 @@
import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../../utils/confirmationMessage.js";
import getEmojiByName from "../../../utils/getEmojiByName.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import client from "../../../utils/client.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
@@ -192,7 +192,7 @@
});
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, _partial: boolean = false) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("ManageGuild"))
return "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 afd7735..9861d26 100644
--- a/src/commands/settings/logs/channel.ts
+++ b/src/commands/settings/logs/channel.ts
@@ -4,7 +4,7 @@
import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../../utils/confirmationMessage.js";
import getEmojiByName from "../../../utils/getEmojiByName.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import client from "../../../utils/client.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
@@ -185,7 +185,7 @@
});
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, _partial: boolean = false) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("ManageGuild"))
return "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 1249d2b..7259fa4 100644
--- a/src/commands/settings/logs/events.ts
+++ b/src/commands/settings/logs/events.ts
@@ -1,6 +1,6 @@
import { LoadingEmbed } from "../../../utils/defaults.js";
import Discord, { CommandInteraction, Message, ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder, EmbedBuilder } from "discord.js";
-import { SlashCommandSubcommandBuilder, StringSelectMenuOptionBuilder } from "@discordjs/builders";
+import { SlashCommandSubcommandBuilder, StringSelectMenuOptionBuilder } from "discord.js";
import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
import client from "../../../utils/client.js";
import { toHexArray, toHexInteger } from "../../../utils/calculate.js";
@@ -105,7 +105,7 @@
return;
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, _partial: boolean = false) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("ManageGuild"))
return "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 ba9bbba..3855d34 100644
--- a/src/commands/settings/logs/staff.ts
+++ b/src/commands/settings/logs/staff.ts
@@ -4,7 +4,7 @@
import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../../utils/confirmationMessage.js";
import getEmojiByName from "../../../utils/getEmojiByName.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import client from "../../../utils/client.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
@@ -189,7 +189,7 @@
});
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, _partial: boolean = false) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("ManageGuild"))
return "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 f8fb6f4..2cdd1f8 100644
--- a/src/commands/settings/rolemenu.ts
+++ b/src/commands/settings/rolemenu.ts
@@ -1,6 +1,6 @@
import type Discord from "discord.js";
import { ActionRowBuilder, APIMessageComponentEmoji, ButtonBuilder, ButtonInteraction, ButtonStyle, CommandInteraction, Message, ModalBuilder, RoleSelectMenuBuilder, RoleSelectMenuInteraction, StringSelectMenuBuilder, StringSelectMenuInteraction, StringSelectMenuOptionBuilder, TextInputBuilder, TextInputStyle } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import { LoadingEmbed } from "../../utils/defaults.js";
import client from "../../utils/client.js";
@@ -347,7 +347,7 @@
} while (!closed)
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, _partial: boolean = false) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("ManageRoles"))
return "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 91da382..f8c7d1e 100644
--- a/src/commands/settings/stats.ts
+++ b/src/commands/settings/stats.ts
@@ -1,7 +1,7 @@
import { LoadingEmbed } from "../../utils/defaults.js";
import Discord, { CommandInteraction, Message, ActionRowBuilder, StringSelectMenuBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuOptionBuilder, APIMessageComponentEmoji, TextInputBuilder, StringSelectMenuInteraction, ButtonInteraction, MessageComponentInteraction, ChannelSelectMenuBuilder, ChannelSelectMenuInteraction } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import client from "../../utils/client.js";
import convertCurlyBracketString from "../../utils/convertCurlyBracketString.js";
import singleNotify from "../../utils/singleNotify.js";
@@ -390,7 +390,7 @@
} while (!closed);
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, _partial: boolean = false) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("ManageChannels"))
return "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 6c74939..3c5746c 100644
--- a/src/commands/settings/tickets.ts
+++ b/src/commands/settings/tickets.ts
@@ -17,7 +17,7 @@
ModalSubmitInteraction,
APIMessageComponentEmoji
} from "discord.js";
-import { SlashCommandSubcommandBuilder, StringSelectMenuOptionBuilder } from "@discordjs/builders";
+import { SlashCommandSubcommandBuilder, StringSelectMenuOptionBuilder } from "discord.js";
import { ChannelType } from "discord-api-types/v9";
import client from "../../utils/client.js";
import { toHexInteger, toHexArray, tickets as ticketTypes } from "../../utils/calculate.js";
@@ -738,7 +738,7 @@
return data;
}
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, _partial: boolean = false) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("ManageGuild"))
return "You must have the *Manage Server* permission to use this command";
diff --git a/src/commands/settings/verify.ts b/src/commands/settings/verify.ts
index 23fc99b..3467aee 100644
--- a/src/commands/settings/verify.ts
+++ b/src/commands/settings/verify.ts
@@ -17,7 +17,7 @@
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import client from "../../utils/client.js";
import { modalInteractionCollector } from "../../utils/dualCollector.js";
@@ -385,7 +385,7 @@
});
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, _partial: boolean = false) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("ManageGuild"))
return "You must have the *Manage Server* permission to use this command";
diff --git a/src/commands/settings/welcome.ts b/src/commands/settings/welcome.ts
index fcd0f76..b9c1b9f 100644
--- a/src/commands/settings/welcome.ts
+++ b/src/commands/settings/welcome.ts
@@ -12,7 +12,7 @@
GuildChannel,
EmbedBuilder
} from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import client from "../../utils/client.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
@@ -198,7 +198,7 @@
}\n` +
`**Channel:** ${
config.welcome.channel
- ? config.welcome.channel == "dm"
+ ? config.welcome.channel === "dm"
? "DM"
: renderChannel((await interaction.guild!.channels.fetch(config.welcome.channel))!)
: "*None set*"
@@ -210,25 +210,25 @@
components: [
new ActionRowBuilder<ButtonBuilder>().addComponents([
new ButtonBuilder()
- .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(ButtonStyle.Danger),
new ButtonBuilder()
- .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(ButtonStyle.Danger),
new ButtonBuilder()
- .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(ButtonStyle.Danger),
new ButtonBuilder()
- .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)
@@ -236,7 +236,7 @@
new ButtonBuilder()
.setLabel("Set Channel to DM")
.setCustomId("set-channel-dm")
- .setDisabled(config.welcome.channel == "dm")
+ .setDisabled(config.welcome.channel === "dm")
.setStyle(ButtonStyle.Secondary)
])
]
@@ -252,8 +252,8 @@
continue;
}
await i.deferUpdate();
- if (i.customId == "clear-message") {
- if (lastClicked == "clear-message") {
+ if (i.customId === "clear-message") {
+ if (lastClicked === "clear-message") {
await client.database.guilds.write(interaction.guild!.id, {
"welcome.message": null
});
@@ -261,8 +261,8 @@
} else {
lastClicked = "clear-message";
}
- } else if (i.customId == "clear-role") {
- if (lastClicked == "clear-role") {
+ } else if (i.customId === "clear-role") {
+ if (lastClicked === "clear-role") {
await client.database.guilds.write(interaction.guild!.id, {
"welcome.role": null
});
@@ -270,8 +270,8 @@
} else {
lastClicked = "clear-role";
}
- } else if (i.customId == "clear-ping") {
- if (lastClicked == "clear-ping") {
+ } else if (i.customId === "clear-ping") {
+ if (lastClicked === "clear-ping") {
await client.database.guilds.write(interaction.guild!.id, {
"welcome.ping": null
});
@@ -279,8 +279,8 @@
} else {
lastClicked = "clear-ping";
}
- } else if (i.customId == "clear-channel") {
- if (lastClicked == "clear-channel") {
+ } else if (i.customId === "clear-channel") {
+ if (lastClicked === "clear-channel") {
await client.database.guilds.write(interaction.guild!.id, {
"welcome.channel": null
});
@@ -288,7 +288,7 @@
} else {
lastClicked = "clear-channel";
}
- } else if (i.customId == "set-channel-dm") {
+ } else if (i.customId === "set-channel-dm") {
await client.database.guilds.write(interaction.guild!.id, {
"welcome.channel": "dm"
});
@@ -301,7 +301,7 @@
});
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, _partial: boolean = false) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("ManageGuild"))
return "You must have the *Manage Server* permission to use this command";
diff --git a/src/commands/tag.ts b/src/commands/tag.ts
index a65947c..6ffecca 100644
--- a/src/commands/tag.ts
+++ b/src/commands/tag.ts
@@ -1,5 +1,4 @@
-import { AutocompleteInteraction, CommandInteraction, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
-import { SlashCommandBuilder } from "@discordjs/builders";
+import { AutocompleteInteraction, CommandInteraction, ActionRowBuilder, ButtonBuilder, ButtonStyle, SlashCommandBuilder } from "discord.js";
import client from "../utils/client.js";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
import { capitalize } from "../utils/generateKeyValueList.js";
@@ -51,10 +50,6 @@
return;
};
-const check = () => {
- return true;
-};
-
const autocomplete = async (interaction: AutocompleteInteraction): Promise<string[]> => {
if (!interaction.guild) return [];
const prompt = interaction.options.getString("tag");
@@ -65,5 +60,4 @@
export { command };
export { callback };
-export { check };
export { autocomplete };
diff --git a/src/commands/tags/create.ts b/src/commands/tags/create.ts
index 788902e..1a1f695 100644
--- a/src/commands/tags/create.ts
+++ b/src/commands/tags/create.ts
@@ -1,6 +1,6 @@
import type Discord from "discord.js";
import type { CommandInteraction } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -106,7 +106,7 @@
});
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, _partial: boolean = false) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("ManageMessages"))
return "You must have the *Manage Messages* permission to use this command";
diff --git a/src/commands/tags/delete.ts b/src/commands/tags/delete.ts
index 18143d3..4fdb10f 100644
--- a/src/commands/tags/delete.ts
+++ b/src/commands/tags/delete.ts
@@ -1,6 +1,6 @@
import type Discord from "discord.js";
import type { CommandInteraction } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -68,7 +68,7 @@
});
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, _partial: boolean = false) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("ManageMessages"))
return "You must have the *Manage Messages* permission to use this command";
diff --git a/src/commands/tags/edit.ts b/src/commands/tags/edit.ts
index e15f9ac..a6e23ba 100644
--- a/src/commands/tags/edit.ts
+++ b/src/commands/tags/edit.ts
@@ -1,5 +1,5 @@
import type { CommandInteraction, GuildMember } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -126,7 +126,7 @@
});
};
-const check = (interaction: CommandInteraction) => {
+const check = (interaction: CommandInteraction, _partial: boolean = false) => {
const member = interaction.member as GuildMember;
if (!member.permissions.has("ManageMessages"))
return "You must have the *Manage Messages* permission to use this command";
diff --git a/src/commands/tags/list.ts b/src/commands/tags/list.ts
index 80ee127..dbb1200 100644
--- a/src/commands/tags/list.ts
+++ b/src/commands/tags/list.ts
@@ -10,7 +10,7 @@
ButtonComponent,
StringSelectMenuBuilder
} from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import client from "../../utils/client.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
@@ -173,10 +173,6 @@
});
};
-const check = () => {
- return true;
-};
export { command };
export { callback };
-export { check };
diff --git a/src/commands/ticket/close.ts b/src/commands/ticket/close.ts
index d2ffaf9..ff9da8b 100644
--- a/src/commands/ticket/close.ts
+++ b/src/commands/ticket/close.ts
@@ -1,5 +1,5 @@
import type { CommandInteraction } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import close from "../../actions/tickets/delete.js";
const command = (builder: SlashCommandSubcommandBuilder) => builder.setName("close").setDescription("Closes a ticket");
@@ -8,10 +8,5 @@
await close(interaction);
};
-const check = () => {
- return true;
-};
-
export { command };
export { callback };
-export { check };
diff --git a/src/commands/ticket/create.ts b/src/commands/ticket/create.ts
index 91442b5..2f3ddc6 100644
--- a/src/commands/ticket/create.ts
+++ b/src/commands/ticket/create.ts
@@ -1,5 +1,5 @@
import type { CommandInteraction } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import create from "../../actions/tickets/create.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
@@ -14,10 +14,6 @@
await create(interaction);
};
-const check = () => {
- return true;
-};
export { command };
export { callback };
-export { check };
diff --git a/src/commands/user/about.ts b/src/commands/user/about.ts
index b2a3db8..c32bf8a 100644
--- a/src/commands/user/about.ts
+++ b/src/commands/user/about.ts
@@ -10,7 +10,7 @@
APISelectMenuOption,
StringSelectMenuBuilder
} from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
import generateKeyValueList from "../../utils/generateKeyValueList.js";
@@ -286,11 +286,6 @@
});
};
-const check = () => {
- return true;
-};
-
export { command };
export { callback };
-export { check };
export { userAbout };
\ No newline at end of file
diff --git a/src/commands/user/avatar.ts b/src/commands/user/avatar.ts
index 88b3270..da33f51 100644
--- a/src/commands/user/avatar.ts
+++ b/src/commands/user/avatar.ts
@@ -1,6 +1,6 @@
import type { CommandInteraction } from "discord.js";
import type Discord from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import generateKeyValueList from "../../utils/generateKeyValueList.js";
import client from "../../utils/client.js";
@@ -35,10 +35,6 @@
});
};
-const check = () => {
- return true;
-};
export { command };
export { callback };
-export { check };
diff --git a/src/commands/user/track.ts b/src/commands/user/track.ts
index 7160436..25a784b 100644
--- a/src/commands/user/track.ts
+++ b/src/commands/user/track.ts
@@ -1,6 +1,6 @@
import { LoadingEmbed } from "../../utils/defaults.js";
import Discord, { CommandInteraction, GuildMember, Message, ActionRowBuilder, ButtonBuilder, ButtonStyle, SelectMenuOptionBuilder, APIMessageComponentEmoji, StringSelectMenuBuilder, MessageComponentInteraction, StringSelectMenuInteraction } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
import addPlural from "../../utils/plurals.js";
@@ -207,7 +207,7 @@
}
};
-const check = async (interaction: CommandInteraction) => {
+const check = async (interaction: CommandInteraction, _partial: boolean = false) => {
const tracks = (await client.database.guilds.read(interaction.guild!.id)).tracks;
if (tracks.length === 0) return "This server does not have any tracks";
const member = interaction.member as GuildMember;
diff --git a/src/commands/verify.ts b/src/commands/verify.ts
index 4fafe69..0dd8b24 100644
--- a/src/commands/verify.ts
+++ b/src/commands/verify.ts
@@ -1,5 +1,5 @@
import type { CommandInteraction } from "discord.js";
-import { SlashCommandBuilder } from "@discordjs/builders";
+import { SlashCommandBuilder } from "discord.js";
import verify from "../reflex/verify.js";
const command = new SlashCommandBuilder().setName("verify").setDescription("Get verified in the server");
@@ -8,10 +8,5 @@
verify(interaction);
};
-const check = () => {
- return true;
-};
-
export { command };
export { callback };
-export { check };