All pastes #803208 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-12-01 00:12 UTC
rendered paste body
# op tools por Marco Ferra aka nXistence
# http://clientes.netvisao.pt/mferra/
# marcoferra@netvisao.pt
# versao 1.1

# !c, !op <nick>, !vo <nick>, !k <nick> razao
# !b <host> razao, !ub <host>, !kb <nick> razao
# !t <topico>, !p, !jump servidor porta, !die razao
# !status, !broadcast <mensagem>

bind pub o|o !h pub:h
bind pub o|o !c pub:c
bind pub o|o !op pub:op
bind pub o|o !vo pub:vo
bind pub o|o !k pub:kick
bind pub o|o !b pub:ban
bind pub o|o !ub pub:ub
bind pub o|o !kb pub:kb
bind pub o|o !t pub:topic
bind pub - !p pub:p
bind pub n !jump pub:jump
bind pub n !die pub:die
bind pub o !status pub:status
bind pub o !broadcast pub:broadcast

proc pub:h {nick uhost hand chan text} {
  puthelp "NOTICE $nick :!c !op !vo !k !b !ub !kb !t !p !jump !die !status !broadcast"
}

proc pub:c {nick uhost hand chan text} {
  if {[botisop $chan] == 1} {
    if {[isop $nick $chan] == 1} { pushmode $chan -o $nick } else { pushmode $chan +o $nick }
  } else { puthelp "NOTICE $nick :i dont have ops!" }
}

proc pub:op {nick uhost hand chan text} {
  if {[botisop $chan] == 1} {
    if {[string length $text] > 0} {
      set tnick [lindex $text 0]
      if {[onchan $tnick $chan]} {
        if {[isop $tnick $chan]} { pushmode $chan -o $tnick } else { pushmode $chan +o $tnick }
      } else { puthelp "NOTICE $nick :no such nick on channel!" }
    } else { puthelp "NOTICE $nick :usage !op <nick> - inverts the ops of a nick" }
  } else { puthelp "NOTICE $nick :i dont have ops!" }
}

proc pub:vo {nick uhost hand chan text} {
  if {[botisop $chan] == 1} {
    if {[string length $text] > 0} {
      set tnick [lindex $text 0]
      if {[onchan $tnick $chan]} {
        if {[isvoice $tnick $chan]} { pushmode $chan -v $tnick } else { pushmode $chan +v $tnick }
      } else { puthelp "NOTICE $nick :no such nick on channel!" }
    } else { puthelp "NOTICE $nick :usage !op <nick> - inverts the voices of a nick" }
  } else { puthelp "NOTICE $nick :i dont have ops!" }
}

proc pub:kick {nick uhost hand chan text} {
  if {[botisop $chan]} {
    if {[string length $text] > 0} {
      set tnick [lindex $text 0]
      if {[string length [lindex $text 1]] == 0} { set reason kicked } else { set reason [lrange $text 1 end] }
      if {[onchan $tnick $chan]} { putkick $chan $tnick $reason } else { puthelp "NOTICE $nick :no such nick on channel!" }
    } else { puthelp "NOTICE $nick :usage !k <nick> reason - kicks a nick" }
  } else { puthelp "NOTICE $nick :i dont have ops!" }
}

proc pub:ban {nick uhost hand chan text} {
  if {[botisop $chan]} {
    if {[string length $text] > 0} {
      set tnick [lindex $text 0]
      if {[onchan $tnick $chan]} {
        if {[string length [lindex $text 1]] == 0} { set reason banned } else { set reason [lrange $text 1 end] }
        newchanban $chan *!*@[lindex [split [getchanhost $tnick $chan] @] 1] $nick $reason 10
      } else { puthelp "notice $nick :no such nick on channel!" }
    } else { puthelp "NOTICE $nick :usage !b <nick> reason - bans a nick" }
  } else { puthelp "NOTICE $nick :i dont have ops!" }
}

proc pub:ub {nick uhost hand chan text} {
  if {[botisop $chan]} {
    if {[string length $text] > 0} {
      set tnick [lindex $text 0]
      if {[ischanban $tnick $chan]} { killchanban $chan $tnick } else { puthelp "NOTICE $nick :no such ban on $chan" }
    } else { puthelp "NOTICE $nick :usage !ub <nick!user@host> - unbans an address" }
  } else { puthelp "NOTICE $nick :i dont have ops!" }
}

proc pub:kb {nick uhost hand chan text} {
  if {[botisop $chan]} {
    if {[string length $text] > 0} {
      set tnick [lindex $text 0]
      if {[onchan $tnick $chan]} {
        if {[string length [lindex $text 1]] == 0} { set reason banned } else { set reason [lrange $text 1 end] }
        newchanban $chan *!*@[lindex [split [getchanhost $tnick $chan] @] 1] $nick $reason 10
        utimer 5 [putkick $chan $tnick $reason]
      } else { puthelp "notice $nick :no such nick on channel!" }
    } else { puthelp "NOTICE $nick :usage !kb <nick> reason - kicks and bans a nick" }
  } else { puthelp "NOTICE $nick :i dont have ops!" }
}

proc pub:topic {nick uhost hand chan text} {
  if {[botisop $chan]} { putserv "TOPIC $chan :$text" } else { puthelp "NOTICE $nick :i dont have ops!" }
}

proc pub:p {nick uhost hand chan text} { putserv "PRIVMSG $chan :connected!" }

proc pub:jump {nick uhost hand chan text} { jump $text }

proc pub:die {nick uhost hand chan text} { die $text }

proc pub:status {nick uhost hand chan text} {
  global server botname version
  puthelp "NOTICE $nick :user records: [countusers], channels: [channels], date: [date], time: [time], os: [unames], server: $server, host: $botname, egg version: [lindex $version 0]"
}

proc pub:broadcast {nick uhost hand chan text} {
  if {[string length $text] > 0} {
    set text [string trim $text "{}"]
    foreach n [channels] { puthelp "PRIVMSG $n :$text" }
  } else { puthelp "NOTICE $nick :!broadcast <message> - sends message to all channels that the bot is" }
}

putlog "tcl: optools loaded"