Code: Select all
(4) PUB
bind pub <flags> <command> <proc>
procname <nick> <user@host> <handle> <channel> <text>
Description: used for commands given on a channel. The first word
becomes the command and everything else is the text argument.
Module: irc
(6) PUBM (stackable)
bind pubm <flags> <mask> <proc>
procname <nick> <user@host> <handle> <channel> <text>
Description: just like MSGM, except it's triggered by things said
on a channel instead of things /msg'd to the bot. The mask is
matched against the channel name followed by the text and can
contain wildcards. Also, if a line triggers a PUB bind, it will not
trigger a PUBM bind.
Module: irc
(8) JOIN (stackable)
bind join <flags> <mask> <proc>
procname <nick> <user@host> <handle> <channel>
Description: triggered by someone joining the channel. The mask in
the bind is matched against "#channel nick!user@host" and can
contain wildcards.
Module: irc
Code: Select all
### Settings ###
#This will be the channel where the opped users will be detected on.
set chan1 "#opchannel"
#This will be the channel to op the people on.
set chan2 "#chanforop"
### Don't edit anything below this! ###
bind pub n !opscan scan:ops
proc scan:ops {nick uhost hand chan text} {
global botnick chan1 chan2
if {(![validchan $chan1]) || (![validchan $chan2])} { return 0 }
if {(![string equal -nocase $chan $chan1]) || (![string equal -nocase $chan $chan2])} { return 0 }
putserv "PRIVMSG $chan1 :Scanning..."; set oplist [list]
foreach user [chanlist $chan1] {
if {([onchan $user $chan1]) && ([onchan $user $chan2])} {
lappend oplist $user
}
}
putserv "PRIVMSG $chan1 :Scanning completed."
if {([llength $oplist] >= 1) && ([botisop $chan2])} {
putserv "PRIVMSG $chan1 :Opping all users on $chan1 to $chan2."
foreach person $oplist {
pushmode $chan2 +o $person
}
flushmode $chan2
putserv "PRIVMSG $chan1 :Nick(s) [join $oplist {, }] has/have been successfully opped on $chan2.
}
return 0
}
Code: Select all
bind join - * join:scan:ops
proc join:scan:ops {nick uhost hand chan} {
scan:ops $nick $uhost $hand $chan ""
}
When i do this, the Bot alway scans chan1 and chan2. How can I make him scan only chan1 ?KrzychuG wrote:You can try to add this to your code:Code: Select all
bind join - * join:scan:ops proc join:scan:ops {nick uhost hand chan} { scan:ops $nick $uhost $hand $chan "" }
Code: Select all
### Settings ###
#This will be the channel 1 where the opped users will be detected on.
set chan1 "#opchannel"
#This will be the channel 2 where the opped users will be detected on.
set chan2 "#channel1"
#This will be the channel to op the people on.
set chan3 "#channel2"
### Don't edit anything below this! ###
bind join - * scan:ops
proc scan:ops {nick uhost hand chan} {
global botnick chan1 chan2 chan3
if {![validchan $chan1] || ![validchan $chan2] || ![validchan $chan3]} { return 0 }
if {![string equal -nocase $chan $chan1] || ![string equal -nocase $chan $chan2] || ![string equal -nocase $chan $chan3]} { return 0 }
putserv "PRIVMSG $chan1 :Scanning $chan1..."; set oplist [list]
foreach user [chanlist $chan1] {
if {[onchan $user $chan1] && [onchan $user $chan3]} {
lappend oplist $user
}
}
putserv "PRIVMSG $chan1 :Scanning completed for $chan1."
if {([llength $oplist] >= 1) && ([botisop $chan3])} {
putserv "PRIVMSG $chan1 :Opping all users on $chan1 to $chan3."
foreach person $oplist {
pushmode $chan3 +o $person
}
flushmode $chan3
putserv "PRIVMSG $chan1 :Nick(s) [join $oplist {, }] on $chan1 have been successfully opped on $chan3.
}
putserv "PRIVMSG $chan2 :Now scanning $chan2..."; set newoplist [list]
foreach newuser [chanlist $chan2] {
if {[onchan $user $chan2] && [onchan $user $chan3]} {
lappend newoplist $newuser
}
}
putserv "PRIVMSG $chan2 :Scanning completed for $chan2."
if {([llength $newoplist] >= 1) && ([botisop $chan3])} {
putserv "PRIVMSG $chan1 :Now opping all users on $chan2 to $chan3."
foreach newperson $newoplist {
pushmode $chan3 +o $newperson
}
flushmode $chan3
putserv "PRIVMSG $chan2 :Nick(s) [join $newoplist {, }] on $chan2 have been successfully opped on $chan3.
}
unset oplist; unset newoplist; return 0
}
Thx awyeah 4 helping ...awyeah wrote:Yes it is possible todo so. I beleive I made the script let's see if we can alter it. I beleive this will do it:
Code: Select all
putserv "PRIVMSG $chan1 :Nick(s) [join $oplist {, }] on $chan1 have been successfully opped on $chan3." }
Code: Select all
if {![string equal -nocase $chan $chan1] || ![string equal -nocase $chan $chan2] || ![string equal -nocase $chan $chan3]} { return 0 }
Code: Select all
### Settings ###
#This will be the channel 1 where the opped users will be detected on.
set chan1 "#op-channel1"
#This will be the channel 2 where the opped users will be detected on.
set chan2 "#op-channel2"
#This will be the channel to op the people on.
set chan3 "#trigger-channel"
### Don't edit anything below this! ###
bind join - * scan:ops
proc scan:ops {nick uhost hand chan} {
global botnick chan1 chan2 chan3
if {![string equal -nocase $chan $chan3] || ![botisop $chan3]} { return 0 }
if {![botonchan $chan1] || ![botonchan $chan2] || ![botonchan $chan3]} { return 0 }
putserv "PRIVMSG $chan1 :Scanning $chan1..."; set oplist [list]
foreach user [chanlist $chan1] {
if {[onchan $user $chan1] && [onchan $user $chan3] && ![isop $user $chan3]} {
lappend oplist $user
}
}
putserv "PRIVMSG $chan1 :Scanning completed for $chan1."
if {([llength $oplist] >= 1) && ([botisop $chan3])} {
putserv "PRIVMSG $chan1 :Opping all users on $chan1 to $chan3."
foreach person $oplist {
pushmode $chan3 +o $person
}
flushmode $chan3
putserv "PRIVMSG $chan1 :Nick(s) [join $oplist {, }] on $chan1 have been successfully opped on $chan3.
}
putserv "PRIVMSG $chan2 :Now scanning $chan2..."; set newoplist [list]
foreach newuser [chanlist $chan2] {
if {[onchan $newuser $chan2] && [onchan $newuser $chan3] && ![isop $newuser $chan3]} {
lappend newoplist $newuser
}
}
putserv "PRIVMSG $chan2 :Scanning completed for $chan2."
if {([llength $newoplist] >= 1) && ([botisop $chan3])} {
putserv "PRIVMSG $chan1 :Now opping all users on $chan2 to $chan3."
foreach newperson $newoplist {
pushmode $chan3 +o $newperson
}
flushmode $chan3
putserv "PRIVMSG $chan2 :Nick(s) [join $newoplist {, }] on $chan2 have been successfully opped on $chan3.
}
unset oplist; unset newoplist; return 0
}
I'd leave that line in.awyeah wrote: And remove this line as well it is not of much use:
if {![validchan $chan1] || ![validchan $chan2] || ![validchan $chan3]} { return 0 }