Hi!
I am trying to create a command named !sus which assigns a specified user a random percentage between 1-100%, inclusive, and then depending on the value of that percent, adds additional text from a variety of pastebin sources. For example…
Chat input: !sus valiantEight
Nightbot response: valiantSeven thinks valiantEight is X% sus! This is a randomly selected piece of text depending on the value of X.
Those pieces of text that the command will pull from are all contained in multiple pastebin sources. Each of the pastebin links are formatted in the following fashion:
Line of text;
Another line of text;
A third line of text…;
Etc., etc., etc.,;
Depending on the percent, the command will pick a line of text from those various pastebin sources in the following fashion:
x less than or equal to 24: https://pastebin.com/raw/LINK1
x in between 25 and 49, inclusive: https://pastebin.com/raw/LINK2
x in between 50 and 74, inclusive: https://pastebin.com/raw/LINK3
x in between 75 and 94, inclusive: https://pastebin.com/raw/LINK4
x greater than or equal to 95: https://pastebin.com/raw/LINK5
I have a command written and I will paste it below (broken up a little bit for readability). Right now it seems to be working, but I can’t include the FULL command because it exceeds the character limit. I am looking for help condensing the command so that it fits within the character limit (or a way to condense all of those various pastebin sources into one, single pastebin source that can be picked apart by the command itself).
$(user) thinks $(query) is $(eval x=Math.floor(Math.random()*100+1);
x<=24?`${x}% sus. $(eval y="$(urlfetch json https://pastebin.com/raw/LINK1) ".split(";"); y[Math.floor(Math.random()*(y.length - 1))])`:
x>=25&&x<=49?`${x}% sus. $(eval y="$(urlfetch json https://pastebin.com/raw/LINK2) ".split(";"); y[Math.floor(Math.random()*(y.length - 1))])`:
x>=50&&x<=74?`${x}% sus. $(eval y="$(urlfetch json https://pastebin.com/raw/LINK3) ".split(";"); y[Math.floor(Math.random()*(y.length - 1))])`:
x>=75&&x<=94?`${x}% sus. $(eval y="$(urlfetch json https://pastebin.com/raw/LINK4) ".split(";"); y[Math.floor(Math.random()*(y.length - 1))])`:
x>=95?`${x}% sus. $(eval y="$(urlfetch json https://pastebin.com/raw/LINK5) ".split(";"); y[Math.floor(Math.random()*(y.length - 1))])`:` `)
As mentioned, the command is separated a bit for readability, but when strung together without spaces and breaks, it still exceeds the character limit by quite a bit. If anyone has a way to condense this or change the logic to something that fits the character limit, I would greatly appreciate the help
Thank you very much in advance!!