undid refactor
This commit is contained in:
60
bot.js
60
bot.js
@@ -116,37 +116,6 @@ function bestEffortRequest(subpage, page_max) {
|
||||
return "I couldn't find that, sauce?";
|
||||
}
|
||||
|
||||
// Dalton's image summon command.
|
||||
// Checks for banned author's using a hard coded list of discord ids.
|
||||
// Also rudely cleans garbage entries.
|
||||
function summonCommand() {
|
||||
let bannedAuthors = ['143999140878090240'];
|
||||
if (bannedAuthors.contains(message.author)) {
|
||||
|
||||
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) {
|
||||
|
||||
message.channel.send(message.author + ' summons *' + redditToSummon + '*\n');
|
||||
let site_response = bestEffortRequest(redditToSummon, 5);
|
||||
|
||||
if (site_response) {
|
||||
message.channel.send(redditResponse);
|
||||
}
|
||||
|
||||
// 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.")
|
||||
}
|
||||
}
|
||||
|
||||
// imgur request
|
||||
function imgurRequest(subreddit, page_max) {
|
||||
var multiSubreddit = subreddit.split(',');
|
||||
@@ -516,7 +485,34 @@ client.on('message', message => {
|
||||
break;
|
||||
|
||||
case 'summon':
|
||||
summonCommand();
|
||||
// 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)) {
|
||||
|
||||
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) {
|
||||
|
||||
message.channel.send(message.author + ' summons *' + redditToSummon + '*\n');
|
||||
let site_response = bestEffortRequest(redditToSummon, 5);
|
||||
|
||||
if (site_response) {
|
||||
message.channel.send(redditResponse);
|
||||
}
|
||||
|
||||
// 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.")
|
||||
}
|
||||
break;
|
||||
|
||||
// Voice commands
|
||||
|
Reference in New Issue
Block a user