2022-08-04 19:26:17 +05:00
|
|
|
const { SlashCommandBuilder } = require("discord.js");
|
|
|
|
const BaseCommand = require("../../base/BaseCommand");
|
|
|
|
|
|
|
|
class Avatar extends BaseCommand {
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
constructor(client) {
|
|
|
|
super({
|
|
|
|
command: new SlashCommandBuilder()
|
|
|
|
.setName("avatar")
|
|
|
|
.setDescription(client.translate("general/avatar:DESCRIPTION"))
|
2023-06-15 19:46:27 +05:00
|
|
|
.setDescriptionLocalizations({
|
|
|
|
"uk": client.translate("general/avatar:DESCRIPTION", null, "uk-UA"),
|
|
|
|
"ru": client.translate("general/avatar:DESCRIPTION", null, "ru-RU"),
|
|
|
|
})
|
2022-10-13 00:05:36 +05:00
|
|
|
.setDMPermission(true)
|
2022-08-04 19:26:17 +05:00
|
|
|
.addUserOption(option => option.setName("user")
|
2023-03-26 18:31:19 +05:00
|
|
|
.setDescription(client.translate("common:USER"))
|
2023-06-15 19:46:27 +05:00
|
|
|
.setDescriptionLocalizations({
|
|
|
|
"uk": client.translate("common:USER", null, "uk-UA"),
|
|
|
|
"ru": client.translate("common:USER", null, "ru-RU"),
|
|
|
|
}))
|
|
|
|
.addBooleanOption(option => option.setName("server")
|
|
|
|
.setDescription(client.translate("general/avatar:SERVER"))
|
|
|
|
.setDescriptionLocalizations({
|
|
|
|
"uk": client.translate("general/avatar:SERVER", null, "uk-UA"),
|
|
|
|
"ru": client.translate("general/avatar:SERVER", null, "ru-RU"),
|
|
|
|
})),
|
2022-08-04 19:26:17 +05:00
|
|
|
aliases: [],
|
|
|
|
dirname: __dirname,
|
2022-12-15 21:02:38 +05:00
|
|
|
ownerOnly: false,
|
2022-08-04 19:26:17 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
async onLoad() {
|
|
|
|
//...
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
|
|
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
2022-08-09 23:48:33 +05:00
|
|
|
* @param {Object} data
|
2022-08-04 19:26:17 +05:00
|
|
|
*/
|
|
|
|
async execute(client, interaction) {
|
2023-06-15 19:46:27 +05:00
|
|
|
const member = interaction.options.getMember("user") || interaction.member;
|
|
|
|
const avatarURL = interaction.options.getBoolean("server") ? member.avatarURL({ size: 512 }) : member.user.avatarURL({ size: 512 });
|
2022-08-04 19:26:17 +05:00
|
|
|
|
|
|
|
interaction.reply({
|
|
|
|
files: [{
|
2022-12-15 21:02:38 +05:00
|
|
|
attachment: avatarURL,
|
|
|
|
}],
|
2022-08-04 19:26:17 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Avatar;
|