Code: Select all
#############################################################
## ##
## Words of Wisdom v2.01 TCL (WoW) ##
## Display funny nonsense to your irc friends/channel ##
## by Phil (Admin) ##
## Penthux.net - June 2005 ##
## ##
## This script is not meant to do anything except make you ##
## smile. The text file can contain any plain text, ##
## whether it be jokes, channel adverts or whatever. When ##
## adding your own content just make sure you put each ##
## item on a seperate line in the text file. There is no ##
## limit to how large or small the text file must be. ##
## ##
## Usage: ##
## [channel commands] ##
## !wow = displays a WoW line to channel ##
## !wow [nick|chan] = displays WoW line to nick or chan ##
## ##
## ** NB - only ops, halfops and voices in the named ##
## #channel can use the !wow [nick|chan] command which can ##
## be sent to any nickname or channel on the network which ##
## allows external messages. All other users get the WoW ##
## line back in their own query window. Change the code if ##
## you like as this setup primarily stops lamer flooding ##
## to nicks/chans. ##
## ##
## Installation: ##
## 1. Set the irc #channel to display the WoW lines ##
## automatically and the timer intervals between output. ##
## Edit your eggdrop filename.conf and add this line to ##
## the end of the file: ##
## ##
## source scripts/wow.tcl ##
## ##
## 2. Copy the edited filename.conf file to your eggdrop ##
## dir and copy both the wow.tcl & wow.txt files to the ##
## SCRIPTS directory. Now reboot/restart your eggdrop bot. ##
## ##
## Please keep this header intact if you distribute or ##
## modify this CGI script. admin@penthux.net ##
#############################################################
## set the channel to display automatic WoW lines, include the '#' prefix
set wowchan "#your_channel"
## set the timer interval (in minutes) between WoW lines
set wowtime "30"
#######################################################
### don't change anything below if u don't know TCL ###
#######################################################
if { [info exists wowtime] } { timer $wowtime "timer:wow" }
set wowtxt "scripts/wow.txt"
set wowver "v2.01"
bind pub - !wow disp:wow
proc disp:wow {nick host handle chan text} {
global wowchan wowtxt
if { [isop $nick $wowchan] || [ishalfop $nick $wowchan] || [isvoice $nick $wowchan] } {
if { [lindex $text 0] != "" } {
set wowto [lindex $text 0]
} else {
set wowto $wowchan
}
set wowfile [open $wowtxt r]
set wowread [split [read $wowfile] \n]
close $wowfile
putserv "PRIVMSG $wowto :[lindex $wowread [rand [llength $wowread]]] "
} else {
set wowfile [open $wowtxt r]
set wowread [split [read $wowfile] \n]
close $wowfile
putserv "PRIVMSG $nick :[lindex $wowread [rand [llength $wowread]]] "
}
}
proc timer:wow {} {
global botnick wowchan wowtime wowtxt
if { [onchan $botnick $wowchan] } {
set wowfile [open $wowtxt r]
set wowread [split [read $wowfile] \n]
close $wowfile
putserv "PRIVMSG $wowchan :[lindex $wowread [rand [llength $wowread]]] "
timer $wowtime "timer:wow"
}
}
putlog "Words of Wisdom $wowver TCL (timer: $wowtime mins) - Loaded! "
#
#