mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2017
Posts: 14
K
Kex Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: Oct 2017
Posts: 14
Hello everyone, im looking for working followers greeting code in chat, at this moment, how i can realize that now? i tryed some results from net, but they don't work or i do it wrong. idk. Thank you for all helps o/

Joined: Oct 2015
Posts: 112
B
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
I wrote my own personal "in chat follower notification" script for mIRC a few months ago due to when the "on board Twitch App follows" were getting out of hand. For a few months, about 90%+ of my new follows as well as in many other channels were users that were not even in the channel. It became awkward trying to say "thank you for the follow" to hundreds of people that were not even there. crazy

I wrote this script that will check to make sure that the user who followed is actually in the channel. It keeps the new followers name in memory for ten minutes so unless the user who just followed joins within the next ten minutes or is already in the channel, the names will get discarded and you will not end up thanking someone for a follow that isn't even in the channel.

I did some quick editing to make this script shareable. All you should have to do it change "your_twitch_name" on line 6 before loading the script. Once loaded, just reconnect to the Twitch server and it should work. It is set to check every minute which is good enough and easy on mIRC IMO. You can change the "60" in the timer on line 28 if you want to change how often it checks. Enjoy. smile

Requirments: JSON for mIRC and mIRC v7.51

Code:
; =======================================================
; ===== TWITCH IN-CHAT FOLLOWER NOTIFICATION SCRIPT =====
; =======================================================

ON *:LOAD: {
  SET -i %streamer your_twitch_name
  SET -i %mychan $chr(35) $+ $lower(%streamer)
}

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 and welcome to the channel, $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 and welcome to the channel: $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 *:JOIN:%mychan: {
  IF ($hget(new_follows,$nick)) {
    HDEL new_follows $nick
    SET %live_follows %live_follows $nick $+ $chr(44)
  }
}

Joined: Oct 2017
Posts: 14
K
Kex Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: Oct 2017
Posts: 14
Omg, thank you for that titanic work!


Link Copied to Clipboard