Eggheads: Coding ban script

Dariusz Kulinski takeda at
Fri Oct 8 22:24:44 CST 2004

Hello Anser,

Friday, October 8, 2004, 8:43:36 PM, you wrote:

>   How would you code a simple command, for instance if you type
> -vb nick in channel and you want to bot to kickban the user with the
> reason: You're infected with a virus, please join #vh for virus
> removal.

> It'd really help, thanks 

From memory (not tested):

--- cut here ---
namespace eval virus_kick {

variable Config

set Config(reason) "You're infected with a virus, please join #vh for virus removal"
set Config(bantime) 60

bind pub o|o -vb [current namespace]::pub_vb
proc pub_vb {unick uhost uhand chan text} {
  set victim [lindex [split $text] 0]

  if {![onchan $victim $chan]} {
    notice $unick "$victim is not on $chan"
    return 0

  set victim_hand [nick2hand $victim  $chan]
  if {[matchattr $victim_hand o|o $chan]} {
    notice $unick "I cannot ban $victim ($victim_hand), he is privileged user"
    return 0

  variable Config

  putkick $chan $victim $Config(reason)
  newchanban $chan "*!$uhost" $uhand $Config(reason) $Config(bantime)

  return 1

proc notice {nick msg} {
  puthelp "PRIVMSG $nick :$msg"

} ;# virus_kick
--- cut here ---

Best regards,
 Dariusz                            mailto:takeda at

More information about the Eggheads mailing list