Useful Custom APIs

how can i make !howlong ap do months weeks and days?
i like the stylistic formating of $(customapi https://api.rtainc.co/twitch/channels/$(channel)/followers/$(touser)?format=[1]+has+been+following+[0]+for+[2])but i want more precision for example
https://api.rtainc.co/twitch/channels/EoMGames/followers/CurtimusPrime2545 returns CurtimusPrime2545 has been following EoMGames for 1 month, 3 weeks and i want CurtimusPrime2545 has been following EoMGames for 1 month, 3 weeks, and [x] days

The “any API that returns a duration” rule in the post applies here - add &units=3 for 3 units. If you want days even when the account is a year+ old, use &units=4.

[quote=“rtainc, post:1, topic:4102”]https://api.rtainc.co/twitch/channels/CHANNEL/status?format=[0]+is+playing+[1]+for+[2]+viewers
Returns the game being played and the stream’s viewer count.[/quote]

Is there a way to retrieve the last game played instead, in case the target of the command is currently offline?

You can use the Twitch variable -> $(twitch $(channel) "{{game}}")

Hi! Sorry if someone has already asked this but does anyone have an API for Dead by Daylight stats? Is it even possible? Much appreciated!

As the game developers have not provided a stat API, it is unfortunately not possible at this time. Sorry!

1 Like

Thanks for the quick reply!

Other question I have is regarding the new follow length api… Is there a way to have it respond with the date and time the user followed instead of the countup?

@rtainc Twitch seems to be forcing a space to be added before ‘$’ recently. So trying to add a command using:

$(urlfetch https://api.rtainc.co/twitch/channels/CHANNELNAME/followers/$(user))

results in it becoming (notice the extra space):

$(urlfetch https://api.rtainc.co/twitch/channels/CHANNELNAME/followers/ $(user))

which won’t work:

%20exampleuser isn't following examplechannel

How do I overcome this? Can you change the API to weed out leading spaces in usernames?

Hi, i am not getting it to work. i did have it working but it advised me to update the API, i am struggling a bit.

Code:
$(touser) has been following channel $(customapi https://api.rtainc.co/twitch/channels/SNOWxCROSS/followers/$(user)?format=You’ve+been+following+for+[2])

Thanks!

Copy and paste this.

!commands add !howlong $(customapi https://api.rtainc.co/twitch/channels/$(channel)/followers/$(touser)?format=[1]+has+been+following+[0]+for+[2])

You do not need to change anything.

https://api.rtainc.co/twitch/channels/CHANNEL/viewers/random?format=I+choose…+[0]33
Returns a random viewer who’s watching the stream.

How can I random a viewer which is not a MOD / admin? or can I make a list of exceptions? I don’t want nightbot or me to be the result. Thank you.

@kushykushina
I pushed an update, let me know if that helps.

@rugiabaku
I added a &exlude= parameter which supports groups (mods, nonmods) and usernames.

While Aaron128l answer -> $(twitch $(channel) “{{game}}”) will absolutely do the job (I use something similar often), Im curious if there is an API that does return the LAST game played in a target channel, not the CURRENT game. It might be handy to know.

This is often used in shoutout commands and that is often done when the target person ends their stream and hosts another, so are not CURRENTLY playing anything.

That worked, thank you much!

I’m creating a command to return how long a users channel has existed !addcom !created $(customapi https://api.rtainc.co/twitch/channels/$(touser)?format=[0]'s+account+has+existed+for+[1]) but once I’ve added it I get the response ‘B0zzar’s account has existed for’ with no time on the end, I can’t seem to figure it out

It works!! Thank you.

Can you create a command that like gives a cooldown to a command?

Just add -cd=x to have a cooldown of x seconds.

Example:

!commands add !test -cd=90 Stuff

Not quite sure what’s going on here - The “I choose” has thrown itself into every one of my “choice” commands, of which I have a lot serving different purposes. I’m trying to get it to go away for a “rate me” command, for instance, and…

$(user), $(https://api.rtainc.co/twitch/random?format=You+are+a…+[0]&choices= AllMyChoices)

keeps returning an invalid variable. I’ll be honest, I don’t really understand what the numbers are for but removing it doesn’t help.

The format seems correct, but you forgot the urlfetch part:
$(urlfetch http://link-here)