This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

chan relay script mod

Old posts that have not been replied to for several years.
Locked
d
dossi
Voice
Posts: 30
Joined: Mon Dec 20, 2004 9:21 pm

chan relay script mod

Post by dossi »

I found a script that relays what's happening in one channel, to another but I was wondering if someone could make public commands for it -- ex.

?spychan <chan> (bot joins channel and sets the variable $spy(chan) to <chan>

?spyoff (bot leaves channel and turns spying off [sets $spy(chan) to ""])

?spypeek (shows all names in spy channel, ops: voice: normal)

?spyrelay <chan> (sets the $spy(home) to <chan>

Here is the script:

Code: Select all

 # Info
# Author : MeTroiD - #v1per on Quakenet
# Version: 1.2
set spy(author)  "MeTroiD"
set spy(version) "1.2"
 
# Description
 
# This script will relay anything said on one channel to the other channel you configure
# I recommend you don't run this script on a bot that already has to do alot
# If the channel you're spying on has alot of users with alot of talking your bot could excess flood
 
# Configuration
 
# The channel it reports everything to
set spy(home) "#home"
 
# The channel it gets all the data from and then reports it to the homechannel
set spy(chan) "#chan"
 
 
bind PUBM   -|- *      spychan:chat
bind CTCP   -|- "ACTION"    spychan:action
bind SIGN   -|- "$spy(chan) *"   spychan:sign
bind JOIN   -|- "$spy(chan) *"   spychan:join
bind PART   -|- "$spy(chan) *"   spychan:part
bind SPLT   -|- "$spy(chan) *"   spychan:split
bind KICK   -|- "$spy(chan) *"   spychan:kick
bind RAW     *  "MODE"      spychan:mode
 
 
proc spychan:part { nickname hostname handle channel reason } {
 global spy
 if {[string equal -nocase $channel $spy(chan)]} {
 putserv "PRIVMSG $spy(home) :\[$channel\] * $nickname ($hostname) has left $spy(chan)"
 }
  }
 
 
proc spychan:join { nickname hostname handle channel } {
 global spy
 if {[string equal -nocase $channel $spy(chan)]} {
 putserv "PRIVMSG $spy(home) :\[$channel\] * $nickname ($hostname) has joined $spy(chan)"
 }
  }
 
proc spychan:kick { nickname hostname handle channel target reason } {
 global spy
 if {[string equal -nocase $channel $spy(chan)]} {
 putserv "PRIVMSG $spy(home) :\[$channel\] * $target was kicked from $spy(chan) by $nickname ($reason)"
 }
  }
 
proc spychan:mode { from key arguments } {
 global spy
 set channel [string trim [lindex [split $arguments] 0]]  
 set modechange [string trim [lindex [split $arguments] 1]]  
 set victims [string trim [join [lrange [split $arguments] 2 end]]]  
 
 set nickname [string trim [lindex [split $from "!"] 0]]  
 set hostname [string trim [lindex [split $from "!"] 1]]
 if {[string equal -nocase $channel $spy(chan)]} {
 putserv "PRIVMSG $spy(home) :\[$channel\] * $nickname sets mode: $modechange $victims"
 }
  }
 
proc spychan:sign { nickname hostname handle channel reason } {
 global spy
 if {[string equal -nocase $channel $spy(chan)]} {
 putserv "PRIVMSG $spy(home) :\[$channel\] * $nickname ($hostname) has quit IRC ($reason)"
 }
  }
 
proc spychan:split { nickname hostname handle channel arguments } {
 global spy
 if {[string equal -nocase $channel $spy(chan)]} {
 putserv "PRIVMSG $spy(home) :\[$channel\] * $nickname has split from the network"
 }
  }
 
proc spychan:chat { nickname hostname handle channel arguments } {
 global spy
 if {[string equal -nocase $channel $spy(chan)]} {
   putserv "PRIVMSG $spy(home) :\[$channel\] <$nickname> $arguments"
   }
  }
 
proc spychan:action { nickname hostname handle channel keyword arguments } {
 global spy
 if {[string equal -nocase $channel $spy(chan)]} {
   putserv "PRIVMSG $spy(home) :\[$channel\] * $nickname $arguments"
   }
  }
 
 
putlog "spy $spy(version) loaded" 
Any help/guidance is appriciated.
Last edited by dossi on Sat Feb 05, 2005 7:19 pm, edited 2 times in total.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Re: chan relay script mod

Post by awyeah »

dossi wrote:I found a script that relays what's happening in one channel, to another but I was wondering if someone could make public commands for it -- ex.

?spychan <chan> (bot joins channel and sets the variable $spy(chan) to <chan>

?spyoff (bot leaves channel and turns spying off [sets $spy(chan) to ""])

?spypeek (shows all names in spy channel, ops: voice: normalSmiley

?spyrelay <chan> (sets the $spy(home) to <chan>Wink

Here is the script:

Code: Select all

 # Info
# Author : MeTroiD - #v1per on Quakenet
# Version: 1.2
set spy(author)  "MeTroiD"
set spy(version) "1.2"
 
# Description
 
# This script will relay anything said on one channel to the other channel you configure
# I recommend you don't run this script on a bot that already has to do alot
# If the channel you're spying on has alot of users with alot of talking your bot could excess flood
 
# Configuration
 
# The channel it reports everything to
set spy(home) "#home"
 
# The channel it gets all the data from and then reports it to the homechannel
set spy(chan) "#chan"
 
 
bind PUBM   -|- *      spychan:chat
bind CTCP   -|- "ACTION"    spychan:action
bind SIGN   -|- "$spy(chan) *"   spychan:sign
bind JOIN   -|- "$spy(chan) *"   spychan:join
bind PART   -|- "$spy(chan) *"   spychan:part
bind SPLT   -|- "$spy(chan) *"   spychan:split
bind KICK   -|- "$spy(chan) *"   spychan:kick
bind RAW     *  "MODE"      spychan:mode
 
 
proc spychan:part { nickname hostname handle channel reason } {
 global spy
 if {[string equal -nocase $channel $spy(chan)]} {
 putserv "PRIVMSG $spy(home) :\[$channel\] * $nickname ($hostname) has left $spy(chan)"
 }
  }
 
 
proc spychan:join { nickname hostname handle channel } {
 global spy
 if {[string equal -nocase $channel $spy(chan)]} {
 putserv "PRIVMSG $spy(home) :\[$channel\] * $nickname ($hostname) has joined $spy(chan)"
 }
  }
 
proc spychan:kick { nickname hostname handle channel target reason } {
 global spy
 if {[string equal -nocase $channel $spy(chan)]} {
 putserv "PRIVMSG $spy(home) :\[$channel\] * $target was kicked from $spy(chan) by $nickname ($reason)"
 }
  }
 
proc spychan:mode { from key arguments } {
 global spy
 set channel [string trim [lindex [split $arguments] 0]]  
 set modechange [string trim [lindex [split $arguments] 1]]  
 set victims [string trim [join [lrange [split $arguments] 2 end]]]  
 
 set nickname [string trim [lindex [split $from "!"] 0]]  
 set hostname [string trim [lindex [split $from "!"] 1]]
 if {[string equal -nocase $channel $spy(chan)]} {
 putserv "PRIVMSG $spy(home) :\[$channel\] * $nickname sets mode: $modechange $victims"
 }
  }
 
proc spychan:sign { nickname hostname handle channel reason } {
 global spy
 if {[string equal -nocase $channel $spy(chan)]} {
 putserv "PRIVMSG $spy(home) :\[$channel\] * $nickname ($hostname) has quit IRC ($reason)"
 }
  }
 
proc spychan:split { nickname hostname handle channel arguments } {
 global spy
 if {[string equal -nocase $channel $spy(chan)]} {
 putserv "PRIVMSG $spy(home) :\[$channel\] * $nickname has split from the network"
 }
  }
 
proc spychan:chat { nickname hostname handle channel arguments } {
 global spy
 if {[string equal -nocase $channel $spy(chan)]} {
   putserv "PRIVMSG $spy(home) :\[$channel\] <$nickname> $arguments"
   }
  }
 
proc spychan:action { nickname hostname handle channel keyword arguments } {
 global spy
 if {[string equal -nocase $channel $spy(chan)]} {
   putserv "PRIVMSG $spy(home) :\[$channel\] * $nickname $arguments"
   }
  }
 
 
putlog "spy $spy(version) loaded" 
Any help/guidance is appriciated.
Here are the small binds and procs you requested. Try to combine them into your script now:

Code: Select all

bind pub - "!spychan" set:spychan

proc set:spychan {nick uhost hand chan text} {
 global $spy(chan)
 if {[string index $text 0] == "#"} {
 set $spy(chan) [lindex $text 0]
 }
}

bind pub - "!spyoff" set:spyoff

proc set:spyoff {nick uhost hand chan text} {
 global $spy(chan)
 channel remove $spy(chan)
 set $spy(chan) ""
 }
}


bind pub - "!spypeek" set:spypeek

proc set:spypeek {nick uhost hand chan text} {
 global $spy(chan)
 putserv "PRIVMSG $chan :Status for $spy(chan): [chanlist $spy(chan)]"
}


bind pub - "!spyrelay" set:spyrelay

proc set:spyrelay {nick uhost hand chan text} {
 global $spy(home)
 if {[string index $text 0] == "#"} {
 set $spy(home) [lindex $text 0]
 }
}

·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
d
dossi
Voice
Posts: 30
Joined: Mon Dec 20, 2004 9:21 pm

Post by dossi »

Hmm, I'm getting a few errors --

[17:35] Tcl error [set:spypeek]: can't read "spy(chan)": no such variable
(When trying to !spypeek and the others)
User avatar
avilon
Halfop
Posts: 64
Joined: Tue Jul 13, 2004 6:58 am
Location: Germany

Post by avilon »

dossi wrote:Hmm, I'm getting a few errors --

[17:35] Tcl error [set:spypeek]: can't read "spy(chan)": no such variable
(When trying to !spypeek and the others)
Remove the $ in the "global" line in each proc.
e.g. change

Code: Select all

global $spy(chan)
to

Code: Select all

global spy(chan) 
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

actually, 'spy' is is an array, so it should be just

Code: Select all

global spy
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

avilon wrote:
dossi wrote:Hmm, I'm getting a few errors --

[17:35] Tcl error [set:spypeek]: can't read "spy(chan)": no such variable
(When trying to !spypeek and the others)
Remove the $ in the "global" line in each proc.
e.g. change

Code: Select all

global $spy(chan)
to

Code: Select all

global spy(chan) 
or

Code: Select all

global spy
d
dossi
Voice
Posts: 30
Joined: Mon Dec 20, 2004 9:21 pm

Post by dossi »

Ok, that works -- Thanks for the help so far, but I have a few more errors

When I try to !spychan, it doesn't join the channel and start spying on it (it seems it can't re-write $spy(chan))

Then, when I try !spypeek, I get the error Tcl error [set:spypeek]: invalid channel "" -- (In the original script, I have $spy(chan) "" <--set to that, but I have tried setting it to others, then !spychan and !spypeek, and it says the same error Tcl error [set:spypeek]: invalid channel "#testomg"
Locked