Voiceops
From ProjectWiki
(Difference between revisions)
Line 1: | Line 1: | ||
− | |||
__TOC__ | __TOC__ | ||
==Whats This?== | ==Whats This?== | ||
Line 10: | Line 9: | ||
==To Do== | ==To Do== | ||
− | + | <s>Allow setting a channel flag on the bot to enable voiceops for that channel.</s> DONE!! 2008.09.18 :D | |
Help could be a bit more verbose explaining which arguments are accepted | Help could be a bit more verbose explaining which arguments are accepted | ||
Line 19: | Line 18: | ||
Or copy/paste this: | Or copy/paste this: | ||
− | + | <source lang="tcl"> | |
############# | ############# | ||
# Voiceops.tcl - lets +v or +o users !kick !topic !ban !unban !invite | # Voiceops.tcl - lets +v or +o users !kick !topic !ban !unban !invite | ||
Line 28: | Line 27: | ||
#bindings go here, change if u wish | #bindings go here, change if u wish | ||
− | bind pub - | + | bind pub - "!kick" pub:kick |
− | bind pub - | + | bind pub - "!topic" pub:topic |
− | bind pub - | + | bind pub - "!ban" pub:ban |
− | bind pub - | + | bind pub - "!unban" pub:unban |
− | bind pub - | + | bind pub - "!invite" pub:invite |
− | bind pub - | + | bind pub - "!+m" pub:moderate |
− | bind pub - | + | bind pub - "!-m" pub:unmoderate |
− | bind pub - | + | bind pub - "!+i" pub:plusi |
− | bind pub - | + | bind pub - "!-i" pub:minusi |
− | bind pub - | + | bind pub - "!lockdown" pub:lockdown |
− | bind pub - | + | bind pub - "!release" pub:release |
− | bind pub - | + | bind pub - "!voiceops" pub:voiceopshelp |
setudef flag voiceops | setudef flag voiceops | ||
− | putlog | + | putlog "voiceop.tcl loaded! :P" |
#function to make sure the user is voiced or opped, and this channel supports voiceop | #function to make sure the user is voiced or opped, and this channel supports voiceop | ||
proc voiceop:validuser {nick chan} { | proc voiceop:validuser {nick chan} { | ||
− | if {([isop $nick $chan] || [isvoice $nick $chan]) & | + | if {([isop $nick $chan] || [isvoice $nick $chan]) && ([channel get $chan voiceops])} { |
return 1 | return 1 | ||
} else { | } else { | ||
Line 56: | Line 55: | ||
proc pub:voiceopshelp {nick host hand chan text} { | proc pub:voiceopshelp {nick host hand chan text} { | ||
if {[voiceop:validuser $nick $chan]} { | if {[voiceop:validuser $nick $chan]} { | ||
− | puthelp | + | puthelp "PRIVMSG $chan :Valid commands are: !kick !topic !ban !unban !invite !+m !-m !+i !-i !lockdown (moderate+invite) !release (terminate lockdown mode)" |
} | } | ||
} | } | ||
Line 65: | Line 64: | ||
if {[voiceop:validuser $nick $chan]} { | if {[voiceop:validuser $nick $chan]} { | ||
if {[onchan $whom $chan]} { | if {[onchan $whom $chan]} { | ||
− | puthelp | + | puthelp "PRIVMSG $chan :$nick, are u blind?! $whom is already in $chan! :P" |
} else { | } else { | ||
− | puthelp | + | puthelp "PRIVMSG $chan :inviting $whom to $chan..." |
− | puthelp | + | puthelp "INVITE $whom $chan" |
− | putlog | + | putlog "$nick invited $whom to $chan" |
} | } | ||
} | } | ||
Line 77: | Line 76: | ||
proc pub:lockdown {nick host hand chan text} { | proc pub:lockdown {nick host hand chan text} { | ||
if {[voiceop:validuser $nick $chan]} { | if {[voiceop:validuser $nick $chan]} { | ||
− | putlog | + | putlog "$nick locked down $chan" |
− | puthelp | + | puthelp "MODE $chan +m+i" |
− | puthelp | + | puthelp "PRIVMSG $chan :channel in lockdown mode use !release to clear" |
} | } | ||
} | } | ||
Line 86: | Line 85: | ||
proc pub:release {nick host hand chan text} { | proc pub:release {nick host hand chan text} { | ||
if {[voiceop:validuser $nick $chan]} { | if {[voiceop:validuser $nick $chan]} { | ||
− | putlog | + | putlog "$nick unlocked down $chan" |
− | puthelp | + | puthelp "MODE $chan -m-i" |
} | } | ||
} | } | ||
Line 94: | Line 93: | ||
proc pub:plusi {nick host hand chan text} { | proc pub:plusi {nick host hand chan text} { | ||
if {[voiceop:validuser $nick $chan]} { | if {[voiceop:validuser $nick $chan]} { | ||
− | putlog | + | putlog "$nick made $chan invite only" |
− | puthelp | + | puthelp "MODE $chan +i" |
} | } | ||
} | } | ||
Line 102: | Line 101: | ||
proc pub:minusi {nick host hand chan text} { | proc pub:minusi {nick host hand chan text} { | ||
if {[voiceop:validuser $nick $chan]} { | if {[voiceop:validuser $nick $chan]} { | ||
− | putlog | + | putlog "$nick set $chan -i" |
− | puthelp | + | puthelp "MODE $chan -i" |
} | } | ||
} | } | ||
Line 110: | Line 109: | ||
proc pub:moderate {nick host hand chan text} { | proc pub:moderate {nick host hand chan text} { | ||
if {[voiceop:validuser $nick $chan]} { | if {[voiceop:validuser $nick $chan]} { | ||
− | putlog | + | putlog "$nick moderated $chan" |
− | puthelp | + | puthelp "MODE $chan +m" |
} | } | ||
} | } | ||
Line 118: | Line 117: | ||
proc pub:unmoderate {nick host hand chan text} { | proc pub:unmoderate {nick host hand chan text} { | ||
if {[voiceop:validuser $nick $chan]} { | if {[voiceop:validuser $nick $chan]} { | ||
− | putlog | + | putlog "$nick unmoderated $chan" |
− | puthelp | + | puthelp "MODE $chan -m" |
} | } | ||
} | } | ||
Line 127: | Line 126: | ||
set hostmask [lindex $text 0] | set hostmask [lindex $text 0] | ||
if {[voiceop:validuser $nick $chan]} { | if {[voiceop:validuser $nick $chan]} { | ||
− | putlog | + | putlog "$nick removed ban $hostmask from $chan" |
− | puthelp | + | puthelp "MODE $chan -b $hostmask" |
} | } | ||
} | } | ||
Line 139: | Line 138: | ||
if {[onchan $whom $chan]} { | if {[onchan $whom $chan]} { | ||
if {![isop $whom $chan]} { | if {![isop $whom $chan]} { | ||
− | putserv | + | putserv "MODE $chan +b *!$bhost" |
pub:kick $nick $host $hand $chan $text | pub:kick $nick $host $hand $chan $text | ||
− | putlog | + | putlog "$nick banned $whom on $chan" |
} else { | } else { | ||
− | puthelp | + | puthelp "PRIVMSG $chan :nowai i'm banin' an op!!!" |
} | } | ||
} else { | } else { | ||
− | puthelp | + | puthelp "PRIVMSG $chan :$nick $whom is not on $chan" |
} | } | ||
} | } | ||
Line 154: | Line 153: | ||
proc pub:topic {nick host hand chan text} { | proc pub:topic {nick host hand chan text} { | ||
if {[voiceop:validuser $nick $chan]} { | if {[voiceop:validuser $nick $chan]} { | ||
− | putserv | + | putserv "TOPIC $chan :$text" |
− | putlog | + | putlog "$nick changed topic to $text on $chan" |
} | } | ||
} | } | ||
Line 166: | Line 165: | ||
if {[onchan $whom $chan]} { | if {[onchan $whom $chan]} { | ||
if {![isop $whom $chan]} { | if {![isop $whom $chan]} { | ||
− | putserv | + | putserv "KICK $chan $whom :$reason" |
− | putlog | + | putlog "$nick kicked $whom from $chan" |
} else { | } else { | ||
− | puthelp | + | puthelp "PRIVMSG $chan :nowai i'm kickin' an op!!!" |
} | } | ||
} else { | } else { | ||
− | puthelp | + | puthelp "PRIVMSG $chan :$nick $whom is not on $chan" |
} | } | ||
} | } | ||
} | } | ||
− | + | </source> |
Revision as of 11:45, 26 November 2010
Contents |
Whats This?
Eggdrop tcl script that enables otherwise powerless users with +v in a channel to kick, ban or set topics sorta providing halfops type functionality on networks limited to ops and voices (like efnet :). Will not of course ban/kick ops! ^^
After copying to your scripts directory and adding to the bot's config file type:
.chanset #somechannel +voiceops
to activate for that channel
To Do
Allow setting a channel flag on the bot to enable voiceops for that channel. DONE!! 2008.09.18 :D
Help could be a bit more verbose explaining which arguments are accepted
Source Code
Either download this: voiceops.tcl.txt Or copy/paste this:
############# # Voiceops.tcl - lets +v or +o users !kick !topic !ban !unban !invite # .chanset #somechannel +voiceops to activate # voice'd users may type !voiceops for help # enjoys \^_^/!!!! #bindings go here, change if u wish bind pub - "!kick" pub:kick bind pub - "!topic" pub:topic bind pub - "!ban" pub:ban bind pub - "!unban" pub:unban bind pub - "!invite" pub:invite bind pub - "!+m" pub:moderate bind pub - "!-m" pub:unmoderate bind pub - "!+i" pub:plusi bind pub - "!-i" pub:minusi bind pub - "!lockdown" pub:lockdown bind pub - "!release" pub:release bind pub - "!voiceops" pub:voiceopshelp setudef flag voiceops putlog "voiceop.tcl loaded! :P" #function to make sure the user is voiced or opped, and this channel supports voiceop proc voiceop:validuser {nick chan} { if {([isop $nick $chan] || [isvoice $nick $chan]) && ([channel get $chan voiceops])} { return 1 } else { return 0 } } #Help me erin!!! proc pub:voiceopshelp {nick host hand chan text} { if {[voiceop:validuser $nick $chan]} { puthelp "PRIVMSG $chan :Valid commands are: !kick !topic !ban !unban !invite !+m !-m !+i !-i !lockdown (moderate+invite) !release (terminate lockdown mode)" } } #invite a user to channel proc pub:invite {nick host hand chan text} { set whom [lindex $text 0] if {[voiceop:validuser $nick $chan]} { if {[onchan $whom $chan]} { puthelp "PRIVMSG $chan :$nick, are u blind?! $whom is already in $chan! :P" } else { puthelp "PRIVMSG $chan :inviting $whom to $chan..." puthelp "INVITE $whom $chan" putlog "$nick invited $whom to $chan" } } } #lockdown channel (set chanmode +im) proc pub:lockdown {nick host hand chan text} { if {[voiceop:validuser $nick $chan]} { putlog "$nick locked down $chan" puthelp "MODE $chan +m+i" puthelp "PRIVMSG $chan :channel in lockdown mode use !release to clear" } } #release lockdown'd channel (set chanmode -im) proc pub:release {nick host hand chan text} { if {[voiceop:validuser $nick $chan]} { putlog "$nick unlocked down $chan" puthelp "MODE $chan -m-i" } } #make channel invite only proc pub:plusi {nick host hand chan text} { if {[voiceop:validuser $nick $chan]} { putlog "$nick made $chan invite only" puthelp "MODE $chan +i" } } #moderate channel proc pub:minusi {nick host hand chan text} { if {[voiceop:validuser $nick $chan]} { putlog "$nick set $chan -i" puthelp "MODE $chan -i" } } #moderate channel proc pub:moderate {nick host hand chan text} { if {[voiceop:validuser $nick $chan]} { putlog "$nick moderated $chan" puthelp "MODE $chan +m" } } #unmoderate channel proc pub:unmoderate {nick host hand chan text} { if {[voiceop:validuser $nick $chan]} { putlog "$nick unmoderated $chan" puthelp "MODE $chan -m" } } #remove a ban from a channel proc pub:unban {nick host hand chan text} { set hostmask [lindex $text 0] if {[voiceop:validuser $nick $chan]} { putlog "$nick removed ban $hostmask from $chan" puthelp "MODE $chan -b $hostmask" } } #ban a user from channel proc pub:ban {nick host hand chan text} { set whom [lindex $text 0] if {[voiceop:validuser $nick $chan]} { set bhost [getchanhost $whom $chan] if {[onchan $whom $chan]} { if {![isop $whom $chan]} { putserv "MODE $chan +b *!$bhost" pub:kick $nick $host $hand $chan $text putlog "$nick banned $whom on $chan" } else { puthelp "PRIVMSG $chan :nowai i'm banin' an op!!!" } } else { puthelp "PRIVMSG $chan :$nick $whom is not on $chan" } } } #change channel topic proc pub:topic {nick host hand chan text} { if {[voiceop:validuser $nick $chan]} { putserv "TOPIC $chan :$text" putlog "$nick changed topic to $text on $chan" } } #kick user from channel proc pub:kick {nick host hand chan text} { set whom [lindex $text 0] set reason [lrange $text 1 end] if {[voiceop:validuser $nick $chan]} { if {[onchan $whom $chan]} { if {![isop $whom $chan]} { putserv "KICK $chan $whom :$reason" putlog "$nick kicked $whom from $chan" } else { puthelp "PRIVMSG $chan :nowai i'm kickin' an op!!!" } } else { puthelp "PRIVMSG $chan :$nick $whom is not on $chan" } } }