mIRC Homepage
Posted By: Mandarb @raw - 29/09/15 06:40 PM
Hello,

I think I'm to dense to get my scripts to listen to and act upon raw data. Yes, it has to do with Twitch whisper functions. I know how to send a whisper back to twitch, and I can also see whispers send to my bot in that @raw window ( //window -e @raw | debug @raw )

On of those messages looks like that in the moment:

<- @color=#008000;display-name=Doctor_Mandarb;emotes=;message-id=45;thread-id=40900786_63581763;turbo=0;user-id=40900786;user-type= :doctor_mandarb!doctor_mandarb@doctor_mandarb.tmi.twitch.tv WHISPER nurse_bot :!Test

What I'd love my script do to, is to pick up on the !Test and continue to run whatever it is I script into it laugh

I hope somebody has found a way to listen and act upon that debug window data. Otherwise, my Bot will have to listen to normal send text commands, and answer back with a whisper to keep the chat a bit less spammed laugh

Thanks a lot,
Mandarb
Posted By: Wims Re: @raw - 29/09/15 07:38 PM
mIRC recently added a new event, on parseline, it triggers for any line sent and received by/to the IRC server, you are forced to use that since the whisper message are not part of the IRC protocol.

Basic stuff:

Code:
on *:parseline:in:* WHISPER *:{
echo -s rcvd: $parseline
}
Posted By: Mandarb Re: @raw - 01/10/15 05:07 AM
Good morning,

sorry for takeing so long to get back. I did implement your answer into mIRC and it worked. But... now I've got 2 more questions.

Currently I load a variable with the rcvd: $parseline and store that data as a string. Then I perform some string manipulation ... count, search etc ... to get 2 information out of that string: display-name=Doctor_Mandarb and !Test

While the display-name is then discarded with some more string manipulation... I'm wondering if there is a more effective & efficient way to get to that data (without lines and lines of string manipulation???

That was the 1. question, now the 2nd question.

on *:parseline:in:* WHISPER *:{

I'm looking for WHISPER within the parseline (raw data) and it works... however is there a way to look for WHISPER and another word, in this case the !test ???

I didn't have much time yesterday to try anything on that part, and now I'm back at work. But before I run into a wall of my own clumsiness in scripting, I thought I ask if looking for WHISPER & !Test is actual possible. Perhaps some form of wildcard match?

Thanks for your time, and keep up the good work!

Greetings,
Mandarb
Posted By: MattiSony Re: @raw - 01/10/15 08:02 AM
For the 1st one you can use $msgtags(display-name).key to get the display-name.(I think that's what you were asking about :P)

For the 2nd you can use; on *:parseline:in:*whisper*!test*:
Posted By: Mandarb Re: @raw - 01/10/15 10:13 AM
Thanks,
I'll try it out tonight. From the looks of it, I'm sure it will work smile I'll let you know how it turned out smile
Posted By: FroggieDaFrog Re: @raw - 01/10/15 10:37 AM
A script that completely handles twitch's whispers for the user:

http://hawkee.com/snippet/16489/
Posted By: Mandarb Re: @raw - 01/10/15 06:10 PM
Thank you all for your help.

I'm sure Froggie that your script will run fine, I didn't test it yet, because with Matti's solution my scripts run well enough right now:

On Text

on *:TEXT:!Test:#doctor_mandarb: {
if ($nick == doctor_mandarb) {
; Whatever the command is doing
}
}

On Whisper

on $*:PARSELINE:in:*WHISPER*!test*:{
var %nick $msgtags(display-name).key
if (%nick == doctor_mandarb) {
; Whatever the command is doing
}
}

Since it's only 1 extra line to grab the nick (when it's a whisper command), I don't need to rewrite a lot and can keep my scripts more or less how they are.

Not that I'm going to change to much, but a few of those bot reactions did spam to much on my channel.

Thanks again to Wims for rcvd: $parseline !!! That one does come in handy too, when looking for certain other things within the string.

Again much thanks to all for the quick answers. That did save me some time, and now I can use the weekend to focus on the scripts and commands themself.

Greetings,
Mandarb
© mIRC Discussion Forums