From fd36596b713dc306814deff510fab75e8b3fdfa2 Mon Sep 17 00:00:00 2001 From: Dalton Date: Thu, 6 Dec 2018 22:50:22 -0800 Subject: [PATCH] more bad dalton coding fixes --- bot.js | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/bot.js b/bot.js index fe17594..a9993fb 100644 --- a/bot.js +++ b/bot.js @@ -485,33 +485,39 @@ client.on('message', message => { break; case 'summon': - // Dalton's image summon command. - // Checks for banned author's using a hard coded list of discord ids. - // Also rudely cleans garbage entries. - let bannedAuthors = ['143999140878090240']; - if (bannedAuthors.contains(message.author)) { + try { + // Dalton's image summon command. + // Checks for banned author's using a hard coded list of discord ids. + // Also rudely cleans garbage entries. + let banned_authors = ['143999140878090240']; + if (banned_authors.includes(message.author)) { - let messageSplit = message.content.substring(2).split(' '); - if (messageSplit.length >= 2) { - let redditToSummon = messageSplit[1].replace(/[^a-zA-Z0-9_\-]+/g, ""); + let messageSplit = message.content.substring(2).split(' '); + if (messageSplit.length >= 2) { + let redditToSummon = messageSplit[1].replace(/[^a-zA-Z0-9_\-]+/g, ""); - // Valid Argument - if (redditToSummon) { + // Valid Argument + if (redditToSummon) { - message.channel.send(message.author + ' summons *' + redditToSummon + '*\n'); - let site_response = bestEffortRequest(redditToSummon, 5); + message.channel.send(message.author + ' summons *' + redditToSummon + '*\n'); + let site_response = bestEffortRequest(redditToSummon, 5); - if (site_response) { - message.channel.send(redditResponse); + if (site_response) { + message.channel.send(redditResponse); + } + + // Missing Argumentg + } else { + message.reply("wut do i summon?"); } - - // Missing Argument - } else { - message.reply("wut do i summon?"); } + } else { + message.reply("You're a bad boi and a banned author, you can't summon til you learn to behave.") } - } else { - message.reply("You're a bad boi and a banned author, you can't summon til you learn to behave.") + } catch (error) { + message.channel.send(error.stack); + message.channel.send(error.name); + message.channel.send(error.message); } break;