##### COMMANDS USED BY THIS SCRIPT #####
proc say {who what} {
puthelp "PRIVMSG $who :$what"
}
proc notice {who what} {
puthelp "NOTICE $who :$what"
}
proc cleanarg {arg} {
set temp ""
for {set i 0} {$i < [string length $arg]} {incr i} {
set char [string index $arg $i]
if {($char != "\12") && ($char != "\15")} {
append temp $char
}
}
set temp [string trimright $temp "\}"]
set temp [string trimleft $temp "\{"]
return $temp
}
##### AUTH SECTION #####
# The auth is a protection script so that ip spoofers won't be able to
# use the commands, and take over channels. once you sign off, the auth
# will expire.
# Owners will be able to disable a user from using commands. This will
# not allow them to auth themselves.
# The binds:
bind pub n .disable pub:disable
bind pub n .enable pub:enable
bind msg - auth auth:auth
bind sign - * auth:signcheck
bind msg - deauth auth:deauth
# This is the command for owners to disable a user.
# Usage: .disable <handle>
proc pub:disable {nick host hand chan arg} {
if {[llength $arg] < 1} {
notice $nick "Usage: .disable <handle>"
return 0
}
set who [lindex $arg 0]
if {![validuser $who]} {
notice $nick "$who is not a valid user."
return 0
}
setuser $who XTRA AUTH "DEAD"
notice $nick "Disabled $who"
putcmdlog "<<$nick>> !$hand! disable $who"
}
proc pub:enable {nick host hand chan arg} {
if {[llength $arg] < 1} {
notice $nick "Usage: .enable <handle>"
return 0
}
set who [lindex $arg 0]
if {![validuser $who]} {
notice $nick "$who is not a valid user."
return 0
}
setuser $who XTRA AUTH 0
notice $nick "Enabled $who"
putcmdlog "<<$nick>> !$hand! enable $who"
}
# Usage: /msg $botnick auth <password>
proc auth:auth {nick uhost hand arg} {
global botnick
set found 0
foreach n [channels] {
if {[onchan $nick $n]} {
set found 1
}
}
if {$found == 0} {return 0}
if {[llength $arg] <1} {
notice $nick "Usage: /msg $botnick auth <pass>"
return 0
}
set pass [lindex $arg 0]
if {$hand == "*"} {
say $nick "You are not permitted to use my commands."
return 0
}
if {[getuser $hand XTRA AUTH] == "DEAD"} {
say $nick "Sorry, but you have been disabled from using my commands."
return 0
}
if {[passwdok $hand $pass]} {
setuser $hand XTRA "AUTH" "1"
putcmdlog "<<$nick>> ($uhost) !$hand! AUTH ..."
notice $nick "Password accepted."
return 0
} else {
notice $nick "Password denied."
}
}
proc auth:signcheck {nick uhost hand chan reason} {
if {$hand == "*"} {return 0}
if {[getuser $hand XTRA AUTH] == "DEAD"} {
return 0
}
setuser $hand XTRA "AUTH" "0"
putlog "Auth for $hand expired."
}
proc auth:check {hand} {
set auth [getuser $hand XTRA "AUTH"]
if {($auth == "") || ($auth == "0") || ($auth == "DEAD")} {
return 0
} else { return 1}
}
proc auth:deauth {nick uhost hand arg} {
if {[getuser $hand XTRA AUTH] == "DEAD"} {
say $nick "Sorry, but you have been disabled from using my commands."
return 0
}
if {$hand != "*"} {
setuser $hand XTRA "AUTH" "0"
putcmdlog "<<$nick>> ($uhost) !$hand! DEAUTH"
notice $nick "Authentication has been removed."
}
}
##### BINDS #############################
bind pub o|m .ignore pub:ignore
bind pub o|m .unignore pub:unignore
bind pub n|n .flags pub:flags
bind pub o|m .ignorelist pub:ignorelist
bind pub o|o .banlist pub:banlist
bind pub - .kick pub:kick
bind pub o|o .ban pub:ban
bind pub o|o .unban pub:unban
bind pub o|o .voice pub:voice
bind pub o|o .devoice pub:devoice
bind pub o|o .op pub:op
bind pub o|o .deop pub:deop
bind pub o|o .opme pub:opme
bind pub n .adduser pub:adduser
bind pub o|o .help pub:help
bind pub - help pub:helpa
bind pub n .chattr pub:chattr
bind pub n .deluser pub:deluser
bind pub m|n .addhost pub:addhost
bind pub m|n .delhost pub:rmhost
##### GLOBALS #####
set pub_pingchan ""
##### PROCS #####
# Tells someone the time and date
# Usage: !time
proc pub:time {nick host hand chan arg} {
notice $nick "[ctime [unixtime]]"
}
# Tells the bot to stop running
# Usage: !die [reason]
proc pub:die {nick host hand chan arg} {
if {(![auth:check $hand]) && (![isop $nick $chan])} {return 0}
notice $nick "Sutting down... later!"
putcmdlog "<<$nick>> !$hand! die $arg"
die $arg
}
# Jumps to a new server
# Usage: !jump <server>[:port]
proc pub:jump {nick host hand chan arg} {
if {(![auth:check $hand]) && (![isop $nick $chan])} {return 0}
notice $nick "Jumping to $arg..."
jump $arg
putlog "<<$nick>> !$hand! jump $arg"
}
# Resets all bans to what they should be on the bot's banlist
# Usage: !forcebans
proc pub:forcebans {nick host hand chan arg} {
if {(![auth:check $hand]) && (![isop $nick $chan])} {return 0}
notice $nick "Resetting all bans to match my banlist..."
resetbans $chan
putcmdlog "<<$nick>> !$hand! forcebans"
}
# Rehashes the bot
# Usage: !rehash
proc pub:rehash {nick host hand chan arg} {
if {(![auth:check $hand]) && (![isop $nick $chan])} {return 0}
notice $nick "Rehashing..."
rehash
putcmdlog "<<$nick>> !$hand! rehash"
}
# Reloads the userfile
# Usage: !reload
proc pub:reload {nick host hand chan arg} {
if {(![auth:check $hand]) && (![isop $nick $chan])} {return 0}
notice $nick "Reloading..."
reload
putcmdlog "<<$nick>> !$hand! reload"
}
# Restarts the bot
# Usage: !restart
proc pub:restart {nick host hand chan arg} {
if {(![auth:check $hand]) && (![isop $nick $chan])} {return 0}
notice $nick "restart..."
restart
putcmdlog "<<$nick>> !$hand! restart"
}
# Saves the userfile and channel file
# Usage: !save
proc pub:save {nick host hand chan arg} {
if {(![auth:check $hand]) && (![isop $nick $chan])} {return 0}
notice $nick "Saving channel file and user file..."
save
putcmdlog "<<$nick>> !$hand! save"
}
# Makes a backup of the userfile
# Usage: !backup
proc pub:backup {nick host hand chan arg} {
if {(![auth:check $hand]) && (![isop $nick $chan])} {return 0}
notice $nick "Backing up the userfile..."
backup
putcmdlog "<<$nick>> !$hand! backup"
}
# Prints out a ban list
# Usage: !banlist
proc pub:banlist {nick host hand chan arg} {
notice $nick "\002Global bans:\002"
if {[banlist] == ""} {
notice $nick "none"
} else {
foreach ig [banlist] {
set what [lindex $ig 0]
set by [lindex $ig 1]
set comment [lindex $ig 4]
notice $nick "$what - made by $by - $comment"
}}
notice $nick "\002Bans for $chan:\002"
if {[banlist $chan] == ""} {
notice $nick "none"
} else {
foreach b [banlist $chan] {
set what [lindex $b 0]
set by [lindex $b 5]
set comment [lindex $b 1]
notice $nick "$what - made by $by - $comment"
}}
}
# Prints out an ignore list
# Usage: !ignorelist
proc pub:ignorelist {nick host hand chan arg} {
if {[ignorelist] == ""} {
notice $nick "I don't have any ignores."
return 0
}
notice $nick "Ignore list:"
foreach ig [ignorelist] {
set what [lindex $ig 0]
set by [lindex $ig 4]
set comment [lindex $ig 1]
notice $nick "$what - made by $by - $comment"
}
}
# Gives the global bot flags for a person
# Usage: !flags <handle>
proc pub:flags {nick host hand chan arg} {
if {[llength $arg]<1} {
notice $nick "Usage: .flags <handle>"
return 0
}
set who [lindex $arg 0]
if {![validuser $who]} {
notice $nick "I don't know who $who is."
return 0
}
set flags [chattr $who]
notice $nick "Global flags for $who: $flags"
putcmdlog "<<$nick>> !$hand! flags $who"
}
# Gives a bunch of statistics
# Usage: !status
proc pub:status {nick host hand chan arg} {
global server botname version
notice $nick "\002Bot statistics:\002"
notice $nick "User records: [countusers]"
notice $nick "My channels: [channels]"
notice $nick "Linked bots: [bots]"
notice $nick "My date: [ctime [clock seconds]]"
notice $nick "My time: [time]"
notice $nick "My operating system: [unames]"
notice $nick "Server: $server"
notice $nick "My host: $botname"
notice $nick "Eggdrop version: [lindex $version 0]"
putcmdlog "<<$nick>> !$hand! status"
}
# Changes the channel settings for a channel
# Usage: !chanset <chan> <what> [args]
proc pub:chanset {nick host hand chan arg} {
if {(![auth:check $hand]) && (![isop $nick $chan])} {return 0}
if {[llength $arg] < 2} {
notice $nick "Usage: !chanset <#channel> <mode> \[args\]"
return 0
}
set thechan [lindex $arg 0]
set mode [lindex $arg 1]
set a [lrange $arg 2 end]
if {![validchan $thechan]} {
notice $nick "I don't monitor that channel."
return 0
}
channel set $thechan $mode $a
putcmdlog "<<$nick>> !$hand! chanset $thechan $mode $a"
}
# Lists the bots on the botnet
# Usage: !bots
proc pub:bots {nick host hand chan arg} {
set bots [bots]
notice $nick "Bots: $bots"
putcmdlog "<<$nick>> !$hand! bots"
}
# Lists the channels the bot is on
# Usage: !channels
proc pub:channels {nick host hand chan arg} {
set chans [chanlist]
notice $nick "Channels: $chans"
putcmdlog "<<$nick>> !$hand! channels"
}
# Makes a new ignore
# Usage: !ignore <who/host> <life> <reason>
proc pub:ignore {nick uhost hand chan args} {
if {(![auth:check $hand]) && (![isop $nick $chan])} {return 0}
set args [split [cleanarg $args]]
if {[llength $args] < 3} {
notice $nick "Usage: .ignore <nick/host> <time> <reason>"
return 0
}
set who [lindex $args 0]
set time [expr [lindex $args 1]]
set reason [lrange $args 2 end]
if {$hand == "*"} {return 0}
if {([isop $hand $chan]) || ([matchattr $hand "|o" $chan]) || ([matchattr $hand "o"])} {
if {![onchan $who $chan]} {
set theban $who
} else {
set host [getchanhost $who $chan]
set host [maskhost $host]
set shost [split $host "!"]
set theban "*!*[lindex $shost 1]"
}
newignore $theban $nick $reason $time
putcmdlog "<<$nick>> !$hand! ignore $args"
} else {
notice $nick "You can't do that!"
}
}
# Kills an ignore
# Usage: !unignore <ignore mask>
proc pub:unignore {nick uhost hand chan args} {
if {(![auth:check $hand]) && (![isop $nick $chan])} {return 0}
set args [split [cleanarg $args]]
if {[llength $args]<1} {
notice $nick "Usage: .unignore <host>"
return 0
}
set theban [lindex $args 0]
if {$hand == "*"} {return 0}
if {([isop $hand $chan]) || ([matchattr $hand "|o" $chan]) || ([matchattr $hand "o"])} {
killignore $theban
putcmdlog "<<$nick>> !$hand! unignore $chan $theban"
} else {
notice $nick "You can't do that!"
}
}
# Says something on any channel
# Usage: !say <chan> <what>
proc pub:say {nick host hand chan arg} {
global botnick
if {![auth:check $hand]} {return 0}
if {[llength $arg] < 2} {
notice $nick "Usage: !say <chan> <what>"
return 0
}
set thechan [lindex $arg 0]
set what [lrange $arg 1 end]
if {![onchan $botnick $thechan]} {
notice $nick "I'm not on that channel."
return 0
}
puthelp "PRIVMSG $chan :$what"
notice $nick "Said to $thechan: $what"
putcmdlog "<<$nick>> !$hand! ($thechan) !say $what"
}
# Puts an action (/me) on a channel
# Usage: !act <chan> <what>
proc pub:act {nick host hand chan arg} {
global botnick
if {![auth:check $hand]} {return 0}
if {[llength $arg] < 2} {
notice $nick "Usage: !act <chan> <what>"
return 0
}
set thechan [lindex $arg 0]
set what [lrange $arg 1 end]
if {![onchan $botnick $thechan]} {
notice $nick "I'm not on that channel."
return 0
}
puthelp "PRIVMSG $chan :\001ACTION $what\001"
notice $nick "Act to $thechan: $what"
putcmdlog "<<$nick>> !$hand! ($thechan) !act $what"
}
# Changes a mode on the channel
# Usage: !mode <mode change>
# Ex: !mode +m, !mode +k booger
proc pub:mode {nick uhost hand chan args} {
if {(![auth:check $hand]) && (![isop $nick $chan])} {return 0}
set args [cleanarg $args]
if {[llength $args]<1} {
notice $nick "Usage: !mode <mode change>"
return 0
}
if {$hand == "*"} {return 0}
if {([isop $hand $chan]) || ([matchattr $hand "|o" $chan]) || ([matchattr $hand "o"])} {
putserv "MODE $chan $args"
putcmdlog "<<$nick>> !$hand! mode $args"
} else {
notice $nick "You can't do that!"
}
}
# Kicks someone off the channel
# Usage: !kick <nick> <reason>
# Ex: !kick Joe You suck!
proc pub:kick {nick uhost hand chan args} {
if {(![auth:check $hand]) && (![isop $nick $chan])} {return 0}
set args [split [cleanarg $args]]
if {[llength $args] < 2} {
notice $nick "Usage: .kick <nick> <reason>"
return 0
}
if {$hand == "*"} {return 0}
if {([isop $hand $chan]) || ([matchattr $hand "|o" $chan]) || ([matchattr $hand "o"])} {
set who [lindex $args 0]
set reason [lrange $args 1 end]
putserv "KICK $chan $who :$reason"
putcmdlog "<<$nick>> !$hand! kick $args"
} else {
notice $nick "You can't do that!"
}
}
# Bans a nick/host off the channel
# Usage: !ban <nick/host> <time> <reason>
# nick/host :If you put a nick in, it will mask the host, but if you
# put a host in, it will ban the host.
# time: The time the ban will last (in minutes). 0 for permanent.
proc pub:ban {nick uhost hand chan args} {
if {(![auth:check $hand]) && (![isop $nick $chan])} {return 0}
set args [split [cleanarg $args]]
if {[llength $args] < 3} {
notice $nick "Usage: .ban <nick/host> <time> <reason>"
return 0
}
set who [lindex $args 0]
set time [expr [lindex $args 1]]
set reason [lrange $args 2 end]
if {$hand == "*"} {return 0}
if {([isop $hand $chan]) || ([matchattr $hand "|o" $chan]) || ([matchattr $hand "o"])} {
if {![onchan $who $chan]} {
set theban $who
} else {
set host [getchanhost $who $chan]
set host [maskhost $host]
set shost [split $host "!"]
set theban "*!*[lindex $shost 1]"
}
newchanban $chan $theban $nick $reason $time
putcmdlog "<<$nick>> !$hand! ban $args"
} else {
notice $nick "You can't do that!"
}
}
# Unbans a host from the channel
# Usage: !unban <host>
proc pub:unban {nick uhost hand chan args} {
if {(![auth:check $hand]) && (![isop $nick $chan])} {return 0}
set args [split [cleanarg $args]]
if {[llength $args]<1} {
notice $nick "Usage: .unban <host>"
return 0
}
set theban [lindex $args 0]
if {$hand == "*"} {return 0}
if {([isop $hand $chan]) || ([matchattr $hand "|o" $chan]) || ([matchattr $hand "o"])} {
killchanban $chan $theban
putcmdlog "<<$nick>> !$hand! unban $chan $theban"
} else {
notice $nick "You can't do that!"
}
}
# Adds a user
# Usage: !adduser <nick> [host]
# If you leave out 'host', it will take the 'nick', and mask a host.
proc pub:adduser {nick uhost hand chan args} {
if {![auth:check $hand]} {return 0}
set args [split [cleanarg $args]]
global botnick admin
if {[llength $args]<1} {
notice $nick "Usage: .adduser <nick> \[host\]"
return 0
}
if {$nick == $botnick} {return 0}
if {[getting-users]} {
notice $nick "Sorry, there is currently a userfile transfer going on. Try back in a couple of seconds."
return 0
}
set who [lindex $args 0]
if {[llength $args]==2} {
set host [lindex args 1]
} else {
if {![onchan $who $chan]} {
say $chan "$nick: $who is not on this channel."
return 0
}
set host [maskhost [getchanhost $who $chan]]
}
set err [adduser $who $host]
if {$err == 0} {
say $chan "That nick already exists."
return 0
}
putcmdlog "<<$nick>> !$hand! adduser $who $host"
if {![onchan $who $chan]} {return 0}
notice $who "Your account has been added with the hostmask $host."
notice $who "Type /msg $botnick PASS <yourpass> to set your password."
notice $who "To see a list of commands type ".help" in the channel.
notice $who "If you have any problems, please contact $admin"
}
# Gives someone voice in the channel
# Usage: !voice <nick>
proc pub:voice {nick uhost hand chan args} {
if {(![auth:check $hand]) && (![isop $nick $chan])} {return 0}
set args [split [cleanarg $args]]
if {[llength $args]<1} {
notice $nick "Usage: .voice <nick>"
return 0
}
set who [lindex $args 0]
if {$hand == "*"} {return 0}
if {([isop $hand $chan]) || ([matchattr $hand "|o" $chan]) || ([matchattr $hand "o"])} {
putserv "MODE $chan +v $who"
} else {
notice $nick "You can't do that!"
}
putcmdlog "<<$nick>> !$hand! voice $chan $who"
}
# Takes away voice from someone in the channel
# Usage: !devoice <nick>
proc pub:devoice {nick uhost hand chan args} {
if {(![auth:check $hand]) && (![isop $nick $chan])} {return 0}
set args [split [cleanarg $args]]
if {[llength $args]<1} {
notice $nick "Usage: .devoice $nick"
return 0
}
set who [lindex $args 0]
if {$hand == "*"} {return 0}
if {([isop $hand $chan]) || ([matchattr $hand "|o" $chan]) || ([matchattr $hand "o"])} {
putserv "MODE $chan -v $who"
} else {
notice $nick "You can't do that!"
}
putcmdlog "<<$nick>> !$hand! devoice $chan $who"
}
# Trys to link to another bot
# Usage: !link <bot>
proc pub:link {nick uhost hand chan args} {
if {![auth:check $hand]} {return 0}
set args [split [cleanarg $args]]
if {[llength $args]<1} {
notice $nick "Usage: !link <bot>"
return 0
}
if {[getting-users]} {
notice $nick "Sorry, there is currently a userfile transfer going on. Try back in a couple of seconds."
return 0
}
set who [lindex $args 0]
say $chan "$nick: Trying to link to $who..."
set err [link $who]
if {$err == 0} {
say $chan "$nick: An error occured."
}
}
# Unlink from a bot
# Usage: !unlink <bot>
proc pub:unlink {nick uhost hand chan args} {
if {![auth:check $hand]} {return 0}
set args [split [cleanarg $args]]
if {[llength $args]<1} {
notice $nick "Usage: !unlink <bot>"
return 0
}
if {[getting-users]} {
notice $nick "Sorry, there is currently a userfile transfer going on. Try back in a couple of seconds."
return 0
}
set who [lindex $args 0]
say $chan "$nick: Trying to unlink from $who..."
set err [link $who]
if {$err == 0} {say $chan "AAAH! An error occured!"}
if {$err == 1} {say $chan "And... SUCCESS!"}
}
# Pings a person from the bot
# Usage: !ping <nick>
proc pub:ping {nick uhost hand chan args} {
if {![auth:check $hand]} {return 0}
set args [split [cleanarg $args]]
if {[llength $args]<1} {
set who $nick
} else {
set who [lindex $args 0]
}
global pub_pingchan
set time [unixtime]
say $who "\001PING $time\001"
set pub_pingchan $chan
putcmdlog "<<$nick>> !$hand! PING $who : $time"
}
# This is the ping reply function.
proc pub:pingr {nick uhost hand dest keyword args} {
global pub_pingchan
set temp [unixtime]
set time [expr $temp - $args]
putlog "PING reply from $nick: $time seconds"
say $pub_pingchan "PING reply from $nick: $time seconds"
}
# Op someone in the channel
# Usage: !op <nick>
proc pub:op {nick uhost hand chan args} {
if {(![auth:check $hand]) && (![isop $nick $chan])} {return 0}
set args [split [cleanarg $args]]
if {[llength $args] == 0 && ([matchattr $hand n] || [matchattr $hand "|n" $chan] || [matchattr $hand o $chan] || [matchattr $hand "|o" $chan])} {
putserv "MODE $chan +o $nick"
}
if {[llength $args]<1} {
notice $nick "Usage: .op <nick>"
return 0
}
set who [lindex $args 0]
if {$hand == "*"} {return 0}
if {([isop $hand $chan]) || ([matchattr $hand "|o" $chan]) || ([matchattr $hand "o"])} {
putserv "MODE $chan +o $who"
putcmdlog "<<$nick>> !$hand! op $chan $who"
} else {
notice $nick "You can't do that!"
}
}
# Deop someone in the channel
# Usage: !deop <nick>
proc pub:deop {nick uhost hand chan args} {
if {(![auth:check $hand]) && (![isop $nick $chan])} {return 0}
set args [split [cleanarg $args]]
if {[llength $args]<1} {
notice $nick "Usage: .deop <nick>"
return 0
}
set who [lindex $args 0]
if {$hand == "*"} {return 0}
if {([isop $hand $chan]) || ([matchattr $hand "|o" $chan]) || ([matchattr $hand "o"])} {
putserv "MODE $chan -o $who"
putcmdlog "<<$nick>> !$hand! deop $chan $who"
} else {
notice $nick "You can't do that!"
}
}
# Ops you if you have op status on the bot
# Usage: !opme
proc pub:opme {nick uhost hand chan args} {
if {![auth:check $hand]} {return 0}
putserv "MODE $chan +o $nick"
}
# Broadcasts a message to every channel the bot is on
# Usage: !broadcast <message>
# Ex: !broadcast The bot is coming down now!
proc pub:broadcast {nick uhost hand chan args} {
if {![auth:check $hand]} {return 0}
set msg [cleanarg $args]
foreach n [channels] {
say $n $msg
}
}
# Makes the bot join a channel
# Usage: !join <#channel>
proc pub:join {nick uhost hand chan args} {
if {![auth:check $hand]} {return 0}
set args [cleanarg $args]
if {[llength $args]<1} {
notice $nick "Usage: .join <#channel>"
return 0
}
channel add $args {+greet -bitch -autoop -bitch -stopnethack}
}
# Makes the bot part a channel
proc pub:part {nick uhost hand chan args} {
if {![auth:check $hand]} {return 0}
set args [cleanarg $args]
if {[llength $args]<1} {
notice $nick "Usage: .part <#channel>"
return 0
}
channel remove $args
}
# Changes the attr of a user
# Usage: !chattr <nick> <options> [channel]
proc pub:chattr {nick uhost hand chan args} {
if {![auth:check $hand]} {return 0}
set args [split [cleanarg $args]]
if {[llength $args]<2} {
notice $nick "Usage: .chattr <handle> <options> \[channel\]"
return 0
}
if {[getting-users]} {
notice $nick "Sorry, there is currently a userfile transfer going on. Try back in a couple of seconds."
return 0
}
set who [lindex $args 0]
set modes [lindex $args 1]
set channel ""
if {[llength $args]==3} {
set channel [lindex $args 2]
set temp "|"
append temp $modes
set modes $temp
}
if {$channel != ""} {
set rt [chattr $who $modes $channel]
} else {
set rt [chattr $who $modes]
}
putcmdlog "<<$nick>> !$hand! chattr $args"
if {$channel != ""} {
set rt [lindex [split $rt "|"] 1]
say $chan "Modes for $who on $channel are now $rt"
} else {
say $chan "Global modes for $who are now $rt"
}
}
# Deletes a user record
# Usage: !deluser <handle>
proc pub:deluser {nick uhost hand chan args} {
if {![auth:check $hand]} {return 0}
set args [split [cleanarg $args]]
if {[llength $args]<1} {
notice $nick "Usage: .deluser <handle>"
return 0
}
if {[getting-users]} {
notice $nick "Sorry, there is currently a userfile transfer going on. Try back in a couple of seconds."
return 0
}
set who [lindex $args 0]
set err [deluser $who]
if {$err == 0} {
say $chan "Attempt to remove $who failed."
return 0
}
putcmdlog "<<$nick>> !$hand! deluser $who"
}
# Adds a bot
# Usage: !addbot <handle> <address:port>
proc pub:addbot {nick uhost hand chan args} {
if {![auth:check $hand]} {return 0}
set args [split [cleanarg $args]]
if {[llength $args]<2} {
notice $nick "Usage: !addbot <handle> <address:port>"
return 0
}
if {[llength [split [lindex $args 1] ":"]]!=2} {
notice $nick "Usage: !addbot <handle> <address:port>"
return 0
}
if {[getting-users]} {
notice $nick "Sorry, there is currently a userfile transfer going on. Try back in a couple of seconds."
return 0
}
set addr [lindex $args 1]
set who [lindex $args 0]
addbot $who $addr
putcmdlog "<<$nick>> !$hand! addbot $who $addr"
}
# Removes a bot
# Usage: !rmbot <handle>
proc pub:rmbot {nick uhost hand chan args} {
if {![auth:check $hand]} {return 0}
set args [split [cleanarg $args]]
if {[llength $args]<1} {
notice $nick "Usage: !rmbot <handle>"
return 0
}
if {[getting-users]} {
notice $nick "Sorry, there is currently a userfile transfer going on. Try back in a couple of seconds."
return 0
}
set who [lindex $args 0]
deluser $who
putcmdlog "<<$nick>> !$hand! rmbot $who"
}
# Adds hostmask for user
# Usage: !addhost <handle> <host>
proc pub:addhost {nick uhost hand chan args} {
if {![auth:check $hand]} {return 0}
set args [split [cleanarg $args]]
if {[llength $args]<2} {
notice $nick "Usage: .addhost <handle> <host>"
return 0
}
if {[getting-users]} {
notice $nick "Sorry, there is currently a userfile transfer going on. Try back in a couple of seconds."
return 0
}
set who [lindex $args 0]
set host [lindex $args 1]
setuser $who HOSTS $host
putcmdlog "<<$nick>> !$hand! addhost $who $host"
}
# Removes host from user
# Usage: !rmhost <handle> <host>
proc pub:rmhost {nick uhost hand chan args} {
if {![auth:check $hand]} {return 0}
set args [split [cleanarg $args]]
if {[llength $args]<2} {
notice $nick "Usage: .delhost <handle> <host>"
return 0;
}
if {[getting-users]} {
notice $nick "Sorry, there is currently a userfile transfer going on. Try back in a couple of seconds."
return 0
}
set who [lindex $args 0]
set host [lindex $args 1]
delhost $who $host
putcmdlog "<<$nick>> !$hand! delhost $who $host"
}
##### HELP SECTION (QUITE LONG) #####
proc pub:help {nick uhost hand chan args} {
global botnick
set args [split [cleanarg $args]]
if {[llength $args]<1} {
notice $nick "------pubcmds \002/nsrje \002------------------------------------"
notice $nick ".op <nick> - op a user"
notice $nick ".deop <nick> - deop a user "
notice $nick ".ban <nick/host> <time> <reason> - bans a \002nick/host\002"
notice $nick ".unban <host> - unbans \002host\002 from channel"
notice $nick ".voice <nick> - voice a user"
notice $nick ".devoice <nick> - devoice a user"
notice $nick ".opme - ops you if you have access"
notice $nick ".adduser <handle/nick> \[host\] - adds a user"
notice $nick ".deluser <handle> - removes \002handle\002 from user list"
notice $nick ".chattr <handle> <options> \[channel\] - changes attributes for user"
notice $nick ".addhost <handle> <host> - adds a host to a user"
notice $nick ".delhost <handle> <host> - removes a host from a user"
notice $nick ".disable <handle> - disables a handle from these commands"
notice $nick ".enable <handle> - enables a disabled user"
notice $nick ".ignore <nick/host> <time> <reason> - adds a new ignore"
notice $nick ".unignore <host> - removes an ignore"
notice $nick ".banlist - gives you a banlist for global & channel bans"
notice $nick ".ignorelist - gives you a list of ignores"
notice $nick ".flags <handle> - gives you handle's global flags"
notice $nick ".help <command> - gives a detailed explanation of the specified command"
notice $nick "---------------------------------------------------------"
notice $nick "\002NOTE: Before using any of these commands, you must\002"
notice $nick "\002authenticate yourself with the bot by typing:\002"
notice $nick "\002/msg $botnick auth <your password>\002"
#end
} else {
#start another long section
switch [lindex $args 0] {
"ignore" {
notice $nick "\002-----ignore-----\002"
notice $nick "Usage: .ignore <nick/host> <time> <reason>"
notice $nick "Flags Needed: o|m (global op or channel master)"
notice $nick " Creates a new ignore. If nick is on the channel,"
notice $nick " it will get a hostmask from him, otherwise, it will"
notice $nick " get it from the one you specify."
}
"unignore" {
notice $nick "\002-----unignore-----\002"
notice $nick "Usage: .unignore <host>"
notice $nick "Flags Needed: o|m (global op or channel master)"
notice $nick " Removes the ignore matching host."
}
"ignorelist" {
notice $nick "\002-----ignorelist-----\002"
notice $nick "Usage: .ignorelist"
notice $nick "Flags Needed: o|m (global op or channel master)"
notice $nick " Gives you a list of active ignores."
}
"banlist" {
notice $nick "\002-----banlist-----\002"
notice $nick "Usage: .banlist"
notice $nick "Flags Needed: o|o (global op or channel op)"
notice $nick " Gives you a list of bans."
}
"help" {
notice $nick "Shithead...."
}
"op" {
notice $nick "\002-----op-----\002"
notice $nick "Usage: .op <nick>"
notice $nick "Flags Needed: o|o (global op or channel op)"
notice $nick " Ops \002nick\002 on the current channel."
}
"disable" {
notice $nick "\002-----disable-----\002"
notice $nick "Usage: .disable <handle>"
notice $nick "Flags Needed: n (owner)"
notice $nick " Disables \002handle\002 from using all commands."
}
"enable" {
notice $nick "\002-----enable-----\002"
notice $nick "Usage: .enable <handle>"
notice $nick "Flags Needed: n (owner)"
notice $nick " Enables \002handle\002 to use all commands."
notice $nick " NOTE: Only needed if user has been disabled."
}
"deop" {
notice $nick "\002-----deop-----\002"
notice $nick "Usage: .deop <nick>"
notice $nick "Flags Needed: o|o (global op or channel op)"
notice $nick " Deops \002nick\002 on the current channel."
}
"ban" {
notice $nick "\002-----ban-----\002"
notice $nick "Usage: .ban <nick/host> <time> <reason>"
notice $nick "Flags Needed: (global op or channel op)"
notice $nick " If \002nick\002 is on the channel, it will get a"
notice $nick " hostmask and ban that. If not, it will take the"
notice $nick " host and ban that instead. \002time\002 is the amount"
notice $nick " of time in minutes that the ban will last. Putting 0"
notice $nick " in this field means a permanent ban. \002reason\002 is"
notice $nick " the reason why you banned the nick (can be anything)."
}
"unban" {
notice $nick "\002-----unban-----\002"
notice $nick "Usage: .unban <host>"
notice $nick "Flags Needed: (global op or channel op)"
notice $nick " Unbans \002host\002 from the channel. It can contain"
notice $nick " wildcards. Ex: !unban *!*Candy*@*.aol.com"
}
"voice" {
notice $nick "\002-----voice-----\002"
notice $nick "Usage: .voice <nick>"
notice $nick "Flags Needed: (global op or channel op)"
notice $nick " Gives voice to \002nick\002 on current channel."
}
"devoice" {
notice $nick "\002-----devoice-----\002"
notice $nick "Usage: .devoice <nick>"
notice $nick "Flags Needed: (global op or channel op)"
notice $nick " Takes away voice from \002nick\002."
}
"opme" {
notice $nick "\002-----opme-----\002"
notice $nick "Usage: .opme"
notice $nick "Flags Needed: (global op or channel op)"
notice $nick " Gives you op on the channel"
}
"adduser" {
notice $nick "\002-----adduser-----\002"
notice $nick "Usage: .adduser <nick> \[host\]"
notice $nick "Flags Needed: n (owner)"
notice $nick " Adds a user to the userlist with \002nick\002 as their"
notice $nick " handle. If they are on the channel, and no \002host\002"
notice $nick " is specified, it will get a hostmask from the channel."
notice $nick " Otherwise, it will use the host you specify."
}
"chattr" {
notice $nick "\002-----chattr-----\002"
notice $nick "Usage: .chattr <handle> <options> \[channel\]"
notice $nick "Flags Needed: n (owner)"
notice $nick " Changes the flags (\002options\002) of a user (\002handle\002)."
notice $nick " If \002channel\002 is specified, it will change the channel flags for"
notice $nick " the user."
}
"deluser" {
notice $nick "\002-----deluser-----\002"
notice $nick "Usage: .deluser <handle>"
notice $nick "Flags Needed: n (owner)"
notice $nick " Completely removes a user record from the bot."
}
"addhost" {
notice $nick "\002-----addhost-----\002"
notice $nick "Usage: .addhost <handle> <host>"
notice $nick "Flags Needed: m|n (global master or channel owner)"
notice $nick " Adds \002host\002 to user record for \002handle\002."
}
"rmhost" {
notice $nick "\002-----delhost-----\002"
notice $nick "Usage: .rmhost <handle> <host>"
notice $nick "Flags Needed: m|n (global master or channel owner)"
notice $nick " Removes host from \002handle\002."
}
}
}
}
proc pub:helpa {nick uhost hand chan args} {
pub:help $nick $uhost $hand $chan $args
}