Created
April 16, 2017 18:21
-
-
Save FreeApp2014/883b3a0b15370c69b53f13c5934a618f to your computer and use it in GitHub Desktop.
The random number commands for discord.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getRandomInt(min, max) { | |
min = Math.ceil(min); | |
max = Math.floor(max); | |
return Math.floor(Math.random() * (max - min)) + min; | |
} | |
if (msg.content.toLowerCase().startsWith("*8ball")) { //The 8ball Message | |
var msg1 = Array(5); | |
msg1[1] = "Yes"; | |
msg1[2] = "No"; | |
msg1[3] = "Maybe :wink:"; | |
msg1[4] = "Without a doubt."; | |
msg1[5] = "I Honestly Have No Idea :neutral_face:" | |
msg1[6] = "Highly Unlikely" | |
var x = getRandomInt(0, 20); | |
if (x < 5){ | |
if (x < 3){ | |
msg.channel.sendMessage(msg1[1]); | |
} | |
else { | |
msg.channel.sendMessage(msg1[3]); | |
} | |
} | |
else if (x<= 9) { | |
if (x >= 7){ | |
msg.channel.sendMessage(msg1[2]); } | |
else{ | |
msg.channel.sendMessage(msg1[4]); | |
} | |
} | |
else if (x <= 12 ) { | |
msg.channel.sendMessage(msg1[5]); | |
} | |
else { | |
msg.channel.sendMessage(msg1[6]) | |
} | |
} | |
if (msg.content.toLowerCase().startsWith("*random")) { | |
msg.channel.sendMessage("The number is "+ getRandomInt(1, 1000)); | |
} | |
if (msg.content.toLowerCase().startsWith("*coinflip")) { //The coinflip Message | |
var msg2 = Array(2); | |
msg2[1] = "Heads"; | |
msg2[2] = "Tails"; | |
var x = getRandomInt(0, 8); | |
if (x < 4){ | |
msg.channel.sendMessage(msg2[1]); | |
} | |
else{ | |
msg.channel.sendMessage(msg2[2]); | |
} | |
} | |
if (msg.content.toLowerCase().startsWith("*rps")) { //The rps Message | |
var msg1 = Array(3); | |
msg1[1] = "Rock :black_circle:"; | |
msg1[2] = "Paper :page_facing_up:"; | |
msg1[3] = "Scissors :scissors:" | |
var x = getRandomInt(0, 9); | |
if (x < 6){ | |
if (x < 3){ | |
msg.channel.sendMessage(msg1[1]); | |
} | |
else{ | |
msg.channel.sendMessage(msg1[3]); | |
} | |
} | |
else{ | |
msg.channel.sendMessage(msg1[2]); | |
} |
Lol
LOL
it doesn't work
it doesn't work
Bruh did you just only paste it on a blank .js?
bruh, first,its ugly, second, it doesn't work.
i dont think so
i dont think so
Look its just waayy more than needed. You can simply do this:
https://github.com/SmugTheKiler/discord.js-8-ball-command/blob/main/README.md
(Made by me in minutes while writing this comment lol)
Do you realize you are commenting on a 4 year old piece of code that I would have forgotten even exists if not your comment?😄
… On 22 Jul 2021, at 09:29, SmugTheKiler ***@***.***> wrote:
***@***.*** commented on this gist.
i dont think so
Look its just waayy more than needed. You can simply do this:
https://github.com/SmugTheKiler/discord.js-8-ball-command/blob/main/README.md
(Made by me in minutes while writing this comment lol)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cool