Bug fixes and ~~performance~~ typing improvements
diff --git a/src/commands/role/user.ts b/src/commands/role/user.ts
index 2557b4b..3b3eb79 100644
--- a/src/commands/role/user.ts
+++ b/src/commands/role/user.ts
@@ -11,16 +11,10 @@
.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)
+ 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)
+ option.setName("role").setDescription("The role to give or remove").setRequired(true)
)
.addStringOption((option) =>
option
@@ -33,9 +27,7 @@
])
);
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
const { renderUser, renderRole } = client.logger;
const action = interaction.options.getString("action");
// TODO:[Modals] Replace this with a modal
@@ -48,9 +40,7 @@
role: renderRole(interaction.options.getRole("role"))
}) +
`\nAre you sure you want to ${
- action === "give"
- ? "give the role to"
- : "remove the role from"
+ action === "give" ? "give the role to" : "remove the role from"
} ${interaction.options.getUser("user")}?`
)
.setColor("Danger")
@@ -70,9 +60,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Role")
- .setDescription(
- "Something went wrong and the role could not be added"
- )
+ .setDescription("Something went wrong and the role could not be added")
.setStatus("Danger")
.setEmoji("CONTROL.BLOCKCROSS")
],
@@ -83,11 +71,7 @@
embeds: [
new EmojiEmbed()
.setTitle("Role")
- .setDescription(
- `The role has been ${
- action === "give" ? "given" : "removed"
- } successfully`
- )
+ .setDescription(`The role has been ${action === "give" ? "given" : "removed"} successfully`)
.setStatus("Success")
.setEmoji("GUILD.ROLES.CREATE")
],
@@ -107,23 +91,17 @@
}
};
-const check = (
- interaction: CommandInteraction,
- _defaultCheck: WrappedCheck
-) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
const member = interaction.member as GuildMember;
const me = interaction.guild.me!;
const 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";
// Check if Nucleus has permission to role
- if (!me.permissions.has("MANAGE_ROLES"))
- throw "I do not have the *Manage Roles* permission";
+ 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;
// Check if the user has manage_roles permission
- 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";
// Allow role
return true;
};