JaBa/commands/General/userinfo.js

100 lines
3.1 KiB
JavaScript
Raw Normal View History

const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Userinfo extends BaseCommand {
/**
*
2023-11-05 16:03:23 +05:00
* @param {import("../base/Client")} client
*/
constructor(client) {
super({
command: new SlashCommandBuilder()
.setName("userinfo")
.setDescription(client.translate("general/userinfo:DESCRIPTION"))
.setDescriptionLocalizations({
2023-07-05 00:58:06 +05:00
uk: client.translate("general/userinfo:DESCRIPTION", null, "uk-UA"),
ru: client.translate("general/userinfo:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false)
2023-07-05 00:58:06 +05:00
.addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({
uk: client.translate("common:USER", null, "uk-UA"),
ru: client.translate("common:USER", null, "ru-RU"),
}),
),
dirname: __dirname,
ownerOnly: false,
});
}
/**
*
2023-11-05 16:03:23 +05:00
* @param {import("../../base/Client")} client
* @param {import("discord.js").ChatInputCommandInteraction} interaction
2022-08-09 23:48:33 +05:00
* @param {Object} data
*/
2023-12-14 18:58:19 +05:00
async execute(client, interaction) {
const member = interaction.options.getMember("user") || interaction.member;
const embed = client.embed({
author: {
name: `${member.user.getUsername()} (${member.id})`,
iconURL: member.displayAvatarURL(),
},
thumbnail: member.displayAvatarURL(),
fields: [
{
name: ":man: " + interaction.translate("common:USERNAME"),
value: member.user.getUsername(),
inline: true,
},
{
name: client.customEmojis.pencil + " " + interaction.translate("common:NICKNAME"),
value: member.nickname || interaction.translate("general/userinfo:NO_NICKNAME"),
inline: true,
},
{
name: client.customEmojis.bot + " " + interaction.translate("common:ROBOT"),
value: member.user.bot ? interaction.translate("common:YES") : interaction.translate("common:NO"),
inline: true,
},
{
name: client.customEmojis.calendar + " " + interaction.translate("common:CREATION"),
value: `<t:${member.user.createdTimestamp}:D>`,
inline: true,
},
{
2022-08-09 23:48:33 +05:00
name: client.customEmojis.calendar2 + " " + interaction.translate("common:JOINED"),
value: `<t:${member.joinedTimestamp}:D>`,
inline: true,
},
{
name: client.customEmojis.color + " " + interaction.translate("common:COLOR"),
value: member.displayHexColor,
inline: true,
},
{
name: client.customEmojis.roles + " " + interaction.translate("common:ROLES"),
2023-07-05 00:58:06 +05:00
value:
member.roles.size > 10
? member.roles.cache.map(r => r).filter(r => r.id !== interaction.guild.roles.everyone.id).slice(0, 10).join(", ") + " " +
interaction.translate("general/userinfo:MORE_ROLES", {
count: member.roles.cache.size - 10,
})
: member.roles.cache.size < 1 ? interaction.translate("general/userinfo:NO_ROLE") : member.roles.cache.map(r => r).filter(r => r.id !== interaction.guild.roles.everyone.id).slice(0, 10).join(", "),
inline: true,
},
],
});
interaction.reply({
embeds: [embed],
});
}
}
2023-07-05 00:58:06 +05:00
module.exports = Userinfo;