It’s a great way to find out who the real OGs are. You should now have your follow age command set up and can enjoy watching your followers find out how long they have been following you for. The followage command allows viewers to see how long they have been following the streamer by using the command in their chat. This will return the follow age if the person triggering the command is a follower. Obviously, you cannot follow yourself on Twitch so mine says I am not following. As you can see nightbot will return a message. personadd All hosts will receive 80 Platanitos upon hosting. star All subscribers will receive 1,500 Platanitos upon subscribing. All cheers will receive 300 Platanitos for every 100 bits. favorite All followers will receive 100 Platanitos upon following. To test if the shoutout command is working, head over to your Twitch chat and type in the !FollowAge command.Īll you have to do to trigger the command is type !followage in chat. LuysTHD timelapse luysthd rewards 25 points every 10 minutes. We can now test this command on our stream. Userlevel – For this command, you can set userlevel to everyoneĬooldown – You don’t want people to repeatedly spam this in chat so I would recommend setting cool down to a minimum of 60 seconds. $(urlfetch $(touser)&channel=$(channel)&format=ymwd) I have added the code below so you can just copy and paste it into nightbot. Message – The message is what gets returned to the user when they enter the command in your Twitch chat. There are a few different options we need to fill in.Ĭommand – This is what users will type into chat to return how long they have been following the stream for. In Night bot navigate to Commands –> Custom –> Add Command. Step 2 – Add A Custom Command In Nightbot (FollowAge) This will mod the Night bot chat bot in your chat allowing you to use commands in your stream. To do this navigate to your Profile Picture –> Creator Dashboard –> Chat Box. To mod night bot head over to Twitch and open you Twitch channel. This allows it to pull necessary information from your channel and return it in chat. To ensure that night bot works on our channel we will have to first mod Night bot in our chat. If you haven’t already created a nightbot account head over to Nightbot and create one. In this tutorial, we will be showing you how to set up the command with Nightbot. To set up the FollowAge command on your Twitch channel you will need to use a third party bot. How To Set Up !FollowAge Command On Twitch In this tutorial, we are going to break down how you can set up the FollowAge command on your Twitch stream using Nightbot. This is an interesting stat for both the user, as well as the streamer so they can see who their OG fans really are. You have probably seen it on other Twitch channels, where their viewers can type in a command and it will return how long they have been following the streamer for. If ($d > 0) array_push($args, " else echo 'Invalid username "'. Show times if only they are greater than zeros Parsing seconds to days, hours, mins, secs However, I calculate the watch times only for viewers and VIPs for a mod, it will return an error (it can be changed). $(urlfetch where $(urlfetch url) returns the output of an url, $(channel) is the channel name, $(user) is the user name, and $(time) is the current time (it's useless for the PHP, but it's used to bypass the query caching in NightBot). To get the watch time from NightBot, I used the command If there are no errors in the update, the response text will be "OK". I store the values in a JSON for your chatbot, I suggest implementing a real database. ![]() ![]() for Ludwig ) and then it adds to each chatter the time difference between the updates. Every loop cycle, the script requests the Twitch TMI to fetch the chatters (ex. However, make sure to do the request if only the channel is streaming. The requests have to be less than 10 mins apart. To update the database for a channel, you have to use a scheduler or a loop that requests where 'target' is the channel name. On a get request, it takes the watch time saved and parses it in days, hours, minutes and seconds. ![]() On an update request, it fetches the chatters and adds the time difference between the updates to the watch time of each user. ![]() The channel I work for uses NightBot, so I'll try to explain briefly how it works with it, so you can implement it however you want.ĭisclaimer: I'm new to PHP, so it probably can be improved also, using commands from the Twitch API can probably polish the code. However, I've recently done a similar thing with PHP, without the need for Twitch API credentials. There's not an API endpoint to do it directly.
0 Comments
Leave a Reply. |