2022-08-04 19:26:17 +05:00
|
|
|
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
|
2022-08-04 19:26:17 +05:00
|
|
|
*/
|
|
|
|
constructor(client) {
|
|
|
|
super({
|
|
|
|
command: new SlashCommandBuilder()
|
|
|
|
.setName("afk")
|
|
|
|
.setDescription(client.translate("general/afk:DESCRIPTION"))
|
2023-06-15 19:46:27 +05:00
|
|
|
.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"),
|
2023-06-15 19:46:27 +05:00
|
|
|
})
|
2022-10-13 00:05:36 +05:00
|
|
|
.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),
|
|
|
|
),
|
2022-08-04 19:26:17 +05:00
|
|
|
dirname: __dirname,
|
2022-12-15 21:02:38 +05:00
|
|
|
ownerOnly: false,
|
2022-08-04 19:26:17 +05:00
|
|
|
});
|
|
|
|
}
|
2024-02-06 21:45:53 +05:00
|
|
|
|
2022-08-04 19:26:17 +05:00
|
|
|
/**
|
|
|
|
*
|
2023-11-05 16:03:23 +05:00
|
|
|
* @param {import("../../base/Client")} client
|
2022-08-04 19:26:17 +05:00
|
|
|
* @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 });
|
2023-06-15 19:46:27 +05:00
|
|
|
|
2024-02-09 23:26:57 +05:00
|
|
|
const userData = interaction.data.user,
|
|
|
|
reason = interaction.options.getString("message");
|
2022-08-04 19:26:17 +05:00
|
|
|
|
2024-02-09 23:26:57 +05:00
|
|
|
userData.afk = reason;
|
2023-09-25 21:42:43 +05:00
|
|
|
|
2024-02-09 23:26:57 +05:00
|
|
|
userData.markModified("afk");
|
|
|
|
await userData.save();
|
2022-08-04 19:26:17 +05:00
|
|
|
|
|
|
|
interaction.success("general/afk:SUCCESS", {
|
2022-12-15 21:02:38 +05:00
|
|
|
reason,
|
2023-06-15 19:46:27 +05:00
|
|
|
}, { edit: true });
|
2022-08-04 19:26:17 +05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-05 00:58:06 +05:00
|
|
|
module.exports = Afk;
|