Spy/Relay script

By GlobalAnomaly on Jun 19, 2010

Pretty simple script here. When set, the script will relay every private message received by whoever you set it to into a specified channel or query.

Commands:

.spy on TARGET RELAY MESSAGE (RELAY can be a channel)
.spy off
.msg TARGET MESSAGE

NOTE:
I made the relay part slightly more complicated than it needs to be, but that's just how I do things.

on *:TEXT:.spy *:#: {
  if ($$2 == on) && (%spy != on) {
    set %spy on
    set %spy.nick $$3
    set %spy.relay $$4
    .msg # I am now relaying messages from $$3 to $+($$4,.)
    .timer 1 3 .msg $$3 $!decode( $encode($$5-,m) ,m)
  }
  if ($$2 == off) && (%spy != off) {
    unset %spy
    unset %spy.nick
    unset %spy.relay
    .msg # I am no longer relaying messages.
  }
  else {
    .msg # I am already spying on someone.
    halt
  }
}

on *:TEXT:*:?: {
  if ($nick == %spy.nick) {
    .msg %spy.relay $+($chr(3),10,<,$chr(3),7,$nick,$chr(3),10,>) $+($chr(3),7,$$1-)
    halt
  }
}

on *:ACTION:*:?: {
  if ($nick == %spy.nick) {
    .msg %spy.relay $+($chr(3),10,* $chr(32),$chr(3),7,$nick) $+($chr(3),10,$$1-)
    halt
  }
}

on *:TEXT:.msg *:*: {
  .timer 1 2 .msg $$2 $!decode( $encode($$3-,m) ,m)
}

Comments

Sign in to comment.
oldfix   -  Apr 18, 2019

How does it work? I want to know how your script works?

 Respond  
Jeroenz0r   -  Sep 05, 2010

Could cross server spying be possible? thats a feature I never see in these scripts :/

 Respond  
Bielie   -  Jun 24, 2010

Fixed + some changes.

 Respond  
Jethro   -  Jun 23, 2010

Biellie, why all the /halts? I mean, you're not using goto command here. They can be omitted with if conditions. This script can further be improved.

 Respond  
Bielie   -  Jun 23, 2010
on *:TEXT:.spy*:#: {
  if ($$2 == on) && (%spy != on) { set %spy on | set %spy.nick $$3 | set %spy.relay $$4 | notice $nick I am now relaying messages from $$3 to $+($$4,.) | .timer 1 2 .msg $$3 $!decode( $encode($$5-,m) ,m) }
  elseif ($$2 == off) && (%spy != off) { unset %spy* | .msg # I am no longer relaying messages. }
  else { notice $nick I am already spying on someone. }
}

on *:TEXT:*:?: {
  if ($nick == %spy.nick) { .msg %spy.relay $+($chr(3),10,<,$chr(3),7,$nick,$chr(3),10,>) $+($chr(3),7,$$1-) | halt } 
}

on *:ACTION:*:?: {
  if ($nick == %spy.nick) { .msg %spy.relay $+($chr(3),10,* $chr(32),$chr(3),7,$nick) $+($chr(3),10,$$1-) | halt }
on *:TEXT:.msg*:*: { .msg $$2 $!decode( $encode($$3-,m) ,m) }
}
 Respond  
GlobalAnomaly   -  Jun 19, 2010

[1:36:07 pm] <~ChanBot> .spy on Eva #Retribution derp
[1:36:07 pm] <~Artemis_Fowl> I am now relaying messages from Eva to #Retribution.
[1:36:21 pm] <&Lionheart> o_o lol
[1:36:27 pm] <~Artemis_Fowl> merp

Oh, I see.

 Respond  
Jethro   -  Jun 19, 2010

Not really. It'll only say it once. Try it and see for yourself.

 Respond  
GlobalAnomaly   -  Jun 19, 2010

@RicJames: Only if you take this snippet seriously. It's for fun more than anything.

@Jethro_: Thanks, I didn't consider any of those. But wouldn't your "spy $1-" repeat the alias, since in the alias it has "$$1-" at the end of:

.msg %spy.relay $+($chr(3),10,<,$chr(3),7,$nick,$chr(3),10,>) $+($chr(3),7,$$1-)

I mean, it'd say the message twice, wouldn't it?

 Respond  
Jethro   -  Jun 19, 2010

unset %spy
unset %spy.nick
unset %spy.relayCan simply be changed to:

unset %spy*

will get all the %spy variables unset respectively.

You don't need the halts.

And you can make an alias to save yourself the unneeded repetition of a routine.

on *:TEXT:*:?:spy $1-
on *:ACTION:*:?:spy $1-
alias -l spy {
  if ($nick == %spy.nick) {
    .msg %spy.relay $+($chr(3),10,<,$chr(3),7,$nick,$chr(3),10,>) $+($chr(3),7,$$1-)
  }
}
 Respond  
RicJames   -  Jun 19, 2010

Doesn't letting the whole world know you are spying on someone defeat the whole purpose of this snippet?

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.