1. it will save every topic the bot is in regardless of it's op status.
2. the topic files are stored in the eggdrop folder you may want to change that.
commands
!topic will restore the last topic changed, everyone has access to this.
!topicsave and !topicload will save or restore a topic ops only, only 1 topic though.
Code: Select all
# save the topic
bind topc - * topic:savetopic
proc topic:savetopic {nick host hand chan topic} {
if {[topic $chan] == "" } { # ignore empty topic
} else {
set TOTF "./TOTopicfile$chan"
set TOfile [open $TOTF "w"]
fconfigure $TOfile -encoding binary
set topicline [topic $chan]
puts $TOfile [topic $chan]
close $TOfile
}
}
# allow someone to reset the topic
bind pub - !topic topic:reset
proc topic:reset {nick host handle chan topic} {
if {[botisop $chan]} {
set TOTF "./TOTopicfile$chan"
set TOfile [open $TOTF "r"]
fconfigure $TOfile -encoding binary
set oldtopic [read -nonewline $TOfile]
putserv "TOPIC $chan :Resyncing topic.."
putserv "TOPIC $chan :$oldtopic"
close $TOfile
}}
# save the topic for later return, op only
bind pub - !topicsave topic:storeoldtopic
proc topic:storeoldtopic {nick host hand chan topic} {
if {[isop $nick $chan] && [botisop $chan]} {
set TOTF "./TOTopicfilesaved$chan"
set TOfile [open $TOTF "w"]
fconfigure $TOfile -encoding binary
set topicline [topic $chan]
puts $TOfile [topic $chan]
close $TOfile
puthelp "PRIVMSG $chan :topic saved."
}}
# allow an admin to reset the stored topic
bind pub - !topicload topic:recalloldtopic
proc topic:recalloldtopic {nick host handle chan topic} {
if {[isop $nick $chan] && [botisop $chan]} {
set TOTF "./TOTopicfilesaved$chan"
set TOfile [open $TOTF "r"]
fconfigure $TOfile -encoding binary
set oldtopic [read -nonewline $TOfile]
putserv "TOPIC $chan :Recalling Stored Topic.."
putserv "TOPIC $chan :$oldtopic"
close $TOfile
}}