mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
Новая команда say
This commit is contained in:
parent
739938a341
commit
0b8dc1de0e
6 changed files with 68 additions and 5 deletions
|
@ -27,10 +27,11 @@ class Eval extends Command {
|
|||
const result = new Promise((resolve) => resolve(eval(content)));
|
||||
|
||||
return result.then((output) => {
|
||||
if (typeof output !== "string") output = require("util").inspect(output, { depth: 0 });
|
||||
if (typeof output != "string") output = require("util").inspect(output, { depth: 0 });
|
||||
if (output.includes(this.client.token)) output = output.replace(this.client.token, "T0K3N");
|
||||
message.channel.send(output, { code: "js" });
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
err = err.toString();
|
||||
if (err.includes(this.client.token)) err = err.replace(this.client.token, "T0K3N");
|
||||
message.channel.send(err, { code: "js" });
|
||||
|
|
57
commands/Owner/say.js
Normal file
57
commands/Owner/say.js
Normal file
|
@ -0,0 +1,57 @@
|
|||
const Command = require("../../base/Command.js");
|
||||
|
||||
class Say extends Command {
|
||||
constructor (client) {
|
||||
super(client, {
|
||||
name: "say",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: [],
|
||||
memberPermissions: [],
|
||||
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ],
|
||||
nsfw: false,
|
||||
ownerOnly: true,
|
||||
cooldown: 3000
|
||||
});
|
||||
}
|
||||
|
||||
async run (message, args, data) {
|
||||
// Arguments split
|
||||
let split = "++";
|
||||
args = args.join(" ").split(split);
|
||||
for (var i = 0; i < args.length; i++) args[i] = args[i].trim();
|
||||
|
||||
if (!args[0]) return message.delete();
|
||||
|
||||
if (args[1] && !args[2]) {
|
||||
message.delete();
|
||||
const saychannel = message.guild.channels.cache.find(channel => channel.name == args[1] || channel.id == args[1]);
|
||||
saychannel.startTyping();
|
||||
|
||||
setTimeout(function() {
|
||||
saychannel.send(args[0]);
|
||||
saychannel.stopTyping();
|
||||
}, 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]);
|
||||
saychannel.startTyping();
|
||||
|
||||
setTimeout(function() {
|
||||
saychannel.send(args[0]);
|
||||
saychannel.stopTyping();
|
||||
}, 2000);
|
||||
} else {
|
||||
message.delete();
|
||||
const saychannel = message.channel;
|
||||
saychannel.startTyping();
|
||||
|
||||
setTimeout(function() {
|
||||
saychannel.send(args[0]);
|
||||
saychannel.stopTyping();
|
||||
}, 2000);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = Say;
|
|
@ -142,7 +142,7 @@ module.exports = class {
|
|||
|
||||
if (!cmd.conf.enabled) return message.error("misc:COMMAND_DISABLED");
|
||||
|
||||
if (cmd.conf.ownerOnly && message.author.id !== client.config.owner.id)return message.error("misc:OWNER_ONLY");
|
||||
if (cmd.conf.ownerOnly && message.author.id !== client.config.owner.id) return message.error("misc:OWNER_ONLY");
|
||||
|
||||
let uCooldown = cmdCooldown[message.author.id];
|
||||
if (!uCooldown) {
|
||||
|
@ -153,7 +153,7 @@ module.exports = class {
|
|||
if (time && (time > Date.now())) return message.error("misc:COOLDOWNED", { seconds: Math.ceil((time-Date.now())/1000) });
|
||||
cmdCooldown[message.author.id][cmd.help.name] = Date.now() + cmd.conf.cooldown;
|
||||
|
||||
client.logger.log(`${message.author.username} (${message.author.id}) ran command ${cmd.help.name} on ${message.guild.name}`, "cmd");
|
||||
client.logger.log(`${message.author.username} (${message.author.id}) ran command ${cmd.help.name} ${message.guild ? `on ${message.guild.name}` : "in DM"}`, "cmd");
|
||||
|
||||
const log = new this.client.logs({
|
||||
commandName: cmd.help.name,
|
||||
|
|
|
@ -36,7 +36,7 @@ module.exports = {
|
|||
};
|
||||
}).forEach((cmd) => {
|
||||
arrCat.push([
|
||||
`**${cmd.help.name}**`,
|
||||
`**${cmd.help.name}** ${cmd.help.aliases.length ? `**(${cmd.help.aliases.join(", ")})**` : ""}`,
|
||||
client.translate(`${cmd.help.category.toLowerCase()}/${cmd.help.name}:DESCRIPTION`),
|
||||
client.translate(`${cmd.help.category.toLowerCase()}/${cmd.help.name}:USAGE`),
|
||||
Math.ceil(cmd.conf.cooldown / 1000)+" секунд(а/ы)"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"DESCRIPTION": "Выполнить код!",
|
||||
"USAGE": "{{prefix}}eval [код]",
|
||||
"EXAMPLES": "{{prefix}}eval message.author.send(message.client.token)"
|
||||
"EXAMPLES": "{{prefix}}eval message.channel.send(\"Hello World!\")"
|
||||
}
|
5
languages/ru-RU/owner/say.json
Normal file
5
languages/ru-RU/owner/say.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"DESCRIPTION": "Написать сообщение от имени бота!",
|
||||
"USAGE": "{{prefix}}say [текст] ++ (ID/название_канала) ++ (ID/название_сервера)",
|
||||
"EXAMPLES": "{{prefix}}say Hello World!\n{{prefix}}say Hello World! ++ 123456789098765432"
|
||||
}
|
Loading…
Reference in a new issue