From 38fdece6c3b7b3b6a9b3cbe08a4ea7950c4e3c35 Mon Sep 17 00:00:00 2001 From: Trivernis Date: Sun, 23 Dec 2018 19:32:40 +0100 Subject: [PATCH] Code Cleanup --- lib/cmd.js | 18 +++++++++--------- lib/guilding.js | 4 ++-- lib/music.js | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/cmd.js b/lib/cmd.js index a67e488..b2e3aa8 100644 --- a/lib/cmd.js +++ b/lib/cmd.js @@ -12,7 +12,7 @@ let logger = require('winston'), exports.Servant = class { constructor(prefix) { this.commands = {}; - this.createCommand(((prefix || '~')+'help') || "~help", () => { + this.createCommand(((prefix || '~') + 'help') || "~help", () => { let helpstr = "```markdown\n"; helpstr += "Commands\n---\n"; // TODO: Duplicate commands should not appear or make two sections, one with global commands, one with server commands @@ -34,7 +34,7 @@ exports.Servant = class { * @param description */ createCommand(command, call, args, description) { - this.commands[command] = { + this.commands[command] = { 'args': args, 'description': description, 'callback': call @@ -78,7 +78,7 @@ exports.Servant = class { * Getting the logger * @param {Object} newLogger */ -exports.setLogger = function(newLogger) { +exports.setLogger = function (newLogger) { logger = newLogger; }; @@ -89,8 +89,8 @@ exports.setLogger = function(newLogger) { * @param args * @param description */ -exports.createGlobalCommand = function(command, call, args, description) { - globCommands[command] = { +exports.createGlobalCommand = function (command, call, args, description) { + globCommands[command] = { 'args': args || [], 'description': description, 'callback': call @@ -104,16 +104,16 @@ exports.createGlobalCommand = function(command, call, args, description) { * @param msg * @returns {boolean|*} */ -exports.parseMessage = function(msg) { +exports.parseMessage = function (msg) { return parseGlobalCommand(msg); -} +}; /** * Initializes the module by creating a help command */ -exports.init = function(prefix) { +exports.init = function (prefix) { logger.verbose("Created help command"); - this.createGlobalCommand((prefix+'help') || "~help", () => { + this.createGlobalCommand((prefix + 'help') || "~help", () => { let helpstr = "```markdown\n"; helpstr += "Commands\n---\n"; Object.entries(globCommands).forEach(([key, value]) => { diff --git a/lib/guilding.js b/lib/guilding.js index d833845..1afe3f6 100644 --- a/lib/guilding.js +++ b/lib/guilding.js @@ -182,11 +182,11 @@ exports.GuildHandler = class { // saved command - prints out saved playlists this.createCommand(prefix + 'saved', () => { - let response = '```markdown\nSaved Playlists:\n==\n' + let response = '```markdown\nSaved Playlists:\n==\n'; Object.entries(this.getData('savedplaylists')).forEach(([key, value]) => { response += `${key.padEnd(10, ' ')} ${value} \n\n`; }); - response += '```' + response += '```'; return response; }, [], "Prints out all saved playlists."); } diff --git a/lib/music.js b/lib/music.js index 7479b57..b7a563a 100644 --- a/lib/music.js +++ b/lib/music.js @@ -284,7 +284,7 @@ exports.DJ = class{ clear() { this.queue = []; } -} +}; /** * Getting the logger;