JaBa/commands/Owner/say.js

68 lines
1.7 KiB
JavaScript
Raw Normal View History

2021-12-13 18:27:54 +05:00
const Command = require("../../base/Command.js");
class Say extends Command {
2021-12-26 19:29:37 +05:00
constructor(client) {
2021-12-13 18:27:54 +05:00
super(client, {
name: "say",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
2021-12-26 19:29:37 +05:00
botPermissions: ["SEND_MESSAGES"],
2021-12-13 18:27:54 +05:00
nsfw: false,
ownerOnly: true,
cooldown: 2000
2021-12-13 18:27:54 +05:00
});
}
2021-12-26 19:29:37 +05:00
async run(message, args, data) {
2021-12-22 17:39:10 +05:00
if (!args[0]) return message.delete();
2021-12-13 18:27:54 +05:00
// Arguments split
let split = "++";
args = args.join(" ").split(split);
for (var i = 0; i < args.length; i++) args[i] = args[i].trim();
2022-01-03 23:20:33 +05:00
if (message.attachments.size > 0) var attachment = message.attachments.first().url;
2021-12-13 18:27:54 +05:00
if (args[1] && !args[2]) {
message.delete();
const saychannel = message.guild.channels.cache.find(channel => channel.name == args[1] || channel.id == args[1]);
2022-01-03 23:20:33 +05:00
saychannel.sendTyping();
2021-12-13 18:27:54 +05:00
2021-12-26 19:29:37 +05:00
setTimeout(function () {
2022-01-03 23:20:33 +05:00
if (attachment) saychannel.send({
content: args[0],
2021-12-26 19:29:37 +05:00
files: [attachment]
});
2022-01-03 23:20:33 +05:00
else saychannel.send({ content: args[0] });
2021-12-13 18:27:54 +05:00
}, 2000);
} else if (args[2]) {
const saychannel = this.client.guilds.cache.find(guild => guild.name == args[2] || guild.id == args[2]).channels.cache.find(channel => channel.name == args[1] || channel.id == args[1]);
2022-01-03 23:20:33 +05:00
saychannel.sendTyping();
2021-12-13 18:27:54 +05:00
2021-12-26 19:29:37 +05:00
setTimeout(function () {
2022-01-03 23:20:33 +05:00
if (attachment) saychannel.send({
content: args[0],
2021-12-26 19:29:37 +05:00
files: [attachment]
});
2022-01-03 23:20:33 +05:00
else saychannel.send({ content: args[0] });
2021-12-13 18:27:54 +05:00
}, 2000);
} else {
message.delete();
const saychannel = message.channel;
2022-01-03 23:20:33 +05:00
saychannel.sendTyping();
2021-12-13 18:27:54 +05:00
2021-12-26 19:29:37 +05:00
setTimeout(function () {
2022-01-03 23:20:33 +05:00
if (attachment) saychannel.send({
content: args[0],
2021-12-26 19:29:37 +05:00
files: [attachment]
});
2022-01-03 23:20:33 +05:00
else saychannel.send({ content: args[0] });
2021-12-13 18:27:54 +05:00
}, 2000);
};
}
};
module.exports = Say;