Useful Custom APIs

Hello, I’m new to Nightbot. I’ve seen a couple of channels using the random choice api and I’m not sure how to set it up.
I want my channel to randomly choose a key blade from Kingdom Hearts that my viewers will wield in the chat.
I want to use the command !keyblade and then the response would be $(touser) now wields the (random key blade)
Can someone help me start the set up?

1 Like

You would use this custom api to achieve this:

The command should look something like this:

!commands add !keyblade $(touser) now weilds the $(urlfetch https://api.rtainc.co/twitch/random?format=[0]&choices=CHOICES) key blade.

Be sure to replace the ‘CHOICES’ in the url with the words you want to randomly generate seperated by commas.

You can read more about the urlfetch variable here.:thumbsup:

2 Likes

Oh this is perfect, thank you!

2 Likes

I’ve noticed some streamers are able to change the name of their Nightbot? How is that possible? (Example: My friend whom I can’t get ahold of has her Nightbot come up as Ambot.)

1 Like

This is not currently possible, it may be in future however there currently isn’t an eta.

Ambot is not Nightbot under a different name, it’s a seperate bot your friend probably added or coded themselves.

1 Like

I’m looking for a command that one person challenges a specific viewer to a fight and then nightbot chooses a winner from the two if that is possible. Thank you for your time.
Example: !duel Talon
Narutia challenged Talon to a keyblade duel!
Talon is the victor!

1 Like

You can use the variables $(user) and $(touser) in the custom API url, like this:

!commands add !duel $(user) challenges $(touser) to a keyblade duel! $(urlfetch https://api.rtainc.co/twitch/random?format=[0]&choices=$(user),$(touser)) is the winner!

1 Like

Awesome, thank you so much!

2 Likes

Hello, I’ve been trying to make something for my channel with the random choice API, but I have no idea how to get it to work, could anybody help me on this matter?

1 Like

Something like this:

!commands add !random $(urlfetch https://api.rtainc.co/twitch/random?format=[0]&choices=a,b,c)

Now replace a b c with options you would the command to display.

The response for subbage(sub length) doesnt work correctly. It responds with incorrect values. Subs with 3 month sub badge get a response that they have been subbed for 2 months or sometimes way less. We have tried changing the token but it shows same data. What could be the problem?

1 Like

I’ve noticed this myself, and I think I know what’s happening.

When a subscriber renews a subscription, it will say “3-Month Subscriber” when they’ve only been subscribed for 2 months because they’ve paid for the third month and are going into the 3rd month. Alerts will say 3 months, but the sub length will accurately show the 2 months that the sub has currently served.

As for less time being shown, I’ve noticed that any of my subscribers that subscribe with Prime never show an accurate sub length. I think Prime does something weird with the sub renewal process that only reflects in sub length. The alerts and badges still reflect their accurate subscription length.

1 Like

No, I meant that it shows a 3 month sub badge but when the person uses the command, it shows he/she is a 2 month sub or way less. Even when the broadcaster uses the command its way off. It seems to be stuck.

1 Like

I believe what I said still applies. I have noticed that my Subscribers will have a 3-month badge, but the command will say the subscriber has only been a sub for 2 months. In actuality, I think they’re both correct. Twitch counts the sub ahead of time, meaning when a sub resubscribed, Twitch adds that prepaid month to their sub anniversary. The command, however only counts the number of days they have actually been a sub, not the prepaid days…This is why the command is always a month off. If it’s more than a month off, I’ve always noticed that the sub is subbed with Prime. I think Prime doesn’t keep track of sub lengths correctly.

1 Like

Is anyone else getting an error message when trying to use the API, a lot of my commands have broken and just return: “[Error Connecting To Remote Server - Error Connecting To Remote Server].” I was just wondering if there is a fix for it.

1 Like

ya , it is an error, hope the host can repair it as soon as possible

1 Like

Keep getting the “Error Connecting To Remote Server” error

1 Like

No, Twitch prime doesnt do that because it happens to almost every sub. The same goes for subbing for more months. Even the broadcaster gets incorrect data, which is what I have mentioned before. The broadcaster isnt subbed to himself, he cant extend it. He is considered his own sub on twitch though, but the command still returns incorrect data. If you pay for more months, you dont get the badge because thats not how it works. You just paid for more months. Its broken for subs.

1 Like

Does anyone know a way of doing !followage or !subs and it shows you your current amount of YOUTUBE subs or your lasted video etc

1 Like

Cant view russian text
$(customapi https://api.rtainc.co/twitch/random?format=[0]&choices=тест+1,тест+2)
Out “B5AB 1” or “B5AB 2”

1 Like