##### 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 proc pub:disable {nick host hand chan arg} { if {[llength $arg] < 1} { notice $nick "Usage: .disable " 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 " 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 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 " 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 [: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 proc pub:flags {nick host hand chan arg} { if {[llength $arg]<1} { notice $nick "Usage: .flags " 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 [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> \[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 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