Hi there. I currently have setup a !slap command which does what you’d expect, and I’m trying to keep count on how many times a certain person has been slapped. I managed to add a counter but it was global, so the slaps increased each the time someone ran the command, and not when an individual was slapped.
Go to https://twitch.center/customapi/quote/generate . You will see three lines. Your first token is after token= and before &data= on the first line. Your second token is after token= and before &data= on the second and third lines. Replace FIRSTTOKEN and SECONDTOKEN with these before you add the following commands.
!slap (alias to !slapadder)
$(eval query = `$(query)`.replace(/[@,]/g, ""); if (query) {if (query.toLowerCase() == `$(user)`.toLowerCase()){"$SLAPPEDMYSELF$"}else{"addquote?token=SECONDTOKEN&data=" + encodeURIComponent(query + ",")}} else {"$NOUSER$"})
!slapadder
$(eval if (`$(urlfetch http://twitch.center/customapi/$(query))`.startsWith("Successfully added entry ")){match = `$(query)`.match(/data=(.*)%2C$/); match == null ? "!slap is misconfigured" : `$(user) slapped ${decodeURIComponent(match[1])}`} else if (`$(query)` == "$SLAPPEDMYSELF$"){"You cannot slap yourself!"} else if (`$(query)` == "$NOUSER$"){"No user specified!"} else {"Use !slap"})
!slaps
$(eval query = `$(query)`.replace(/[@,]/g, ""); query = query ? query : `$(user)`; slaps = `$(urlfetch json http://twitch.center/customapi/quote/list?token=FIRSTTOKEN&no_id=1)`.split(","); querySlaps = 0; slaps.forEach(slap => {if (query.toLowerCase() == slap.toLowerCase()){querySlaps++}}); `${query} has been slapped ${querySlaps} time${querySlaps == 1 ? "" : "s"}`)