Looking for 8ball command

I’m looking for a working 8ball command. I’ve found this website that works kinda like an api.

https://8ball.delegator.com

I’m trying to find out how i could use that site to implement in an nightbot command, but i can’t figure it out. I’m not that good of a programmer.

Thanks in advance.

The Nightbot docs have an example of how to make an 8ball command: https://docs.nightbot.tv/commands/variables/eval

I know, but does not have a lot of responses. I thought it would be more fun to get that site involved.
So if anyone knows a solution for that, i would be grateful.

Just type this into your chat to add the command:

!addcom !8ball $(eval if(decodeURIComponent("$(querystring)")){r=`$(urlfetch json https://8ball.delegator.com/magic/JSON/$(querystring))`;try{o=JSON.parse(r);(o&&o.magic&&o.magic.answer||`Failed to parse response: ${r}`).substr(0,400)}catch(e){`Failed to parse response: ${e.message}: ${r}`.substr(0,400)}}else{"Ask a question!"})

Thanks! But you can only put in 400 characters in chat. So how would i put that in thru nightbot website?

Click here to go to the Nightbot dashboard and sign in using your Twitch account. At the top left-hand corner, click Commands (the second icon), then Custom. On the right-hand side, click +Add Command. It will bring up a menu for adding a custom command:

In the box named Command, type !8ball

In the box named Message, copy and paste the response of the command am_1 set up for you:
$(eval if(decodeURIComponent("$(querystring)")){r=`$(urlfetch json https://8ball.delegator.com/magic/JSON/$(querystring))`;try{o=JSON.parse(r);(o&&o.magic&&o.magic.answer||`Failed to parse response: ${r}`).substr(0,400)}catch(e){`Failed to parse response: ${e.message}: ${r}`.substr(0,400)}}else{"Ask a question!"})

At the bottom of the menu, click Submit and you are done!

Even on the website you can only enter less then 400 characters.
I can only put in this amount of code:

$(eval if(decodeURIComponent("$(querystring)")){r=$(urlfetch json https://8ball.delegator.com/magic/JSON/$(querystring));try{o=JSON.parse®;(o&&o.magic&&o.magic.answer||`Failed to parse response: $

That’s where it stops. Or do you have to login with twitch? Because i login with YouTube.

Thanks for helping! Really appreciate it.

You can enter up to 500 characters on the website. The command is only 315 characters. The command does not exceed the character limit.

If you are reaching the character limit, then your web browser is broken. Try another browser, such as Google Chrome.

Let me try and do this on my laptop. I’ve been doing it on my phone. I’ll let you know.

Well I’ve tried putting it in on the website on my laptop with google chrome.
Still does not work, I really don’t know what I’m doing wrong. Here’s a screenshot of what I’m doing. I’ve pasted the command in the message, but cuts it at what you can see. I can’t manually type anything else after that.

edit
Seems like I can only enter 200 characters? I manually typed 1234567890 20 times, can’t get past that 200.

Oh, I just found out that Nightbot limits command length to 200 if you are signed in with YouTube (the limit is 500 if you are signed in with Twitch).

Here is a shortened version of the command. You should be able to add it through the website.

$(eval if(decodeURIComponent("$(querystring)"))try{JSON.parse(`$(urlfetch json https://8ball.delegator.com/magic/JSON/$(querystring))`).magic.answer}catch(e){e.message}else"Ask a question!")

Thank you! It works like a charm.

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