This is the script I got now which I use for a Twitch stream that I moderator for, let me know if I need to change/delete anything.
Quote
on 1:connect:{ /TWITCHCLIENT 3 }
on *:CONNECT:#tehrani:{
raw CAP REQ :twitch.tv/membership
raw CAP REQ :twitch.tv/tags
raw CAP REQ :twitch.tv/commands
debug @raw
}
raw USERNOTICE:#tehrani:{
if (($msgtags(msg-id).key == sub) && ($msgtags(room-id).key == 191409899)) {
var %nick $iif($msgtags(display-name).key, $v1, $msgtags(login).key)
var %sub-plan $replace($msgtags(msg-param-sub-plan).key, 1000, $chr(36) $+ 4.99, 2000, $chr(36) $+ 9.99, 3000, $chr(36) $+ 24.99, Prime, Prime)
msg $1 /me HYPERS nickmercsSUB !!NEW SUB!! bingCute bingHeart Thank you %nick for subscribing with a %sub-plan Sub! tehranlOVE
}
if (($msgtags(msg-id).key == resub) && ($msgtags(room-id).key == 191409899)) {
var %nick $iif($msgtags(display-name).key, $v1, $msgtags(login).key)
VAR %sub-plan $replace($msgtags(msg-param-sub-plan).key, 1000, $chr(36) $+ 4.99, 2000, $chr(36) $+ 9.99, 3000, $chr(36) $+ 24.99, Prime, Prime)
msg $1 /me HYPERS bingAw !!SUB HYPE!! bingYay bingHype %nick has just resubscribed for $msgtags(msg-param-months).key months in a row with a %sub-plan Sub! tehranLove
}
if (($msgtags(msg-id).key == subgift) && ($msgtags(room-id).key == 191409899)) {
var %nick_from $iif($msgtags(display-name).key, $v1, $msgtags(login).key) , %nick_to $iif($msgtags(msg-param-recipient-display-name).key, $v1, $msgtags(msg-param-recipient-user-name).key)
VAR %sub-plan $replace($msgtags(msg-param-sub-plan).key, 1000, $chr(36) $+ 4.99, 2000, $chr(36) $+ 9.99, 3000, $chr(36) $+ 24.99)
msg $1 /me HYPERS nickmercsGIFT !!GIFT SUB!! bingHeart nickmercsGIFT Thank You %nick_from for gifting a %sub-plan sub to %nick_to $+ ! tehranLove
}
on *:TEXT:*subscribed*:#tehrani:{
if ($nick == twitchnotify) {
if ($5 == $null || $5- == Twitch Prime!) {
msg # tatPrime Thank you @ $+ $1 Twitch Prime Sub! tatPrime
}
}
}
on *:text:!twitter:#tehrani: {
if ((%floodhello) || ($($+(%,floodhello.,$nick),2))) { return }
set -u10 %floodhello On
set -u30 %floodhello. $+ $nick On
msg $chan Follow Tehrani on Twitter http://bit.ly/2uvIP24 bingMega $+
}
on *:text:!youtube:#tehrani: {
if ((%floodhello) || ($($+(%,floodhello.,$nick),2))) { return }
set -u10 %floodhello On
set -u30 %floodhello. $+ $nick On
msg $chan Subscribe to Tehrani's Official Youtube Channel; http://bit.ly/3aCo2uv nickmercsYT $+
}
on *:text:!discord:#tehrani: {
if ((%floodhello) || ($($+(%,floodhello.,$nick),2))) { return }
set -u10 %floodhello On
set -u30 %floodhello. $+ $nick On
msg $chan Join Tehrani's Official Discord Server so you can get updated when he goes live! http://bit.ly/30LyD1K tatSuh $+
}
on *:text:!donation:#tehrani: {
if ((%floodhello) || ($($+(%,floodhello.,$nick),2))) { return }
set -u10 %floodhello On
set -u30 %floodhello. $+ $nick On
msg $chan Feel free to donate here using this link; http://bit.ly/2RmUVUm tatTopD $+
}
on *:text:!mobile:#tehrani: {
if ((%floodhello) || ($($+(%,floodhello.,$nick),2))) { return }
set -u10 %floodhello On
set -u30 %floodhello. $+ $nick On
msg $chan bingMega 𝓜𝓞𝓑𝓘𝓛𝓔 𝓤𝓢𝓔𝓡𝓢 bingMega You can use this link http://bit.ly/30MzAXH to subscribe. bingOMG $+
}
on *:text:!sub:#tehrani: {
if ((%floodhello) || ($($+(%,floodhello.,$nick),2))) { return }
set -u10 %floodhello On
set -u30 %floodhello. $+ $nick On
msg $chan Subscribe to Tehrani on Twitch using this link; http://bit.ly/2TSAz7g 🔓 Unlocks emotes like these 【 tehranSalute tehranLove tehranRage tehranLike 】 $+
}
on *:text:!bsong:#tehrani: {
if ((%floodhello) || ($($+(%,floodhello.,$nick),2))) { return }
set -u10 %floodhello On
set -u30 %floodhello. $+ $nick On
msg $chan You can listen to Boris Official Song http://bit.ly/38Ga5dn nickmercsLIT $+
}
on *:text:!9nty:#tehrani: {
if ((%floodhello) || ($($+(%,floodhello.,$nick),2))) { return }
set -u10 %floodhello On
set -u30 %floodhello. $+ $nick On
msg $chan bingBad 9nty, make me Mod BabyRage 9nty make me a YouTube video BabyRage Stop deleting my messages BabyRage 9nty make that for me BabyRage 9nty how to make youtube thumbnails? BabyRage 9nty how do I do that? BabyRage 9nty how do I do this? BabyRage 9nty What's a boomer? - Plebs bingBad $+
}
on *:text:!backseat:#tehrani: {
if ((%floodhello) || ($($+(%,floodhello.,$nick),2))) { return }
set -u10 %floodhello On
set -u30 %floodhello. $+ $nick On
msg $chan Backseat gaming is when viewers tell Tehrani what to do in game, when it was not asked for. Please refrain from backseating in chat! If the Moderators see you backseat-game you'll be timed out and if you carry on with your actions you'll be banned! nickmercsANGRY $+
}
on *:text:!meta:#tehrani: {
if ((%floodhello) || ($($+(%,floodhello.,$nick),2))) { return }
set -u10 %floodhello On
set -u30 %floodhello. $+ $nick On
msg $chan Please do not tell Tehrani or chat info that he does not know in game, it ruins the experience for everyone bingFail $+
}
on *:text:!prime:#tehrani: {
if ((%floodhello) || ($($+(%,floodhello.,$nick),2))) { return }
set -u10 %floodhello On
set -u30 %floodhello. $+ $nick On
msg $chan $2 tatPrime Click this link to activate your twitch prime account! https://amzn.to/37AEWId After you link your account, click on the sub link and use the prime feature! Click here to sub! https://go.twitch.tv/subs/tehrani tatPrime $+
}
on *:text:!boris:#tehrani: {
if ((%floodhello) || ($($+(%,floodhello.,$nick),2))) { return }
set -u10 %floodhello On
set -u30 %floodhello. $+ $nick On
msg $chan http://bit.ly/2TTMdi1 KKomrade $+
}
on *:text:!tags:#tehrani: {
if ((%floodhello) || ($($+(%,floodhello.,$nick),2))) { return }
set -u10 %floodhello On
set -u30 %floodhello. $+ $nick On
msg $chan http://bit.ly/3aI4xkn bingCute $+
}

