Help with "on PARSELINE:in:" - 11/08/17 01:29 PM
So I'm using SReject's following code to catch Twitch whispers.
I also added in a small debug command to see what I was getting.
The part I need help with is how to get the user-id from the %Tags variable. One of the biggest issues here is the varying size of the raw data. If the user sends emotes over Twitch whispers, it makes the raw data significantly longer.
I'm also extremely interested in this regex stuff. I just don't know what "/^((@\S+ )?)(\x3A[^!@ ]+![^@ ]+@\S+) WHISPER (\S+) (\x3A.*)/i" means. I see a few recurring things, such as @/S+ and x3A , but I don't see the connection.
Code:
;; Converts incoming twitch whispers to private queries ;; Use on TEXT(/help on TEXT) or on OPEN(/help on OPEN) events to handle the event on $*:PARSELINE:in:/^((@\S+ )?)(\x3A[^!@ ]+![^@ ]+@\S+) WHISPER (\S+) (\x3A.*)/i:{ var %Count = $regml(0) var %Tags = $regml($calc(%Count -3)) var %User = $regml($calc(%Count -2)) var %Target = $regml($calc(%Count -1)) var %Msg = $regml(%Count) if ($regex($server, /^(tmi|irc)\.(chat\.)?twitch\.tv$/i) && $me == %target) { .parseline -it .parseline -itqp %Tags %User PRIVMSG $me %Msg } }
I also added in a small debug command to see what I was getting.
Code:
The code I added: echo -a Count: %Count --- Tags: %Tags --- User: %User --- Target: %Target --- Msg: %Msg Input: @badges=;color=#1E90FF;display-name=KubosKube;emotes=;message-id=1126;thread-id=85000852_106951528;turbo=0;user-id=85000852;user-type= kuboskube kuboskubot Foo Bar Output: Count: 5 --- Tags: @badges=;color=#1E90FF;display-name=KubosKube;emotes=;message-id=1126;thread-id=85000852_106951528;turbo=0;user-id=85000852;user-type= --- User: kuboskube --- Target: kuboskubot --- Msg: Foo Bar
The part I need help with is how to get the user-id from the %Tags variable. One of the biggest issues here is the varying size of the raw data. If the user sends emotes over Twitch whispers, it makes the raw data significantly longer.
I'm also extremely interested in this regex stuff. I just don't know what "/^((@\S+ )?)(\x3A[^!@ ]+![^@ ]+@\S+) WHISPER (\S+) (\x3A.*)/i" means. I see a few recurring things, such as @/S+ and x3A , but I don't see the connection.