[help] Anti spam for !uptime command - 05/02/18 09:15 PM
Hello,
I have the following code for a !uptime command in my Twitch channel:
But I want to add code that prevents people from spamming !uptime. And I tried this:
However, it doesn't work. Any suggestions on what I should change? Maybe I placed in the wrong place? Or is it just not the right code to use for this?
Thank you for taking the time to read this,
With kind regards,
Ry
I have the following code for a !uptime command in my Twitch channel:
Code:
[script] n0=on *:TEXT:!uptime*:#: { n1= var %json = streamuptime, %stream = $iif(#* iswm $iif($2,$2,#), $mid($v2, 2-), $v2), %time n2= jsonopen -ud %json https://api.twitch.tv/kraken/streams?channel= $+ $lower(%stream) n3= if ($JSONError) { n4= n5= msg # Unable to retrieve the state of %stream n6= } n7= elseif ($regex($JSON(%json, streams, 0, created_at), /^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)Z$/)) { n8= %time = $calc($ctime($+($gettok(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec, $regml(2), 32) $ord($base($regml(3), 10, 10)), $chr(44) $regml(1) $regml(4), :, $regml(5), :, $regml(6))) + ( $time(z) * 3600)) n9= msg # %stream has been online for $duration(%time) n10= } n11= else { n12= msg # %stream is currently not live. n13= } n14=}
But I want to add code that prevents people from spamming !uptime. And I tried this:
Code:
[script] n0=on *:TEXT:!uptime*:#: { n1= if ((%floodsocial) || ($($+(%,floodsocial.,$nick),2))) { return } n2= set -u10 %floodsocial On n3= set -u30 %floodsocial. $+ $nick On n4= var %json = streamuptime, %stream = $iif(#* iswm $iif($2,$2,#), $mid($v2, 2-), $v2), %time n5= jsonopen -ud %json https://api.twitch.tv/kraken/streams?channel= $+ $lower(%stream) n6= if ($JSONError) { n7= n8= msg # Unable to retrieve the state of %stream n9= } n10= elseif ($regex($JSON(%json, streams, 0, created_at), /^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)Z$/)) { n11= %time = $calc($ctime($+($gettok(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec, $regml(2), 32) $ord($base($regml(3), 10, 10)), $chr(44) $regml(1) $regml(4), :, $regml(5), :, $regml(6))) + ( $time(z) * 3600)) n12= msg # %stream has been online for $duration(%time) n13= } n14= else { n15= msg # %stream is currently not live. n16= } n17=}
However, it doesn't work. Any suggestions on what I should change? Maybe I placed
Code:
n1= if ((%floodsocial) || ($($+(%,floodsocial.,$nick),2))) { return } n2= set -u10 %floodsocial On n3= set -u30 %floodsocial. $+ $nick On
Thank you for taking the time to read this,
With kind regards,
Ry