ON *:LOAD: {
SET -i %streamer tehrani
SET -i %mychan $chr(35) $+ $lower(%streamer)
}
ON $*:TEXT:/clips\.twitch\.tv\/(\w+)/iS:%mychan: {
;VAR %tc_streamer_only $true
;VAR %tc_repost_link $true
;VAR %tc_view_count $true
INC %tc
VAR %tc %tc $+ $ticks
JSONOpen -uw get_twitch_clip $+ %tc https://api.twitch.tv/helix/clips?id= $+ $regml(1)
JSONHttpHeader get_twitch_clip $+ %tc Client-ID avm4vi7zv0xpjkpi3d4x0qzk8xbrdw8
JSONHttpHeader get_twitch_clip $+ %tc Accept application/vnd.twitchtv.v5+json
JSONHttpFetch get_twitch_clip $+ %tc
IF (!$JSONError) {
VAR %tc_streamer $json(get_twitch_clip $+ %tc, data, 0, broadcaster_name).value
IF ((%tc_streamer_only) && (%tc_streamer != %streamer)) NOOP
ELSE MSG $chan 📽 Twitch Clip Info linked by $nick ▌ Streamer: %tc_streamer ▌ Title: $json(get_twitch_clip $+ %tc, data, 0, title).value ▌ Game: $twitch_lookup_game($json(get_twitch_clip $+ %tc, data, 0, game_id).value) ▌ Clipped By: $json(get_twitch_clip $+ %tc, data, 0, creator_name).value ▌ $clip_created_at($TwitchTime($json(get_twitch_clip $+ %tc, data, 0, created_at).value)) $IIF(%tc_view_count, ▌ View Count: $json(get_twitch_clip $+ %tc, data, 0, view_count).value, $null) $IIF(%tc_repost_link, ▌ Link: $json(get_twitch_clip $+ %tc, data, 0, url).value, $null)
}
JSONClose get_twitch_clip $+ %tc
}

