JaBa/commands/Economy/setbio.js

53 lines
1.4 KiB
JavaScript
Raw Permalink Normal View History

2022-08-09 23:48:33 +05:00
const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Setbio extends BaseCommand {
/**
*
2023-11-05 16:03:23 +05:00
* @param {import("../base/Client")} client
2022-08-09 23:48:33 +05:00
*/
constructor(client) {
super({
command: new SlashCommandBuilder()
.setName("setbio")
.setDescription(client.translate("economy/setbio:DESCRIPTION"))
.setDescriptionLocalizations({
2023-07-05 00:58:06 +05:00
uk: client.translate("economy/setbio:DESCRIPTION", null, "uk-UA"),
ru: client.translate("economy/setbio:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(true)
2023-07-05 00:58:06 +05:00
.addStringOption(option =>
option
.setName("text")
.setDescription(client.translate("economy/profile:BIO"))
.setDescriptionLocalizations({
uk: client.translate("economy/profile:BIO", null, "uk-UA"),
ru: client.translate("economy/profile:BIO", null, "ru-RU"),
})
.setRequired(true),
),
2022-08-09 23:48:33 +05:00
dirname: __dirname,
ownerOnly: false,
2022-08-09 23:48:33 +05:00
});
}
2022-08-09 23:48:33 +05:00
/**
*
2023-11-05 16:03:23 +05:00
* @param {import("../../base/Client")} client
2022-08-09 23:48:33 +05:00
* @param {import("discord.js").ChatInputCommandInteraction} interaction
*/
2024-02-09 23:26:57 +05:00
async execute(client, interaction) {
const userData = interaction.data.user,
newBio = interaction.options.getString("text");
2022-08-09 23:48:33 +05:00
if (newBio.length > 150) return interaction.error("economy/setbio:MAX_CHARACTERS");
2024-02-09 23:26:57 +05:00
userData.bio = newBio;
2024-02-09 23:26:57 +05:00
await userData.save();
2023-07-03 19:30:47 +05:00
2022-08-09 23:48:33 +05:00
interaction.success("economy/setbio:SUCCESS");
}
}
2023-07-05 00:58:06 +05:00
module.exports = Setbio;