| Current Path : /home/mudbot/eggdrop-keep/scripts/ |
| Current File : //home/mudbot/eggdrop-keep/scripts/topic1.5.tcl |
## Revised/Modified by iamdeath @ Undernet
## To contact me: Find me on http://forum.egghelp.org or #Cricket @ Undernet
## Originaly written by Shodane (shodie@eisbong.com)
## New version: topic1.5.tcl
############################################################################################################
## THE REASON OF MODIFICATION:
## On undernet, there are always netsplit usually So we lose our channel topics and it's empty on
## many servers, I tried all the scripts from archive none of them did the job I wanted.
## What I wanted is, a tcl which could save the current topic and refresh it after every x hour, so I tried
## keeptopic by Firegle but that had bugs and I didn't like it. So I checked this TCL and tried to modified.
############################################################################################################
## NOW WHAT DOES IT DO?
## This script will remember your current channel topic and refresh it after every 2 hours.
############################################################################################################
## WHAT CHANGES DID I DO?
## 1. It was working for all the channels, I changed it to work for only 1 channel.
## 2. I added, refresh option, after every 2 hours the bot will refresh the topic.
## 3. Removed !topic command which was not needed.
############################################################################################################
## THE ORIGINAL TEXT BELOW FROM OWNER OF THIS SCRIPT.
## topic1.4.tcl by Shodane (shodie@eisbong.com)
## my first script ever ;)
## help provided by |vincent|
## updated to work with 1.4.*
############################################################################################################
## CREDITS
## Ofcourse the original owner of this script for writing this greate tcl.
## Thanks to the people from egghelp, rosc, nml, sirfz, and specially 'user' for telling me about scan.
############################################################################################################
## To make it work, you must MUST create ./misc directory first and change the topic atleast once first time
## then the bot will start saving the topics of your channel.
############################################################################################################
## Set your channel here, this supports only one channel.
set thechan1 "minecity"
## Set your desired directory, I recommend you to leave it like this.
set dir "./misc"
## This will be the filename where it will store the topic data
set tp "topic"
########################################################
## DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOU'RE DOING##
########################################################
## BINDS
bind topc - * save_topic
proc save_topic {tpnick uhost hand channel topic} {
global dir tp
if {[string tolower $channel] != [string tolower $::thechan1] } { return }
if {$tpnick == "*"} {
set bla [open $dir/${tp} r]
gets $bla x
close $bla
if {$topic == $x} {} {
set bla [open $dir/${tp} w]
puts $bla "$topic"
close $bla
}
} {
set bla [open $dir/${tp} w]
puts $bla $topic
close $bla
}
return 1
}
bind time - "00 *" two:hour
proc two:hour {m h args} {
global dir tp
if {([scan $h %d]%2)==0} {
if {[file exists $dir/${tp}]} {
set bla [open $dir/${tp} r]
gets $bla mess
close $bla
putserv "TOPIC $::thechan1 :Resynching ..."
putserv "TOPIC $::thechan1 :$mess"
}
}
}
putlog "Topic by Shodane modified by iamdeath."