2022-07-31 17:08:00 +05:00
|
|
|
const { SlashCommandBuilder } = require("discord.js");
|
2022-07-29 23:31:08 +05:00
|
|
|
const BaseCommand = require("../../base/BaseCommand");
|
|
|
|
|
|
|
|
class Say extends BaseCommand {
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
constructor(client) {
|
|
|
|
super({
|
|
|
|
command: new SlashCommandBuilder()
|
|
|
|
.setName("say")
|
|
|
|
.setDescription(client.translate("owner/say:DESCRIPTION"))
|
2023-03-26 18:31:19 +05:00
|
|
|
.setDescriptionLocalizations({ "uk": client.translate("owner/say:DESCRIPTION", null, "uk-UA") })
|
2022-10-13 00:05:36 +05:00
|
|
|
.setDMPermission(false)
|
2022-08-04 19:26:17 +05:00
|
|
|
.addStringOption(option => option.setName("message")
|
|
|
|
.setDescription(client.translate("common:MESSAGE"))
|
2023-03-26 18:31:19 +05:00
|
|
|
.setDescriptionLocalizations({ "uk": client.translate("common:MESSAGE", null, "uk-UA") })
|
2022-08-04 19:26:17 +05:00
|
|
|
.setRequired(true))
|
|
|
|
.addChannelOption(option => option.setName("channel")
|
2023-03-26 18:31:19 +05:00
|
|
|
.setDescription(client.translate("common:CHANNEL"))
|
|
|
|
.setDescriptionLocalizations({ "uk": client.translate("common:CHANNEL", null, "uk-UA") })),
|
2022-07-29 23:31:08 +05:00
|
|
|
aliases: [],
|
|
|
|
dirname: __dirname,
|
2022-12-15 21:02:38 +05:00
|
|
|
ownerOnly: true,
|
2022-07-29 23:31:08 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
async onLoad() {
|
|
|
|
//...
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
2022-08-01 20:06:09 +05:00
|
|
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
2022-08-09 23:48:33 +05:00
|
|
|
* @param {Object} data
|
2022-07-29 23:31:08 +05:00
|
|
|
*/
|
|
|
|
async execute(client, interaction) {
|
2022-07-31 17:08:00 +05:00
|
|
|
await interaction.deferReply({ ephemeral: true });
|
2023-01-09 01:39:13 +05:00
|
|
|
|
|
|
|
const message = interaction.options.getString("message"),
|
|
|
|
channel = interaction.options.getChannel("channel");
|
2022-07-29 23:31:08 +05:00
|
|
|
|
|
|
|
if (!channel) {
|
|
|
|
interaction.channel.sendTyping();
|
|
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
interaction.channel.send({
|
2022-12-15 21:02:38 +05:00
|
|
|
content: message,
|
2022-07-29 23:31:08 +05:00
|
|
|
});
|
|
|
|
|
|
|
|
interaction.replyT("owner/say:DONE", {
|
|
|
|
message,
|
2022-12-15 21:02:38 +05:00
|
|
|
channel: interaction.channel.toString(),
|
2022-07-29 23:31:08 +05:00
|
|
|
}, { edit: true });
|
|
|
|
}, 2000);
|
|
|
|
} else {
|
|
|
|
channel.sendTyping();
|
|
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
channel.send({
|
2022-12-15 21:02:38 +05:00
|
|
|
content: message,
|
2022-07-29 23:31:08 +05:00
|
|
|
});
|
|
|
|
|
|
|
|
interaction.replyT("owner/say:DONE", {
|
|
|
|
message,
|
2022-12-15 21:02:38 +05:00
|
|
|
channel: channel.toString(),
|
2022-07-29 23:31:08 +05:00
|
|
|
}, { edit: true });
|
|
|
|
}, 2000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Say;
|