#--------------------------------------------------------------------- # undernetmodex.tcl # Tcl script for IRC bot eggdrop # # This script logs the bot into the X service on undernet and sets # usermode +x. # The bot will be visible with the uhost username.users.undernet.org # # v0: 16-Oct-2002 # v1: 16-Oct-2002 # + send out a "WHOIS botnick" to update the botname. #--------------------------------------------------------------------- # set these variables in the main config file just before sourcing # this tcl. # Do not set these variables in this script. # set undernetusername hello # set undernetpassword world package require eggdrop 1.6 package require Tcl 8.0 bind EVNT - init-server undernetmodex:init bind TIME - * undernetmodex:time proc undernetmodex:init { args } { # login undernetmodex:login } proc undernetmodex:time { args } { # check every 15 minutes set secs [clock seconds] set mins [expr round($secs/60.0)] if {[expr $mins % 15]} { return 0 } # login undernetmodex:login } proc undernetmodex:login { args } { global botname global botnick global undernetusername global undernetpassword # check current botname set currenthost [lindex [split $botname "@"] 1] append desiredhost $undernetusername ".users.undernet.org" if { $currenthost == $desiredhost } { return 0 } # username and password exist? if {![info exists undernetusername]} { putlog "Login to X failed: Undernet username does not exist." return 0 } if {![info exists undernetpassword]} { putlog "Login to X failed: Undernet password does not exist." return 0 } # login and mode +x set X {X@channels.undernet.org} putserv "PRIVMSG $X :LOGIN $undernetusername $undernetpassword" putserv "MODE $botnick +x" # It seems that "botname" is not updated after connecting to # the server. Subsequently, if the login procedure failed upon # connecting to the server, comparing the botname with the # desired name will always fail and the bot will continue to # attempt to login to X and change mode +x. # Workaround: send out a WHOIS and let the bot process the result. puthelp "WHOIS $botnick" } putlog "UndernetModeX version 1 loaded."