### AutoOper TCL for Eggdrop IRC Bots (written for 1.6, should work on > 1.3)
###
### by magick777 <keith@dunnett.org> 13/12/2001
#################################################################################
#
# This script permits your Eggdrop bot to OPER automatically on any
# server for which it has an O:line. This makes it possible to monitor
# and react to server notices, or for the bot to act as an IRC Operator.
#
# The script will support multiple O:lines on multiple servers, and will
# not attempt to oper on servers for which it does not have an O:line configured.
# It will also set the desired combination of usermodes once it has successfully
# become an IRC Operator.
#
# If you are not a Server Admin or Network Admin, stop reading now and put
# this script in the circular file. No Admin worth his salt will grant your bot
# an O:line, and IRC Operators sharing their O:line with a bot are likely to get
# themselves in hot water - at least on most networks. You have been warned.
#
# WARNING: This is inherently a dangerous, and potentially stupid thing
# to do. The bot will do as its users tell it; letting users have access to
# oper functions is dangerous.
#
# You should not use this script on bots where many people have access.
# The bot should _NOT_ share an O:line with a user, but have its own O:line
# with a tightly restricted set of necessary flags. If you cannot implement
# this safely, do not use it.
#
#################################################################################
###
### Configuration Section - you need to edit this, or nothing will work
###
# O:lines
#
# Define here the server(s) on which the bot may oper
# Each record must be a valid TCL list, syntax:
#
# {irc.server.net handle password}
#
# For example:
#
# set olines {
# {irc.mynetwork.org lamebot somepassword}
# {athena.mynetwork.org lamebot somepassword}
# }
set olines {
{irc.myserver.net bothandle operpass}
}
# Modes on Oper
#
# Define here the combination of usermodes you wish to set on successful OPER.
# This will be both server and application dependent.
#
# For example:
#
# set oper_mode "+wgs +cF"
#
# on an Unreal server would receive both local and remote connect notices.
# This can and should be adapted to suit.
set oper_mode "-h+wgs"
# Sanity Check
#
# Comment out this line when you have configured this script, or your bot won't run
die "You _MUST_ configure scripts before you use them. Edit autooper.tcl and try again."
#####################################################################################
# STOP # STOP # STOP # STOP # STOP # STOP # STOP # STOP # STOP # STOP # STOP # STOP #
# End of Configuration Section - you _should_ not need to edit below here. #
#####################################################################################
###
### Bindings
###
bind raw - 005 auto_oper
bind raw - 381 perform_on_oper
###
### Processes
###
proc auto_oper {from key args} {
putlog "(auto-oper) Connected to $from, checking for O:line..."
global olines
foreach line $olines {
set serv [lindex $line 0]
set handle [lindex $line 1]
set opass [lindex $line 2]
if {$serv == $from} {
putlog "(auto-oper) Have O:line data for $from, attempting to OPER"
putquick "OPER $handle $opass" -next
return 0
}
}
putlog "(auto-oper) No O:line configured for $from, doing nothing..."
return 0
}
proc perform_on_oper {from key args} {
global oper_mode botnick
putquick "MODE $botnick $oper_mode" -next
putlog "(auto-oper) OPERed OK on $from, setting usermodes $oper_mode"
#add anything else the bot is to perform when it gets opered in here...
return 0
}
putlog "(auto-oper) AutoOper TCL v1.0 by magick777 <keith@dunnett.org> Loaded."
###
### End of Script
###