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)
}
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) }
}
@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?
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-)
}
}