Voiceops

From ProjectWiki
Revision as of 05:21, 4 May 2008 by 68.210.173.118 (Talk)
Jump to: navigation, search

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! ^^

To Do

Allow setting a channel flag on the bot to enable voiceops for that channel.

Source Code

Either download this: voiceops.tcl.txt Or copy/paste this:

#############
# Voiceops.tcl - lets +v or +o users !kick !topic !ban !unban !invite
# Copyright eris 2007 All Rights Reversed!
# 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
 
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]) && ($chan == "#lesbian" || $chan == "#!net69")} {
    return 1
  } else {
    return 0
  }
}
 
#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"
    }
  }
}
 
#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"
    }
  }
}
Personal tools
irssi scripts
eggdrop scripts