alias twitch_lookup_game {
INC %tc
VAR %tc %tc $+ $ticks , %result
JSONOpen -uw twitch_lookup_game $+ %tc https://api.twitch.tv/helix/games?id= $+ $1
JSONHttpHeader twitch_lookup_game $+ %tc Client-ID avm4vi7zv0xpjkpi3d4x0qzk8xbrdw8
JSONHttpHeader twitch_lookup_game $+ %tc Accept application/vnd.twitchtv.v5+json
JSONHttpFetch twitch_lookup_game $+ %tc
IF (!$JSONError) VAR %result $json(twitch_lookup_game $+ %tc, data, 0, name).value
JSONClose twitch_lookup_game $+ %tc
RETURN %result
}

alias clip_created_at {
; this alias will word the time/date that the clip was clipped on differently depending on how long ago it was clipped
VAR %result
IF ($calc($ctime - $1) < 3600) VAR %result Clipped $duration($calc($ctime - $1)) ago
ELSEIF ($calc($ctime - $1) isnum 3600 - 86399) VAR %result Clipped $duration($calc($ctime - $1), 2) ago
ELSEIF ($calc($ctime - $1) isnum 86400 - 2678400) VAR %result Clipped on $asctime($1, mmm dd - h:nn TT)
ELSE VAR %result Clipped on $asctime($1, mmm dd - yyyy)
RETURN %result
}
}
RAW *:#tehrani: {
IF (($nick == tmi.twitch.tv) && (HOSTTARGET isin $rawmsg) && (%mychan isin $rawmsg)) {
tokenize 32 $rawmsg
IF ($chr(45) !isin $4) {
SET %current.host $twitch_name($remove($4, :))
IF (%current.host != $null) && ($5 isnum 2-) MSG %mychan We are now hosting %current.host with $5 active viewers $+ !
ELSEIF (%current.host != $null) && ($5 isnum 0-1) MSG %mychan We are now hosting %current.host $viewers(%current.host) viewers. Go visit them at twitch.tv/ $+ %current.host and say Boris Raid tehranLove !
}
}
}

alias currentgame {
JSONOpen -uw currentgame https://api.twitch.tv/kraken/channels/ $+ $1
JSONHttpHeader currentgame Client-ID avm4vi7zv0xpjkpi3d4x0qzk8xbrdw8
JSONHttpFetch currentgame
VAR %x $IIF($json(currentgame, game).value,$v1,????)
JSONClose currentgame
RETURN %x
}

alias viewers {
JSONOpen -uw viewers https://api.twitch.tv/kraken/streams/ $+ $1
JSONHttpHeader viewers Client-ID avm4vi7zv0xpjkpi3d4x0qzk8xbrdw8
JSONHttpFetch viewers
VAR %x $IIF($json(viewers, stream, viewers).value,$v1,????)
JSONClose viewers
RETURN %x
}

alias streamuptime {
JSONOpen -uw uptime https://api.twitch.tv/kraken/streams/ $+ $1
JSONHttpHeader uptime Client-ID avm4vi7zv0xpjkpi3d4x0qzk8xbrdw8
JSONHttpFetch uptime
VAR %x $IIF($JSON(uptime, stream, created_at).value,$duration($calc($ctime - $TwitchTime($JSON(uptime, stream, created_at).value)),2),????)
JSONClose uptime
RETURN %x
}

