This is just a basic mass op/deop/voice/devoice script. (pub/msg)
This does not include a mass kick/ban function.
# $Id: mass.tcl,v1 13/02/2008 11:37:42am GMT +12 (NZST) istok @ IRCSpeed.org Exp $
# - Script Info:
# - This is just a basic mass op/deop/voice/devoice script. (pub/msg)
# - This does not include a mass kick/ban function.
# - Default trigger set to '.' (Free to edit)
# - Syntax:
# - Help (PUB): .mass help
# - Help (MSG): /msg <botnick> mass <#channel> help
# - On/Off (PUB): .masscmd on|off
# - On/Off (MSG): /msg <botnick> masscmd <#channel> on|off
# - The above commands are restricted to global operator access.
# - public: .mop - .mdeop - .mvoice - .mdevoice (in channel)
# - privmsg: /msg <botnick> <command> <#channel>
# - example; /msg getafix mdeop #chat
# - where 'getafix' is my bot.
# - The above commands are restricted to global operator and
# - channel master.
# Set this to the trigger you wish to use for the bot.
set pubtrig "."
###### CODE BLOCK ######
setudef flag masscmd
proc getTrigger {} {
global pubtrig
return $pubtrig
}
bind pub - ${pubtrig}mass mass:help:pub
bind msg - mass mass:help:msg
bind pub - ${pubtrig}mop mop:proc
bind msg - mop mop:msg
bind pub - ${pubtrig}mdeop mdeop:proc
bind msg - mdeop mdeop:msg
bind pub - ${pubtrig}mvoice mvoice:proc
bind msg - mvoice mvoice:msg
bind pub - ${pubtrig}mdevoice mdevoice:proc
bind msg - mdevoice mdevoice:msg
bind pub - ${pubtrig}masscmd chanset:masscmd
bind msg - masscmd chanset:massmsg
proc mass:help:pub {nick uhost hand chan text} {
global botnick
if {![matchattr $hand o|m $chan] && ![channel get $chan masscmd]} {return}
if {[lindex [split $text] 0] == ""} {
puthelp "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrigger]mass help"; return
}
if {[lindex [split $text] 0] == "help"} {
putserv "NOTICE $nick :\002Public Cmds\002: [getTrigger]masscmd on/off - [getTrigger]mop - [getTrigger]mdeop - [getTrigger]mvoice - [getTrigger]mdevoice"
putserv "NOTICE $nick :\002Message Cmds\002: /msg $botnick masscmd <#channel> on/off - /msg $botnick mop/mdeop/mvoice/mdevoice <#channel>"; return
}
}
proc mass:help:msg {nick uhost hand arg} {
global botnick
set chan [strlwr [lindex $arg 0]]
if {![matchattr $hand o|m $chan] && ![channel get $chan masscmd]} {return}
if {![string match "*#*" $arg]} {return}
if {[lindex [split $arg] 1] == ""} {
putserv "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrigger]mass help"; return
}
if {[lindex $arg 1] == "help"} {
putserv "NOTICE $nick :\002MassHelp\002"
putserv "NOTICE $nick :\002Public Cmds\002: [getTrigger]masscmd on/off - [getTrigger]mop - [getTrigger]mdeop - [getTrigger]mvoice - [getTrigger]mdevoice"
putserv "NOTICE $nick :\002Message Cmds\002: /msg $botnick masscmd <#channel> on/off - /msg $botnick mop/mdeop/mvoice/mdevoice <#channel>"; return
}
}
proc mop:proc {nick uhost hand chan text} {
global botnick
if {![matchattr $hand o|m $chan] && ![channel get $chan masscmd]} {return}
if {[string tolower $nick] != [string tolower $botnick]} {
putserv "NOTICE $chan :MassOP requested by: $nick"
foreach whom [chanlist $chan] {
if {![isop $whom $chan] && ![isbotnick $whom] && [onchan $whom $chan]} {
pushmode $chan +o $whom
}
}
flushmode $chan
}
}
proc mop:msg {nick uhost hand arg} {
global botnick
set chan [strlwr [lindex $arg 0]]
if {![matchattr $hand o|m $chan] && ![channel get $chan masscmd]} {return}
putserv "NOTICE $chan :MassOP requested by: $nick"
foreach whom [chanlist $chan] {
if {[string tolower $nick] != [string tolower $botnick]} {
if {![isop $whom $chan] && ![isbotnick $whom] && [onchan $whom $chan]} {
pushmode $chan +o $whom
}
}
flushmode $chan
}
}
proc mdeop:proc {nick uhost hand chan text} {
global botnick
if {![matchattr $hand o|m $chan] && ![channel get $chan masscmd]} {return}
if {[string tolower $nick] != [string tolower $botnick]} {
putserv "NOTICE $chan :MassDeop requested by: $nick"
foreach whom [chanlist $chan] {
if {[isop $whom $chan] && ![isbotnick $whom] && [onchan $whom $chan]} {
pushmode $chan -o $whom
}
}
flushmode $chan
}
}
proc mdeop:msg {nick uhost hand arg} {
global botnick
set chan [strlwr [lindex $arg 0]]
if {![matchattr $hand o|m $chan] && ![channel get $chan masscmd]} {return}
putserv "NOTICE $chan :MassDeop requested by: $nick"
foreach whom [chanlist $chan] {
if {[string tolower $nick] != [string tolower $botnick]} {
if {[isop $whom $chan] && ![isbotnick $whom] && [onchan $whom $chan]} {
pushmode $chan -o $whom
}
}
flushmode $chan
}
}
proc mvoice:proc {nick uhost hand chan text} {
global botnick
if {![matchattr $hand o|m $chan] && ![channel get $chan masscmd]} {return}
if {[string tolower $nick] != [string tolower $botnick]} {
putserv "NOTICE $chan :MassVoice requested by: $nick"
foreach whom [chanlist $chan] {
if {![isvoice $whom $chan] && ![isbotnick $whom] && [onchan $whom $chan]} {
pushmode $chan +v $whom
}
}
flushmode $chan
}
}
proc mvoice:msg {nick uhost hand arg} {
global botnick
set chan [strlwr [lindex $arg 0]]
if {![matchattr $hand o|m $chan] && ![channel get $chan masscmd]} {return}
putserv "NOTICE $chan :MassVoice requested by: $nick"
foreach whom [chanlist $chan] {
if {[string tolower $nick] != [string tolower $botnick]} {
if {![isvoice $whom $chan] && ![isbotnick $whom] && [onchan $whom $chan]} {
pushmode $chan +v $whom
}
}
flushmode $chan
}
}
proc mdevoice:proc {nick uhost hand chan text} {
global botnick
if {![matchattr $hand o|m $chan] && ![channel get $chan masscmd]} {return}
if {[string tolower $nick] != [string tolower $botnick]} {
putserv "NOTICE $chan :MassDevoice requested by: $nick"
foreach whom [chanlist $chan] {
if {[isvoice $whom $chan] && ![isbotnick $whom] && [onchan $whom $chan]} {
pushmode $chan -v $whom
}
}
flushmode $chan
}
}
proc mdevoice:msg {nick uhost hand arg} {
global botnick
set chan [strlwr [lindex $arg 0]]
if {![matchattr $hand o|m $chan] && ![channel get $chan masscmd]} {return}
putserv "NOTICE $chan :MassDevoice requested by: $nick"
foreach whom [chanlist $chan] {
if {[string tolower $nick] != [string tolower $botnick]} {
if {[isvoice $whom $chan] && ![isbotnick $whom] && [onchan $whom $chan]} {
pushmode $chan -v $whom
}
}
flushmode $chan
}
}
proc chanset:masscmd {nick uhost hand chan text} {
if {[matchattr $hand o|m $chan]} {
if {[lindex [split $text] 0] == ""} {puthelp "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getTrigger]masscmd on|off"; return}
if {[lindex [split $text] 0] == "on"} {
if {[channel get $chan masscmd]} {puthelp "PRIVMSG $chan :This setting is already enabled for $chan"; return}
channel set $chan +masscmd
puthelp "PRIVMSG $chan :Enabled MassCMD for $chan"
}
if {[lindex [split $text] 0] == "off"} {
if {![channel get $chan masscmd]} {puthelp "PRIVMSG $chan :This setting is already disabled for $chan"; return}
channel set $chan -masscmd
puthelp "PRIVMSG $chan :Disabled MassCMD for $chan"
}
}
}
proc chanset:massmsg {nick uhost hand arg} {
set chan [strlwr [lindex $arg 0]]
if {[matchattr $hand o|m $chan]} {
if {$chan == ""} {putserv "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $::botnick masscmd #channel on|off"; return}
if {![string match "*#*" $chan]} {putserv "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $::botnick masscmd #channel on|off"; return}
if {[lindex [split $text] 1] == ""} {putserv "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $::botnick masscmd $chan on|off"; return}
if {[lindex [split $arg] 1] == "on"} {
if {[channel get $chan masscmd]} {putserv "NOTICE $nick :This setting is already enabled for $chan"; return}
channel set $chan +masscmd
putserv "NOTICE $nick :Enabled MassCMD for $chan"
}
if {[lindex [split $arg] 1] == "off"} {
if {![channel get $chan masscmd]} {putserv "NOTICE $nick :This setting is already disabled for $chan"; return}
channel set $chan -masscmd
putserv "NOTICE $nick :Disabled MassCMD for $chan"
}
}
}
putlog "mass.tcl .:Loaded:. - istok @ IRCSpeed.org"
lol TCL = tool command language and the \'error\' is just using such things as \"lindex, lrange, etc\" without changing the arguments to a list \'[split \"arguments\"]\' then rejoining them later on by \'[join \"previous arguments\"]\' since lindex,lsearch,lrange,llength are commands FOR lists hence the l at the beginning of each command XD
lindex,lsearch,lrange,llength = list index, list search, list range, and list length to name a few