JaBa/commands/Owner/say.js
2022-07-29 23:31:08 +05:00

75 lines
No EOL
1.7 KiB
JavaScript

const { SlashCommandBuilder } = require("@discordjs/builders");
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"))
.addStringOption(option =>
option.setName("message")
.setDescription(client.translate("owner/say:MESSAGE"))
.setRequired(true))
.addChannelOption(option =>
option.setName("channel")
.setDescription(client.translate("owner/say:CHANNEL"))),
aliases: [],
dirname: __dirname,
guildOnly: true,
ownerOnly: true
});
}
/**
*
* @param {import("../../base/JaBa")} client
*/
async onLoad() {
//...
}
/**
*
* @param {import("../../base/JaBa")} client
* @param {import("discord.js").CommandInteraction} interaction
* @param {Array} data
*/
async execute(client, interaction) {
interaction.deferReply({ ephemeral: true });
const message = interaction.options.getString("message");
const channel = interaction.options.getChannel("channel");
if (!channel) {
interaction.channel.sendTyping();
setTimeout(function () {
interaction.channel.send({
content: message
});
interaction.replyT("owner/say:DONE", {
message,
channel: interaction.channel.toString()
}, { edit: true });
}, 2000);
} else {
channel.sendTyping();
setTimeout(function () {
channel.send({
content: message
});
interaction.replyT("owner/say:DONE", {
message,
channel: channel.toString()
}, { edit: true });
}, 2000);
}
}
}
module.exports = Say;