Фиксы

This commit is contained in:
JonnyBro 2022-01-17 13:43:36 +05:00
parent cffb648f6a
commit a46de830fb

View file

@ -17,7 +17,9 @@ class Say extends Command {
} }
async run(message, args) { async run(message, args) {
if (!args[0]) return message.delete(); if (!args[0]) {
if (message.deletable) return message.delete();
}
// Arguments split // Arguments split
const split = "++"; const split = "++";
@ -27,8 +29,25 @@ class Say extends Command {
let attachment = null; let attachment = null;
if (message.attachments.size > 0) attachment = message.attachments.first(); if (message.attachments.size > 0) attachment = message.attachments.first();
if (args[1] && !args[2]) { if (!args[1] && !args[2]) {
message.delete(); if (message.deletable) message.delete();
const saychannel = message.channel;
saychannel.sendTyping();
setTimeout(function () {
if (attachment) saychannel.send({
content: args[0],
files: [{
name: attachment.name,
attachment: attachment.url
}]
});
else saychannel.send({
content: args[0]
});
}, 2000);
} else if (args[1] && !args[2]) {
if (message.deletable) message.delete();
const saychannel = message.guild.channels.cache.find(channel => channel.name == args[1] || channel.id == args[1]); const saychannel = message.guild.channels.cache.find(channel => channel.name == args[1] || channel.id == args[1]);
saychannel.sendTyping(); saychannel.sendTyping();
@ -45,26 +64,10 @@ class Say extends Command {
}); });
}, 2000); }, 2000);
} else if (args[2]) { } else if (args[2]) {
if (message.deletable) message.delete();
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]); 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]);
saychannel.sendTyping(); saychannel.sendTyping();
setTimeout(function () {
if (attachment) saychannel.send({
content: args[0],
files: [{
name: attachment.name,
attachment: attachment.url
}]
});
else saychannel.send({
content: args[0]
});
}, 2000);
} else {
message.delete();
const saychannel = message.channel;
saychannel.sendTyping();
setTimeout(function () { setTimeout(function () {
if (attachment) saychannel.send({ if (attachment) saychannel.send({
content: args[0], content: args[0],