JaBa/commands/General/afk.js

57 lines
1.4 KiB
JavaScript
Raw Permalink Normal View History

const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Afk extends BaseCommand {
/**
*
2023-11-05 16:03:23 +05:00
* @param {import("../base/Client")} client
*/
constructor(client) {
super({
command: new SlashCommandBuilder()
.setName("afk")
.setDescription(client.translate("general/afk:DESCRIPTION"))
.setDescriptionLocalizations({
2023-07-05 00:58:06 +05:00
uk: client.translate("general/afk:DESCRIPTION", null, "uk-UA"),
ru: client.translate("general/afk:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(true)
2023-07-05 00:58:06 +05:00
.addStringOption(option =>
option
.setName("message")
.setDescription(client.translate("common:MESSAGE"))
.setDescriptionLocalizations({
uk: client.translate("common:MESSAGE", null, "uk-UA"),
ru: client.translate("common:MESSAGE", null, "ru-RU"),
})
.setRequired(true),
),
dirname: __dirname,
ownerOnly: false,
});
}
/**
*
2023-11-05 16:03:23 +05:00
* @param {import("../../base/Client")} client
* @param {import("discord.js").ChatInputCommandInteraction} interaction
*/
2024-02-09 23:26:57 +05:00
async execute(client, interaction) {
2024-01-27 16:31:34 +05:00
await interaction.deferReply({ ephemeral: true });
2024-02-09 23:26:57 +05:00
const userData = interaction.data.user,
reason = interaction.options.getString("message");
2024-02-09 23:26:57 +05:00
userData.afk = reason;
2024-02-09 23:26:57 +05:00
userData.markModified("afk");
await userData.save();
interaction.success("general/afk:SUCCESS", {
reason,
}, { edit: true });
}
}
2023-07-05 00:58:06 +05:00
module.exports = Afk;