alias -l TwitchTime {
if ($regex($1-, /^(\d\d(?:\d\d)?)-(\d\d)-(\d\d)T(\d\d)\:(\d\d)\:(\d\d)(?:(?:Z$)|(?:([+-])(\d\d)\:(\d+)))?$/i)) {
var %m = $Gettok(January February March April May June July August September October November December, $regml(2), 32), %d = $ord($base($regml(3),10,10)), %o = +0, %t
if ($regml(0) > 6) %o = $regml(7) $+ $calc($regml(8) * 3600 + $regml(9))
%t = $calc($ctime(%m %d $regml(1) $regml(4) $+ : $+ $regml(5) $+ : $+ $regml(6)) - %o)
if ($asctime(zz) !== 0 && $regex($v1, /^([+-])(\d\d)(\d+)$/)) {
%o = $regml(1) $+ $calc($regml(2) * 3600 + $regml(3))
%t = $calc(%t + %o )
}
return %t
}
}
ON *:TEXT:!hosts:%mychan: {
IF (($ModCheck) && (!%CD_hosts)) {
SET -eu10 %CD_hosts On
JSONOpen -uw gethosts http://tmi.twitch.tv/hosts?include_logins=1&target= $+ %TwitchID $+ &nocache= $+ $ticks
JSONHttpHeader gethosts Client-ID avm4vi7zv0xpjkpi3d4x0qzk8xbrdw8
JSONHttpFetch gethosts
VAR %x = 0, %hosts
WHILE ($json(gethosts, hosts, %x, host_login).value) {
VAR %hosts %hosts $cached_name($v1) $+ $chr(44)
INC %x
}
IF (%hosts) MSG $chan bleedPurple Thank you to all the $numtok(%hosts, 32) awesome people who are currently hosting this stream: $left($sorttok(%hosts , 32, a), -1) bleedPurple
ELSE MSG $chan $nick $+ , no one is hosting the channel at the moment. FeelsBadMan
JSONClose gethosts
HSAVE -o displaynames displaynames.htb
}
}
ON *:CONNECT: {
IF ($server == tmi.twitch.tv) {
IF (!$hget(new_follows)) HMAKE new_follows
VAR %x = 0
JSONOpen -u newfollows https://api.twitch.tv/kraken/channels/ $+ $lower(%streamer) $+ /follows?client_id=avm4vi7zv0xpjkpi3d4x0qzk8xbrdw8&limit=100&nocache= $+ $ticks
WHILE (%x <= 100) {
VAR %follower_newest $get_follower_name(%x)
IF ((%follower_newest == %follower_last) || ($istok(%last_100_follows,%follower_newest,32))) {
IF (%x == 0) BREAK
SET %follower_last $get_follower_name(0)
BREAK
}
IF ($numtok(%last_100_follows,32) == 100) SET %last_100_follows $deltok(%last_100_follows, 100, 32)
SET %last_100_follows %follower_newest %last_100_follows
IF (%x == 100) SET %follower_last $get_follower_name(0)
INC %x
}
JSONClose newfollows
.timer.followercheck 0 60 followercheck
}
}
ON *:DISCONNECT: .timer.followercheck off

alias get_follower_name {
IF ($regex($json(newfollows, follows, $1, user, display_name).value,^\w+$)) RETURN $json(newfollows, follows, $1, user, display_name).value
ELSE RETURN $json(newfollows, follows, $1, user, name).value
}

