Still got errors and warnings, mostly the same and easy to fix
diff --git a/src/commands/mod/unban.ts b/src/commands/mod/unban.ts
index 2605d28..faf1f08 100644
--- a/src/commands/mod/unban.ts
+++ b/src/commands/mod/unban.ts
@@ -8,46 +8,46 @@
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
- .setName("unban")
- .setDescription("Unbans a user")
- .addStringOption(option => option.setName("user").setDescription("The user to unban (Username or ID)").setRequired(true))
+ .setName("unban")
+ .setDescription("Unbans a user")
+ .addStringOption(option => option.setName("user").setDescription("The user to unban (Username or ID)").setRequired(true));
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())
+ const bans = await interaction.guild.bans.fetch();
+ const 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());
if (!resolved) {
return interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Unban")
.setDescription(`Could not find any user called \`${user}\``)
.setEmoji("PUNISH.UNBAN.RED")
.setStatus("Danger")
- ], ephemeral: true})
+ ], ephemeral: true});
}
// TODO:[Modals] Replace this with a modal
- let confirmation = await new confirmationMessage(interaction)
+ const confirmation = await new confirmationMessage(interaction)
.setEmoji("PUNISH.UNBAN.RED")
.setTitle("Unban")
.setDescription(keyValueList({
- "user": `${resolved.user.username} [<@${resolved.user.id}>]`,
+ "user": `${resolved.user.username} [<@${resolved.user.id}>]`
})
+ `Are you sure you want to unban <@${resolved.user.id}>?`)
.setColor("Danger")
- .send()
- if (confirmation.cancelled) return
+ .send();
+ if (confirmation.cancelled) return;
if (confirmation.success) {
try {
await interaction.guild.members.unban(resolved.user as User, "Unban");
- let member = (resolved.user as User)
- try { await client.database.history.create("unban", interaction.guild.id, member, interaction.user) } catch {}
- const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger
- let data = {
+ const member = (resolved.user as User);
+ await client.database.history.create("unban", interaction.guild.id, member, interaction.user);
+ const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
+ const data = {
meta: {
- type: 'memberUnban',
- displayName: 'Member Unbanned',
- calculateType: 'guildMemberPunish',
+ type: "memberUnban",
+ displayName: "Member Unbanned",
+ calculateType: "guildMemberPunish",
color: NucleusColors.green,
emoji: "PUNISH.BAN.GREEN",
timestamp: new Date().getTime()
@@ -57,48 +57,48 @@
name: entry(member.id, renderUser(member)),
unbanned: entry(new Date().getTime(), renderDelta(new Date().getTime())),
unbannedBy: entry(interaction.user.id, renderUser(interaction.user)),
- accountCreated: entry(member.createdAt, renderDelta(member.createdAt)),
+ accountCreated: entry(member.createdAt, renderDelta(member.createdAt))
},
hidden: {
guild: interaction.guild.id
}
- }
+ };
log(data);
} catch {
await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji("PUNISH.UNBAN.RED")
- .setTitle(`Unban`)
+ .setTitle("Unban")
.setDescription("Something went wrong and the user was not unbanned")
.setStatus("Danger")
- ], components: []})
+ ], components: []});
}
await interaction.editReply({embeds: [new EmojiEmbed()
- .setEmoji(`PUNISH.UNBAN.GREEN`)
- .setTitle(`Unban`)
+ .setEmoji("PUNISH.UNBAN.GREEN")
+ .setTitle("Unban")
.setDescription("The member was unbanned")
.setStatus("Success")
- ], components: []})
+ ], components: []});
} else {
await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji("PUNISH.UNBAN.GREEN")
- .setTitle(`Unban`)
+ .setTitle("Unban")
.setDescription("No changes were made")
.setStatus("Success")
- ], components: []})
+ ], components: []});
}
-}
+};
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
- let member = (interaction.member as GuildMember)
- let me = (interaction.guild.me as GuildMember)
+ const member = (interaction.member as GuildMember);
+ const 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";
// 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";
// Allow unban
- return true
-}
+ return true;
+};
export { command, callback, check };
\ No newline at end of file