From 738d5472e0abb9b8bcacfd178da0a62116faa050 Mon Sep 17 00:00:00 2001 From: ChomeNS Date: Sun, 13 Nov 2022 14:41:59 +0700 Subject: [PATCH] usage fix and improve and real and real real --- commands/cloop.js | 7 ++++++- commands/eval.js | 6 +++++- commands/help.js | 4 +++- commands/music.js | 11 ++++++++++- commands/wikipedia.js | 2 +- plugins/commands.js | 11 +++++------ 6 files changed, 30 insertions(+), 11 deletions(-) diff --git a/commands/cloop.js b/commands/cloop.js index eeaeeea..a08458d 100644 --- a/commands/cloop.js +++ b/commands/cloop.js @@ -58,7 +58,12 @@ module.exports = { name: 'cloop', alias: [], description: 'Loop commands', - usage: ' ', + usage: [ + ' ', + ' ', + ' ', + ' ', + ], trusted: 1, execute: function(bot, username, usernameraw, sender, prefix, args) { if (!bot.cloops) bot.cloops = []; diff --git a/commands/eval.js b/commands/eval.js index a12c4c1..e79d1f3 100644 --- a/commands/eval.js +++ b/commands/eval.js @@ -10,7 +10,11 @@ module.exports = { alias: [], description: 'Safe eval 100% secure!!!', trusted: 0, - usage: ' ', + usage: [ + ' ', + '', + ' code', + ], execute: function(bot, username, usernameraw, sender, prefix, args, config) { if (args[0] === 'run') { try { diff --git a/commands/help.js b/commands/help.js index 526e0a4..84439b5 100644 --- a/commands/help.js +++ b/commands/help.js @@ -61,8 +61,10 @@ module.exports = { } else { command.usage.forEach((value) => { usage.push({text: `${prefix}${command.name} `, color: 'gold'}); - usage.push({text: `${value}\n`, color: 'aqua'}); + usage.push({text: value, color: 'aqua'}); + usage.push('\n'); }); + usage.pop(); } bot.tellraw('@a', [{text: prefix + command.name, color: 'gold'}, {text: ` (${alias})`, color: 'white'}, {text: ' - ', color: 'gray'}, {text: command.description, color: 'gray'}]); diff --git a/commands/music.js b/commands/music.js index d4cd02b..4ee0220 100644 --- a/commands/music.js +++ b/commands/music.js @@ -133,7 +133,16 @@ module.exports = { description: 'Plays music', alias: [], trusted: 0, - usage: ' ', + usage: [ + ' ', + ' ', + '', + ' ', + '', + '', + '', + '', + ], execute: function(bot, username, usernameraw, sender, prefix, args) { switch (args[0]) { case 'play': diff --git a/commands/wikipedia.js b/commands/wikipedia.js index c32566f..c48c91f 100644 --- a/commands/wikipedia.js +++ b/commands/wikipedia.js @@ -6,7 +6,7 @@ module.exports = { name: 'wikipedia', alias: ['wiki'], description: 'Working Wikipedia!', - usage: '', + usage: '', trusted: 0, execute: async function(bot, username, usernameraw, sender, prefix, args) { try { diff --git a/plugins/commands.js b/plugins/commands.js index 5f8115b..a702bde 100644 --- a/plugins/commands.js +++ b/plugins/commands.js @@ -1,17 +1,17 @@ /* eslint-disable max-len */ -const loadFiles = require('../util/load_files'); const path = require('path'); const {MessageEmbed} = require('discord.js'); function inject(bot, dcclient, config) { + const loadFiles = require('../util/load_files'); const channeldc = dcclient.channels.cache.get(config.discord.servers[bot.options.host]); bot.command_handler = {}; bot.command_handler.commands = {}; - function reload() { + bot.command_handler.reload = function() { bot.command_handler.commands = loadFiles(path.join(__dirname, config.commandsDir)); - } - reload(); + }; + bot.command_handler.reload(); bot.command_handler.main = function(prefix, username, usernameraw, message, sender, channeldc) { - reload(); + bot.command_handler.reload(); let raw; let command; message.content ? raw = message.content.substring(prefix.length) : raw = message.substring(prefix.length); @@ -48,7 +48,6 @@ function inject(bot, dcclient, config) { } }; bot.on('message', async (usernamee, messagee, senderr) => { - console.log() // try catch cuz TypeError: Cannot read properties of undefined (reading 'replace') try { const usernameraw = usernamee.replace(/§[a-f0-9rlonmk]/g, '').replace(/§/g, '');