alias followercheck {
VAR %x = 1
WHILE ($hget(new_follows,%x).item) {
VAR %name $v1
IF (%name ison %mychan) {
HDEL new_follows %name
SET %live_follows %live_follows %name $+ $chr(44)
}
INC %x
}
VAR %x = 0 , %new_follows
JSONOpen -u newfollows https://api.twitch.tv/kraken/channels/ $+ $lower(%streamer) $+ /follows?client_id=avm4vi7zv0xpjkpi3d4x0qzk8xbrdw8&limit=25&nocache= $+ $ticks
WHILE (%x <= 25) {
VAR %follower_newest $get_follower_name(%x)
IF (%follower_newest == $null) BREAK
IF ((%follower_newest == %follower_last) || ($istok(%last_100_follows,%follower_newest,32))) {
IF (%x == 0) BREAK
SET %follower_last $get_follower_name(0)
BREAK
}
IF ($numtok(%last_100_follows,32) == 100) SET %last_100_follows $deltok(%last_100_follows, 100, 32)
SET %last_100_follows %follower_newest %last_100_follows
VAR %new_follows %new_follows %follower_newest $+ $chr(44)
IF (%x == 25) SET %follower_last $get_follower_name(0)
INC %x
}
JSONClose newfollows
VAR %x = 1
WHILE ($gettok(%new_follows,%x,44)) {
VAR %name $v1
IF (%name ison %mychan) SET %live_follows %live_follows %name $+ $chr(44)
ELSE HADD -z new_follows %name 600
INC %x
}
IF (%live_follows) {
IF ($numtok(%live_follows,32) == 1) {
MSG %mychan KonCha Thank you for the follow $left(%live_follows,-1) $+ !
;WRITE -l1 new_follows.txt %live_follows thanks for the follow!
}
ELSEIF ($numtok(%live_follows,32) >= 2) {
MSG %mychan KonCha Thank you for the follows $left(%live_follows,-1) $+ !
;WRITE -l1 new_follows.txt %live_follows thanks for the follows!
}
;.timer.new_follows_clear 1 6 WRITE -dl1 new_follows.txt
;IF (%stream_is_live) SPLAY -pq follower_sound.mp3
UNSET %live_follows
}
}
on *:text:*:#tehrani:{
if ($nick isop #) { halt }
if ( $len($1-) >= 10 ) {
if ( $calc($regex($1-,/[A-Z]/g) / $regex($1-,/[A-Z]/gi) * 100) >= 70 ) {
var %capsblock = $rand(1,3)
if (%capsblock == 1) { msg $chan $nick -> stop typing in caps! [caps] [warning] bingWOW }
if (%capsblock == 2) { msg $chan $nick -> Ey! stop yelling! [caps] [warning] bingSpy }
if (%capsblock == 3) { msg $chan $nick -> stop typing in BIG LETTERS! [caps] [warning] bingMad }
write capsban.txt $nick
msg $chan /timeout $nick
}
}
}
on $*:text:/(^|\s)cheer\d+(\s|$)/i:#tehrani: {
if (($msgtags(room-id).key == ROOMID) && ($msgtags(bits).key)) {
msg # $msgtags(display-name).key has donated $msgtags(bits).key bits peepoHappy
}
}
ON *:TEXT:!uptime:#tehrani: {
IF (!%CD_twitch_uptime) {
SET -eu30 %CD_twitch_uptime $true
IF ($get_twitch_uptime) MSG $chan Channel has been live for $v1 $+ .
ELSE MSG $chan Channel is not live at the moment! (at least that's what the Twitch API is telling me)
}
}

alias get_twitch_uptime {
VAR %result
JSONOpen -uw uptime https://api.twitch.tv/kraken/streams?channel= $+ $remove($chan,$chr(35)) $+ &nocache= $+ $ticks
JSONHttpHeader uptime Client-ID avm4vi7zv0xpjkpi3d4x0qzk8xbrdw8
JSONHttpFetch uptime
VAR %result $json(uptime, streams, 0, created_at).value
JSONClose uptime
IF (%result) RETURN $duration($calc($ctime - $TwitchTime(%result)))
RETURN $false
}

; TwitchTime alias written by SReject and friends
alias TwitchTime {
if ($regex($1-, /^(\d\d(?:\d\d)?)-(\d\d)-(\d\d)T(\d\d)\:(\d\d)\:(\d\d)(?:(?:Z$)|(?:([+-])(\d\d)\:(\d+)))?$/i)) {
var %m = $Gettok(January February March April May June July August September October November December, $regml(2), 32), %d = $ord($base($regml(3),10,10)), %o = +0, %t
if ($regml(0) > 6) %o = $regml(7) $+ $calc($regml(8) * 3600 + $regml(9))
%t = $calc($ctime(%m %d $regml(1) $regml(4) $+ : $+ $regml(5) $+ : $+ $regml(6)) - %o)
if ($asctime(zz) !== 0 && $regex($v1, /^([+-])(\d\d)(\d+)$/)) {
%o = $regml(1) $+ $calc($regml(2) * 3600 + $regml(3))
%t = $calc(%t + %o )
}
return %t
}
}