Code: Select all
bind mode - *o log:mode
proc log:mode {nick uhost hand channel args} {
putquick "PRIVMSG $channel :$nick is an operator in $channel because of identification to the nickname $nick"
}
Code: Select all
bind mode - *o log:mode
proc log:mode {nick uhost hand channel args} {
putquick "PRIVMSG $channel :$nick sets $args in $channel because of the identification to his nickname."
}
Code: Select all
bind mode - +o log:mode
proc log:mode {nick uhost hand channel args} {
global botnick
if {$nick == $botnick} {return}
putquick "PRIVMSG $channel :$nick sets $args in $channel because of the identification to his nickname."
}
Using $args is a special case in tcl. Refer to: http://www.tcl.tk/man/tcl8.4/TclCmd/proc.htm :MODE (stackable) bind mode <flags> <mask> <proc>
proc-name <nick> <user@host> <handle> <channel> <mode-change> <victim>
Description: mode changes are broken down into their component parts before being sent here, so the <mode-change> will always be a single mode, such as "+m" or "-o". victim will show the argument of the mode change (for o/v/b/e/I) or "" if the set mode does not take an argument. Flags are ignored. The bot's automatic response to a mode change will happen AFTER all matching Tcl procs are called. The mask will be matched against '#channel +/-modes' and can contain wildcards.
If it is a server mode, nick will be "", user@host is the server name, and handle is *.
You probably want to add and use the $victim var to get the nick whose mode was changed..There is one special case to permit procedures with variable numbers of arguments. If the last formal argument has the name args, then a call to the procedure may contain more actual arguments than the procedure has formals. In this case, all of the actual arguments starting at the one that would be assigned to args are combined into a list (as if the list command had been used); this combined value is assigned to the local variable args.
Code: Select all
proc log:mode {nick uhost hand channel mode victim} {
putquick "PRIVMSG $channel :$nick sets $mode in $channel for $victim because of the identification to his nickname."
}
Code: Select all
Code: Select all
bind mode - * mode:why
bind notc - * notc:why
proc mode:why { nick uhost hand chan mchange victim } {
# check mode change
if { $mchange != "+o" } { return 0 }
# check nick and uhost opper is chanserv
if { $nick != "ChanServ" } { return 0 }
if { $uhost != "service@dal.net" } { return 0 }
# send a "why" message to chanserv
set chanserv chanserv@services.dal.net
puthelp "PRIVMSG $chanserv :WHY $chan $victim"
}
proc notc:why { nick uhost hand text dest} {
global botnick
# destination must be the bot
if { $dest != $botnick } { return 0 }
# check nick and uhost is chanserv
if { $nick != "ChanServ" } { return 0 }
if { $uhost != "service@dal.net" } { return 0 }
# a WHY result?
set matchrule {* has * access to *}
if { ![string match $matchrule $text] } { return 0 }
# save the why result to fule
set cformat {%d-%b-%Y-%H:%M}
set stamp [clock format [clock seconds] -format $cformat]
set fd [open WHY.txt a+]
puts $fd "$stamp $text"
close $fd
}
Code: Select all
bind mode - * mode:why
bind notc - * notc:why
proc mode:why { nick uhost hand chan mchange victim } {
# check mode change
if { $mchange != "+o" } { return 0 }
# check nick and uhost opper is chanserv
if { $nick != "ChanServ" || $uhost != "service@dal.net"} { return 0 }
# send a "why" message to chanserv
set chanserv chanserv@services.dal.net
puthelp "PRIVMSG $chanserv :WHY $chan $victim"
}
proc notc:why { nick uhost hand text {dest ""}} {
global botnick
set text [stripcodes b $text]
# destination must be the bot
if { $dest != $botnick } { return 0 }
# check nick and uhost is chanserv
if { $nick != "ChanServ" || $uhost != "service@dal.net"} { return 0 }
# a WHY result?
set matchrule {* has * access to *}
if { ![string match $matchrule $text] } { return 0 }
set channel [string trim [lindex [split $text] 5] .]
putserv "privmsg $channel :\00306$text"
}
Code: Select all
putserv "privmsg $channel :\00306$text"
Code: Select all
putserv "NOTICE @$channel :\00306$text"
Code: Select all
proc notc:why { nick uhost hand text {dest ""}} {
global botnick
set text [stripcodes b $text]
# destination must be the bot
if { $dest != $botnick } { return 0 }
# check nick and uhost is chanserv
if { $nick != "ChanServ" || $uhost != "service@dal.net"} { return 0 }
# a WHY result?
set matchrule {* has * access to *}
if { ![string match $matchrule $text] } { return 0 }
set channel [string trim [lindex [split $text] 5] .]
if {[string match [string tolower [lindex [split $text] 2]] "founder"]} {
set text "All rise now! The Founder has arrived! All hail [lindex [split $text] 0]"
}
if {[string match [string tolower [lindex [split $text] 2]] "sop"]} {
set text "Here it comes the Sop of $channel, Welcome [lindex [split $text] 0]"
}
if {[string match [string tolower [lindex [split $text] 2]] "aop"]} {
set text "[lindex [split $text] 0] is just an AOp in $channel"
}
putserv "privmsg $channel :\00306$text"
}
Code: Select all
....
set channel [string trim [lindex [split $text] 5] .]
set text [regsub { Channel Frozen: NO} $text ""]
putserv "NOTICE @$channel :\00306$text"
....
.. simply change:Tcl error [notc:why]: extra characters after close-quote
Code: Select all
proc notc:why { nick uhost hand text {dest ""}}
Code: Select all
proc notc:why { nick uhost hand text dest}