Hey, so I’ve been searching this for a while now and I couldn’t come up with any real answers.
I want to make a command with the following characteristics :
Any user types !believe and Nighbot comes back with “There are $(count) believers in chat”.
This command needs to only be evoked once per user per reset.
And, preferably, although looking around tells me no, the count would have a decay.
Hiya, this is not possible without any custom script. Nightbot can store a $(count) per command, but not per user and no idea what kind of reset youre thinking of.
We’ll use the quote system API. You’ll get your TOKENS by clicking on the second link in the post, in the Manual Installation section, use these in the commands I wrote. To know where to look for your PUBLIC_TOKEN and PRIVATE_TOKEN, look at the field bellow:
Keep your PRIVATE_TOKEN secret, don’t share it anywhere. Add the following commands from the dashboard. Don’t use the chat as anyone could monitor it and copy the token, they could then edit your data.
• _believe: alias of !believe so type _believe is the alias field of !believe.
$(eval a=$(urlfetch https://twitch.center/customapi/addquote?token=$(query)); d=`$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&no_id=1)`.split(`|`); q=`$(query)`; q==`r`?`There are ${d.length} believers in chat.`:q.includes(`PRIVATE_TOKEN`)?`$(user) believes! There are now ${d.length} believers in chat.`:`ERROR`;)
To reset the counter every 30 minutes, use a timer with the following settings:
• Interval: every 30 minutes
• Chat Lines: 2 lines
• Message:
$(eval a=$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&clear=1); `Believers counter reset. Who believes? Type !believe`)
I haven’t had time to test it, but I’ve written similar commands in the past, so it should work.
Only possible issue I can think of at the moment is the counter being off by one when a new user calls the command. In which case, adjust the second/last ${d.length} in _believe with either ${d.length+1} or ${d.length-1} accordingly.