Teak’s !HowLong Following Nightbot Command

You tired of how your viewers asking you HOW LONG in your chat? WELL WE GOT YOU COVERED!

This was out of personal need and Teak from TeakSoftware.com and our own NightDev extraordinaire stepped forward to help me out. So I thought I would share with the community on how to add it to their own chat and allow users to check how long they have been following for.

Now Teak went through the code/command and had it pretty much setup for allowing allow of ways for streamers and users to use said code to allow people to check when they 1st followed a channel they are in.

NOTE: The command has to be setup by the streamers with Nightbot to work. This is not a global feature.

The bases of the code is to allow a user to type !howlong in the streamers chat and it will in return give the date the followed. There is a basic cool down time for the command but if you feel like the command would be spammed, Teak has also set it up to allow !howlong USERNAME so you can have it set to MOD only command.

So let’s get right into it.

The basic code is

!addcom !howlong $(touser) Has Been Following USERNAME On Twitch Since $(customapi http://api.newtimenow.com/follow-length/?channel=USERNAME&user=$(touser))

NOTE: Make sure to change USERNAME to your Twitch USERNAME

Then all a user has to do is type !howlong in chat and Nightbot will return.

Now if you want to set it to REG or MOD, all you would need to do is add a userlevel variable.

!addcom -ul=mod !howlong $(touser) Has Been Following USERNAME On Twitch Since $(customapi http://api.newtimenow.com/follow-length/?channel=USERNAME&user=$(touser))

NOTE: Make sure to change USERNAME to your Twitch USERNAME

Then a REG user can use the basic !howlong command or a MOD can do !howlong USERNAME

And that is it!
Vaughn Whiskey

6 Likes

Is it a way to only show date and not time?

This is another option. Other than that your are more than welcome to create your own custom api.

I’m replying as a user but do you know if this new command you shared allows to use have it so you can search a users name or for them to put it in. I am awful at explaining things.

EXAMPLE
!howlong (this would give “VaughnWhiskey has followed for AMOUNT”)

!howlong USERNAME (Would give “USERNAME has followed for AMOUNT”)

just wondering because the one Teak setup will allow both within the one command.

Yes it does, by making USER a touser variable.
When using $(touser), if no parameter is given it will use the username of who triggered the command .

https://apis.rtainc.co/twitchbot/following?channel=CHANNEL&user=$(touser)

1 Like

I’m confused… Can you show me how you did the !addcom so I can just copy and paste it? :stuck_out_tongue:

1 Like
!addcom -ul=mod !howlong $(touser) Has Been Following USERNAME On Twitch Since $(customapi http://api.newtimenow.com/follow-length/?channel=USERNAME&user=$(touser))

Change USERNAME your Twitch channel name in both places.

1 Like

Damn, thank you for the fast reply! But it says “2015-06-09 08:09:20”. I want it to say " 1 year and 2 months" like your post :frowning:

1 Like

Then use:

!addcom -ul=mod !howlong $(touser) Has Been Following USERNAME on Twitch for: $(customapi https://apis.rtainc.co/twitchbot/following?channel=USERNAME&user=$(touser)).

Again changing USERNAME to the Twitch channel.

1 Like

Sorry for being a little bit retarded, thank you so much! :smiley:

1 Like

Hi, is it possible somehow to get the time translated to a different language ?

How do I right the code so that it will recognise people that are already following?

That might be harder for Teak because he host these on this site.

the one custom API does both, so you can use it standalone like !HowLong and as !HowLong USERNAME

It just says “Not following”

Please be sure you are entering the correct data for both USERNAME and USER.

It doesnt seem to work anymore for myself, i just get this error message:
Nightbot:
raydah Has Been Following Raydah on Twitch for:
Warning: file_get_contents(https://api.twitch.tv/kraken/users/raydah/follows/channels/raydah): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Foundin /home/rtainc/www/apis.rtainc.co/twitchbot/following.php on line 5
raydah is not following.

what do i put in USER?

Here is an example that you could probably use.
!commands add !followlength $(touser) has been following $(channel) since: $(customapi http://api.newtimenow.com/follow-length/?channel=$(channel)&user=$(touser))

Thanks for the reply <3

Ive tried using this command for my friends stream, and it just says ‘‘not following…’’ may i please have help on this. The command used to work until the new update on Nightbot, after that it stopped working.
Thank you in advance