Teak’s !HowLong Following Nightbot Command

Asked Apr 29, 2015·51 replies·Last activity 9 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

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

51 replies

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

And that is it!
Vaughn Whiskey

chansub-global-emoticon-ddc6e3a8732cb50f-25x28.png

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

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)

<img src='>

k9evc.png

I'm confused.. Can you show me how you did the !addcom so I can just copy and paste it? :P

!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.

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.

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

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?

Daring Raccoon said:
Hi, is it possible somehow to get the time translated to a different language ?

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

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

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

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.

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))

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

The example @Tidy Chipmunk provided is correct. Be sure you're using the command properly.

Example Usage:
!followlength user_name

Do you might doing the full thing, im sorry ive been trying for a while now and im just getting really tired of it. I would really appreciate it honestly.

@Tidy Chipmunk Hey, i have been using the following code for a while:

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

(username etc filled in of course).
It always worked but since a couple of weeks ago if a user who isn't following the channel it is giving weird errors like; https://gyazo.com/0677cb5a3de7a4dc76f179173d138323

Could you help me out here? Did something change so i have to change the url?

Thanks a lot in advance

Yeah you might want to reach out to @member about that. He's the one in control of that api.

How can i do that? I am new to this website haha

This command works great for regular followers but for mods it shows the time they were modded and not when they followed

Can you provide evidence of this happening? What is the exact api link you are using?

This was likely because they unfollowed on accident and just re-followed within a quick amount of time. Unless they decided to follow you as they became a moderator, the service is working fine regardless.

How would you make a followers command to show how many followers the stream has?

here's something else just to make it a little more simple. just change both of the "USERNAME" sections to $(channel)
just makes it so that there is no editing required of the custom Command

i must be pretty dumb hahahah.. were do i type this info and what would i write if my channel name is niitro89? thanks guys love the idea of this command

You type this command directly into twitch chat and it should work:

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

$(channel) is replaced with the channel name wherever it is ran

$(touser) is replaced with whatever name is used immediately after the command and defaults to the person who ran it if none is provided.

If you want it to be restricted to a certain userlevel you would add -ul=[userlevel] after !howlong

Do I use this as the command or in the message part?? Also is this the one for the time added not the date? Thanks

As i said:

Sparkly Hamster said:
You type this command directly into twitch chat

so just copy paste what i wrote into twitch chat and it will work. Alternatively, if you are in the nightbot panel you can name it !howlong or whatever you want to call it, then paste this part in the message field:

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

This one is just for dates i believe, not time since.

Is there an option to show the "total" time an users has been following a channel if the user unfollowed the channel by mistake a sec and then refollowed it.
I mean, there is an option/command to add the "1st" followtime and "2nd" followtime and show the total?

Thanks.

Twitch doesn't store how many times you follow a channel so this isn't possible.

does not work for me i just get the reply not following for any that uses it.

Tried all these and it wasn't working. Finally got it to WORK!! This works for sure guys just copy this and put it in your chat, real talk. All you need to do is change TWITCHUSERNAME with the Twitch Channel you are wanting the command in. Here's what you copy......... !addcom -ul=mod !howlong $(customapi https://api.rtainc.co/twitch/channels/TWITCHUSERNAME/followers/ $(touser))

THANK YOU! THIS WORKED AND THE STUFF ABOVE DID NOT! I dont know why it didn't work, but the api in this article did not work.

Anyway to have the following command ignore the @ symbol when typing someone's name to be checked on how long they have been following (i.e. "!howlong @member"). If not, I understand, the command is awesome that it just understands to use the command issuers name if no name is provided.

This will output what you're looking for:

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

This is what i get when using the command. Please help. I've tried the first command but i wanted to keep it in the text form n not numbers.

Capture88.PNG

The main command in this post is no longer maintained please use this post (link expired) instead.

!commands add !followsince $(urlfetch https://2g.be/twitch/following.php?user=$(touser)&channel=$(channel)&format=ymwd)

Simply copy and paste this in your chat to add the command.

Command don't work.
Error connecting to remote server.

Make sure you don't already have a !followsince command on your channel using a different api by typing !commands delete !followsince

Then try and copy-paste the command I posted above into your chat and it should work.

Screen_Shot_2017-06-17_at_12.40.43_PM.png

Didn't find your answer? The community is on Discord.

Ask on Discord