Updated help, added roll command, bugfix for compute
This commit is contained in:
67
bot.js
67
bot.js
@@ -12,7 +12,7 @@ var channel = null;
|
|||||||
// available commands
|
// available commands
|
||||||
function availableCommands() {
|
function availableCommands() {
|
||||||
var commands = "Available commands: " +
|
var commands = "Available commands: " +
|
||||||
"\n**[SFW]** b.<*coinflip, 8ball, compute, bunny, dankmemes, meirl, animemes, moe, moe-boys, hotguys , kgirls, kboys*>" +
|
"\n**[SFW]** b.<*coinflip, 8ball, roll, compute, bunny, dankmemes, meirl, animemes, moe, moe-boys, hotguys , kgirls, kboys*>" +
|
||||||
"\n**[NSFW]** b.<*lewd, ecchi, hentai, yaoi, yuri, neko, pokeporn, hgifs*>" +
|
"\n**[NSFW]** b.<*lewd, ecchi, hentai, yaoi, yuri, neko, pokeporn, hgifs*>" +
|
||||||
"\nFor more information on a command, you may use: *b.help <command>*";
|
"\nFor more information on a command, you may use: *b.help <command>*";
|
||||||
|
|
||||||
@@ -23,24 +23,25 @@ function availableCommands() {
|
|||||||
function commandsHelp(requestedCommand) {
|
function commandsHelp(requestedCommand) {
|
||||||
var commands = {"coinflip": "**coinflip:** Returns a result of heads or tails.",
|
var commands = {"coinflip": "**coinflip:** Returns a result of heads or tails.",
|
||||||
"8ball": "**8ball:** Shakes an 8 ball and returns a result.",
|
"8ball": "**8ball:** Shakes an 8 ball and returns a result.",
|
||||||
|
"roll": "**roll:** Rolls a number between 1-100 (or a specified range [ex: b.roll 50-100])",
|
||||||
"compute": "**compute:** Uses WolframAlpha to process the question asked.",
|
"compute": "**compute:** Uses WolframAlpha to process the question asked.",
|
||||||
"bunny": "**bunny:** Posts a picture from r/rabbits on imgur",
|
"bunny": "**bunny:** Posts a picture of different bunnies",
|
||||||
"dankmemes": "**dankmemes:** Posts a picture from r/dankmemes on reddit/imgur",
|
"dankmemes": "**dankmemes:** Posts a picture of some dank memes (r/dankmemes)",
|
||||||
"meirl": "**meirl:** Posts a picture from r/anime_irl on reddit/imgur",
|
"meirl": "**meirl:** Posts a picture of anime irl (r/anime_irl)",
|
||||||
"animemes": "**animemes:** Posts a picture from r/animemes on reddit/imgur",
|
"animemes": "**animemes:** Posts a picture of anime memes (r/animemes)",
|
||||||
"moe": "**moe:** Posts a picture from r/awwnime on redditbooru/imgur",
|
"moe": "**moe:** Posts a picture of moe anime (r/awwnime)",
|
||||||
"moe-boys": "**moe-boys:** Posts a picture from r/cuteanimeboys on reddit/imgur",
|
"moe-boys": "**moe-boys:** Posts a picture of moe anime boys (r/cuteanimeboys)",
|
||||||
"hotguys": "**hotguys:** Posts a picture from r/bishounen on redditbooru/reddit",
|
"hotguys": "**hotguys:** Posts a picture of hot anime guys (r/bishounen)",
|
||||||
"kgirls": "**kgirls:** Posts a picture from r/kpics on redditbooru/imgur or r/kpopfap on reddit",
|
"kgirls": "**kgirls:** Posts a picture of k-pop girls (r/kpics or r/kpopfap)",
|
||||||
"kboys": "**kboys:** Posts a picture from r/kfanservice, r/kpecs, or r/cutekboys on imgur",
|
"kboys": "**kboys:** Posts a picture of k-pop guys (r/kfanservice, r/kpecs, or r/cutekboys)",
|
||||||
"lewd": "[NSFW] **lewd:** Posts a picture from r/pantsu on redditbooru",
|
"lewd": "[NSFW] **lewd:** Posts a picture of lewd anime girls (r/pantsu)",
|
||||||
"ecchi": "[NSFW] **ecchi:** Posts a picture from r/ecchi on reddit/imgur",
|
"ecchi": "[NSFW] **ecchi:** Posts a picture of ecchi anime girls (r/ecchi)",
|
||||||
"hentai": "[NSFW] **hentai:** Posts a picture from r/hentai on reddit/imgur or r/sukebei on imgur",
|
"hentai": "[NSFW] **hentai:** Posts a picture of hentai (r/hentai or r/sukebei)",
|
||||||
"yaoi": "[NSFW] **yaoi:** Posts a picture from r/yaoi on imgur",
|
"yaoi": "[NSFW] **yaoi:** Posts a picture of yaoi (r/yaoi)",
|
||||||
"yuru": "[NSFW] **yuri:** Post a picture from r/yuri on imgur",
|
"yuru": "[NSFW] **yuri:** Post a picture of yuri (r/yuri)",
|
||||||
"neko": "[NSFW] **neko:** Posts a picture from r/nekomimi on reddit/imgur",
|
"neko": "[NSFW] **neko:** Posts a picture of cat girls (r/nekomimi)",
|
||||||
"pokeporn": "[NSFW] **pokeporn:** Posts a picture from r/pokeporn on redditbooru/reddit",
|
"pokeporn": "[NSFW] **pokeporn:** Posts a picture of pokemon hentai (r/pokeporn)",
|
||||||
"hgifs": "[NSFW] **hgifs:** Posts a gif from r/nsfwanimegifs on reddit"};
|
"hgifs": "[NSFW] **hgifs:** Posts a gif of hentai (r/nsfwanimegifs)"};
|
||||||
if (commands[requestedCommand] === undefined)
|
if (commands[requestedCommand] === undefined)
|
||||||
{
|
{
|
||||||
return "Command not found, try entering **b.commands** for a full list of commands";
|
return "Command not found, try entering **b.commands** for a full list of commands";
|
||||||
@@ -69,6 +70,13 @@ function eightBall() {
|
|||||||
return answers[(Math.floor(Math.random() * answers.length))];
|
return answers[(Math.floor(Math.random() * answers.length))];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// number roll
|
||||||
|
function numberRoll(startingRange, endingRange) {
|
||||||
|
startingRange = Math.ceil(startingRange);
|
||||||
|
endingRange = Math.floor(endingRange);
|
||||||
|
return Math.floor(Math.random() * (endingRange-startingRange)) + startingRange;
|
||||||
|
}
|
||||||
|
|
||||||
// stupid question response
|
// stupid question response
|
||||||
function stupidQuestion() {
|
function stupidQuestion() {
|
||||||
var answers = [
|
var answers = [
|
||||||
@@ -312,11 +320,32 @@ client.on('message', message => {
|
|||||||
message.reply(noQuestion());
|
message.reply(noQuestion());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'roll':
|
||||||
|
var message_content = message.content.substring(2).split(' ');
|
||||||
|
if(message_content[1] != undefined && message_content[1].length > 0) // ranged roll
|
||||||
|
{
|
||||||
|
var regex = /^[0-9]+-[0-9]+$/;
|
||||||
|
if(regex.test(message_content[1]))
|
||||||
|
{
|
||||||
|
var range_break = message_content[1].split('-');
|
||||||
|
|
||||||
|
message.channel.send(message.author + ' rolls a number between ' + range_break[0] + '-' + range_break[1] + '. They roll **' + numberRoll(range_break[0], range_break[1]) + '**.');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
message.channel.send('Unknown roll format. Use "**b.help roll**" for more information.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // default roll (1-100)
|
||||||
|
{
|
||||||
|
message.channel.send(message.author + ' rolls a number between 1-100. They roll **' + numberRoll(1, 100) + '**.');
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'compute':
|
case 'compute':
|
||||||
case 'convert':
|
case 'convert':
|
||||||
case 'calculate':
|
case 'calculate':
|
||||||
var message_content = message.content.substring(2).split(' ');
|
var message_content = message.content.substring(2).split(' ');
|
||||||
if(message_content[1].length > 0)
|
if(message_content[1] != undefined && message_content[1].length > 0)
|
||||||
{
|
{
|
||||||
var response = calculate(message.content.substring(message.content.indexOf(' ')+1));
|
var response = calculate(message.content.substring(message.content.indexOf(' ')+1));
|
||||||
if(response == "")
|
if(response == "")
|
||||||
|
Reference in New Issue
Block a user