Originally Posted By: KubosKube
So I'm using SReject's following code to catch Twitch whispers.
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.


Assuming you are using mTwitch.Core.mrc -- as that's where the snippet above comes from -- you can make use of the provided $mTwitch.MsgTags() alias:
Code:
  $mTwitch.MsgTags(%Tags, user-id)


Originally Posted By: KubosKube
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.


The regex matches as follows:
  • Attempt to match at the start of the line: '^'
  • match @ followed by 1 or more Non-whitespace characters followed by a space: '@\S+ '
  • The above part may or may not exist, so the regex engine shouldn't require this part to match before attempting the next part; denoted with: '?'
  • Create a back reference for the above match; this is done via (): '((@\S+ )?)'
  • Match ':'(indicated by '\x3A') followed by one or more characters that AREN'T(indicated by the '^') '!' or '@' or space: '[^!@ ]+'
  • Then Match '!' followed by one or more characters that AREN'T '@' or space: '![^@ ]+'
  • Then Match '@' followed by one or more non-whitespace characters: '@\S+'
  • Then match the literal text: ' WHISPER '
  • Then match one or more whitespace characters, creating a back reference: '(\S+)'
  • Then match a space followed by ':'(indicated by '\x3A') followed by zero or more characters: ' (\x3A.*)'
  • The entire matching process should be case insensitive: '/[...]/i'

In summery it matches @tags(optional) :UserName!ident@host WHISPER target :message

--

As an aside:
For questions related specifically to mTwitch and/or its usage, feel free to open an issue ticket. Non-bug reports that are scripting-related questions involving mTwitch are allowed.

I also run a twitch channel specifically for mirc: #mirchelp. Feel free to drop in and ask questions for realtime support. I can't say I'm always active, but I am always idle, so as soon as I see your question(s) I'll provide assistant

Last edited by FroggieDaFrog; 12/08/17 06:31 PM.

I am SReject
My Stuff