NightDev Community Forums

Customising !8ball command

Hello! I mod for quite a bit of streams and I was wondering if it is possible to customize the answers given in the command? I generally use, “!commands add !8ball :8ball: $(eval const responses = [‘All signs point to yes…’, ‘Yes!’, ‘My sources say nope.’, ‘You may rely on it.’, ‘Concentrate and ask again…’, ‘Outlook not so good…’, ‘It is decidedly so!’, ‘Better not tell you.’, ‘Very doubtful.’, ‘Yes - Definitely!’, ‘It is certain!’, ‘Most likely.’, ‘Ask again later.’, ‘No!’, ‘Outlook good.’, ‘Don’t count on it.’]; responses[Math.floor(Math.random() * responses.length)];)” and have been trying to customize it to, " !addcom !8ball :8ball: $(eval const responses = [‘All signs point to yes you bot.’, ‘Yes!’, ‘His Elo is telling me nope.’, ‘You can bet your kids on it.’, ‘Be less of a bot and ask again…’, ‘Suwhoop’, ‘It is happening whether you like it or not!’, ‘You don’t even want to know.’, ‘Not happening.’, ‘Yes - Definitely!’, ‘It is certain!’, ‘Most likely.’, ‘Ask again later.’, ‘Hell no!’, ‘Outlook good if there isn’t a booter.’]; responses[Math.floor(Math.random() * responses.length)];)" But it won’t display an answer just the code. Can someone tell me if this is possible or what I’m doing wrong? Thanks in advance!

@Itsasera

I’m not sure the reason why the code is failing in such a way that it’s actually outputting the code. I am a bit suspicious about the usage of quotations, that is, using single quotes to surround the responses while also using single quotes within the responses themselves without escaping the quotes. Whatever the reason may be for the erroneous output, I’ve rewritten !8ball slightly to avoid any possible errors.

!addcom -cd=5 !8ball 🎱 $(eval a=[`All signs point to yes you bot.`,`Yes!`,`His Elo is telling me nope.`,`You can bet your kids on it.`,`Be less of a bot and ask again...`,`Suwhoop`,`It is happening whether you like it or not!`,`You don't even want to know.`,`Not happening.`,`Yes - Definitely!`,`It is certain!`,`Most likely.`,`Ask again later.`,`Hell no!`,`Outlook good if there isn't a booter.`];a[Math.floor(Math.random()*a.length)])
1 Like

This was driving me crazy! Thank you so much!!

Do you mind helping me with another !8ball command? The streamer I mod for wanted a few different answers and I tried spacing the single quotations as you did in the previous command but I just can’t seem to get it. !addcom -cd=5 !8ball :8ball: $(eval a=[All signs point to yes you bot.,Yes!,His Elo is telling me nope.,You can bet your kids on it.,Be less of a bot and ask again...,Yeet,It is happening whether you like it or not!,You don't even want to know.,His elo is saying no,Yes - Definitely if he uses his wittle brain!,It is certain if he doesnt throw again!,If he uses his right stick.,Ask again when you hit diamond.,Hell no!,Outlook good if there isn't a booter.];a[Math.floor(Math.random()*a.length)]) Still just displays the code? Sorry for bugging you with this again!

This command response seems to be over 500-character limit. To work around this, I suggest the following alternative.


Look at this pastebin file I use for a trivia command. Note the following aspects of the file:

  • The file starts and ends with square brackets []
  • Each trivia fact is bounded by backticks ``
  • The facts are separated by commas.

Go to https://pastebin.com and create a file containing the 8ball responses that follows the same aspects as detailed above. Once you create it, copy and paste the following command setup into chat to create the !8ball command. Replace RAW_PASTE_LINK with the raw paste link to your pastebin file (the link looks like https://pastebin.com/raw/blahblah):

!addcom -cd=5 !8ball $(eval a=$(urlfetch json RAW_PASTE_LINK);a[Math.floor(Math.random()*a.length)])
1 Like

So would: !addcom -cd=5 !8ball $(eval a=$(urlfetch jsonhttps://pastebin.com/raw/puARa7AL );a[Math.floor(Math.random()*a.length)]) be the correct format for the command?

You should use backticks `` instead of straight quotes to enclose the 8ball responses as well as delete the comma in the last line. Then set up !8ball like so:

!addcom -cd=5 !8ball $(eval a=$(urlfetch json https://pastebin.com/raw/puARa7AL);a[Math.floor(Math.random()*a.length)])
1 Like

Thank you so much again!! You’re amazing and I hope you have a great day or night!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.