Still got errors and warnings, mostly the same and easy to fix
diff --git a/src/commands/role/user.ts b/src/commands/role/user.ts
index d361cf1..d2b05e9 100644
--- a/src/commands/role/user.ts
+++ b/src/commands/role/user.ts
@@ -8,21 +8,21 @@
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
- .setName("user")
- .setDescription("Gives or removes a role from someone")
- .addUserOption(option => option.setName("user").setDescription("The member to give or remove the role from").setRequired(true))
- .addRoleOption(option => option.setName("role").setDescription("The role to give or remove").setRequired(true))
- .addStringOption(option => option.setName("action").setDescription("The action to perform").setRequired(true).addChoices([
- ["Add", "give"],
- ["Remove", "remove"]
- ]))
+ .setName("user")
+ .setDescription("Gives or removes a role from someone")
+ .addUserOption(option => option.setName("user").setDescription("The member to give or remove the role from").setRequired(true))
+ .addRoleOption(option => option.setName("role").setDescription("The role to give or remove").setRequired(true))
+ .addStringOption(option => option.setName("action").setDescription("The action to perform").setRequired(true).addChoices([
+ ["Add", "give"],
+ ["Remove", "remove"]
+ ]));
const callback = async (interaction: CommandInteraction): Promise<any> => {
- const { renderUser, renderRole } = client.logger
- let action = interaction.options.getString("action");
+ const { renderUser, renderRole } = client.logger;
+ const action = interaction.options.getString("action");
// TODO:[Modals] Replace this with a modal
- let confirmation = await new confirmationMessage(interaction)
+ const confirmation = await new confirmationMessage(interaction)
.setEmoji("GUILD.ROLES.DELETE")
.setTitle("Role")
.setDescription(keyValueList({
@@ -30,16 +30,16 @@
"role": renderRole(interaction.options.getRole("role"))
}) + `\nAre you sure you want to ${action === "give" ? "give the role to" : "remove the role from"} ${interaction.options.getUser("user")}?`)
.setColor("Danger")
- .send()
- if (confirmation.cancelled) return
+ .send();
+ if (confirmation.cancelled) return;
if (confirmation.success) {
try {
- let member = interaction.options.getMember("user") as GuildMember
- let role = interaction.options.getRole("role") as Role
+ const member = interaction.options.getMember("user") as GuildMember;
+ const role = interaction.options.getRole("role") as Role;
if (interaction.options.getString("action") === "give") {
- member.roles.add(role)
+ member.roles.add(role);
} else {
- member.roles.remove(role)
+ member.roles.remove(role);
}
} catch (e) {
return await interaction.editReply({embeds: [new EmojiEmbed()
@@ -47,38 +47,38 @@
.setDescription("Something went wrong and the role could not be added")
.setStatus("Danger")
.setEmoji("CONTROL.BLOCKCROSS")
- ], components: []})
+ ], components: []});
}
return await interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Role")
.setDescription(`The role has been ${action === "give" ? "given" : "removed"} successfully`)
.setStatus("Success")
.setEmoji("GUILD.ROLES.CREATE")
- ], components: []})
+ ], components: []});
} else {
await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji("GUILD.ROLES.CREATE")
.setTitle("Role")
- .setDescription(`No changes were made.`)
+ .setDescription("No changes were made.")
.setStatus("Danger")
- ], components: []})
+ ], components: []});
}
-}
+};
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
- 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"
+ const member = (interaction.member as GuildMember);
+ const me = (interaction.guild.me as GuildMember);
+ const apply = (interaction.options.getMember("user") as GuildMember);
+ if (member === null || me === null || apply === null) throw "That member is not in the server";
// Check if Nucleus has permission to role
if (!me.permissions.has("MANAGE_ROLES")) throw "I do not have the *Manage Roles* permission";
// Allow the owner to role anyone
- if (member.id === interaction.guild.ownerId) return true
+ if (member.id === interaction.guild.ownerId) return true;
// Check if the user has manage_roles permission
if (! member.permissions.has("MANAGE_ROLES")) throw "You do not have the *Manage Roles* permission";
// Allow role
return true;
-}
+};
export { command };
export { callback };