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 {
|
|
|
|
/**
|
|
|
|
*
|
2023-11-05 16:03:23 +05:00
|
|
|
* @param {import("../base/Client")} client
|
2022-07-29 23:31:08 +05:00
|
|
|
*/
|
|
|
|
constructor(client) {
|
|
|
|
super({
|
|
|
|
command: new SlashCommandBuilder()
|
|
|
|
.setName("say")
|
|
|
|
.setDescription(client.translate("owner/say:DESCRIPTION"))
|
2023-06-15 19:46:27 +05:00
|
|
|
.setDescriptionLocalizations({
|
2023-07-05 00:58:06 +05:00
|
|
|
uk: client.translate("owner/say:DESCRIPTION", null, "uk-UA"),
|
|
|
|
ru: client.translate("owner/say:DESCRIPTION", null, "ru-RU"),
|
2023-06-15 19:46:27 +05:00
|
|
|
})
|
2022-10-13 00:05:36 +05:00
|
|
|
.setDMPermission(false)
|
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),
|
|
|
|
)
|
|
|
|
.addChannelOption(option =>
|
|
|
|
option
|
|
|
|
.setName("channel")
|
|
|
|
.setDescription(client.translate("common:CHANNEL"))
|
|
|
|
.setDescriptionLocalizations({
|
|
|
|
uk: client.translate("common:CHANNEL", null, "uk-UA"),
|
|
|
|
ru: client.translate("common:CHANNEL", null, "ru-RU"),
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
.addAttachmentOption(option =>
|
|
|
|
option
|
|
|
|
.setName("attachment")
|
|
|
|
.setDescription(client.translate("common:ATTACHMENT"))
|
|
|
|
.setDescriptionLocalizations({
|
|
|
|
uk: client.translate("common:ATTACHMENT", null, "uk-UA"),
|
|
|
|
ru: client.translate("common:ATTACHMENT", null, "ru-RU"),
|
|
|
|
}),
|
|
|
|
),
|
2022-07-29 23:31:08 +05:00
|
|
|
dirname: __dirname,
|
2022-12-15 21:02:38 +05:00
|
|
|
ownerOnly: true,
|
2022-07-29 23:31:08 +05:00
|
|
|
});
|
|
|
|
}
|
2024-02-06 21:45:53 +05:00
|
|
|
|
2022-07-29 23:31:08 +05:00
|
|
|
/**
|
|
|
|
*
|
2023-11-05 16:03:23 +05:00
|
|
|
* @param {import("../../base/Client")} client
|
2022-08-01 20:06:09 +05:00
|
|
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
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"),
|
2023-07-05 00:58:06 +05:00
|
|
|
attachment = interaction.options.getAttachment("attachment"),
|
2023-01-09 01:39:13 +05:00
|
|
|
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,
|
2023-07-05 00:58:06 +05:00
|
|
|
files: attachment ? [{
|
|
|
|
name: attachment.name,
|
|
|
|
attachment: attachment.url,
|
|
|
|
}] : null,
|
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,
|
2023-07-05 00:58:06 +05:00
|
|
|
files: attachment ? [{
|
|
|
|
name: attachment.name,
|
|
|
|
attachment: attachment.url,
|
|
|
|
}] : null,
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-05 00:58:06 +05:00
|
|
|
module.exports = Say;
|