I have already posted this in a comment on another thread about the followage command not working but figured it should have its own post that is easier to find.
Due to some recent changes from Twitch, it is now required that either a streamer or a moderator is logged into an application in order to get follower information (who is following you, how long they are following, etc).
You will need to go to https://commands.garretcharp.com/ to login, this page will also have some details about the command which I will also explain here in the post:
The most basic command you can create is the following (Streamer must be the logged in):
$(urlfetch https://commands.garretcharp.com/twitch/followage/$(channel)/$(touser))
This will respond with the following format:
@viewer has been following @streamer for x years, x months, x days, x hours, x minutes, x seconds.
If you are a moderator and want to add the command you would need to use the following command:
$(urlfetch https://commands.garretcharp.com/twitch/followage/$(channel)/$(touser)?moderatorId=<id>)
Note that <id>
will need to be replaced by your Twitch userId which can be found on the page when you login.
If you wish to change the format of the message you can add a query parameter for the format with the following (in order):
y = years
m = months
w = weeks
d = days
h = hours
i = minutes
s = seconds
Some example formats:
format=ymwdhis (x years, x months, x weeks, x days, x hours, x minutes, x seconds.)
format=md (x months, x days.)
A full example with a custom format and streamer login:
$(urlfetch https://commands.garretcharp.com/twitch/followage/$(channel)/$(touser)?format=md)
And with a moderator login:
$(urlfetch https://commands.garretcharp.com/twitch/followage/$(channel)/$(touser)?moderatorId=<id>&format=md)
I have also open-sourced the code so if you wish to see how it works you can find it here: garretcharp/commands.garretcharp.com (github.com).
If you speak a language other than English I would really appreciate some help on adding an option to set the language that the command responds in.
If you get an error from nightbot saying āError Connecting To Remote Serverā this is an issue with nightbot normally retrying the command will eventually work.