-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #379
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
|
||
module.exports = { | ||
data: new SlashCommandBuilder() | ||
.setName('baninfo') | ||
.setDescription('Shows details of a ban') | ||
.addIntegerOption(option => | ||
option.setName('banid') | ||
.setDescription('Ban ID') | ||
.setRequired(true)), | ||
async execute(interaction, exports) { | ||
const banId = interaction.options.getInteger('banid') | ||
|
||
var ban = await exports[EasyAdmin].fetchBan(banId) | ||
if (ban) { | ||
|
||
// TODO: embed | ||
|
||
|
||
var embed = new EmbedBuilder() | ||
.setColor((65280)) | ||
.setTimestamp() | ||
|
||
var discordAccount = false | ||
for (let identifier of ban.identifiers) { | ||
if (identifier.search("discord:") != -1) { | ||
discordAccount = await client.users.fetch(identifier.substring(identifier.indexOf(":") + 1)) | ||
} | ||
} | ||
|
||
embed.addFields({ name: 'Ban Info', value: `Ban infos for **#${banId}**`}) | ||
embed.addFields({ name: 'Username', value: `\`\`\`${ban.name}\`\`\``, inline: true}) | ||
if (discordAccount) { | ||
embed.addFields({ name: 'Discord Account', value: `\`\`\`${discordAccount.tag}\`\`\``, inline: true}) | ||
embed.setThumbnail(discordAccount.avatarURL()) | ||
} | ||
embed.addFields({ name: 'Banned by', value: `\`\`\`${ban.banner}\`\`\``, inline: true}) | ||
embed.addFields({ name: 'Reason', value: `\`\`\`\n${ban.reason}\`\`\``, inline: false}) | ||
embed.addFields({ name: 'Expires', value: `\`\`\`${ban.expireString}\`\`\``, inline: true}) | ||
|
||
|
||
interaction.reply({ embeds: [embed]}) | ||
|
||
|
||
} else { | ||
var embed = await prepareGenericEmbed(`No ban was found with this ID.`) | ||
interaction.reply({ embeds: [embed]}) | ||
} | ||
}, | ||
}; |