| View previous topic :: View next topic |
| Author |
Message |
deadite66 Halfop
Joined: 30 May 2005 Posts: 74 Location: Great Yarmouth, UK
|
Posted: Tue Aug 29, 2006 3:58 pm Post subject: topic save and recall |
|
|
wrote this a while ago thought someone may get some use out of it.
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: | # 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
}} |
_________________ <- tcl newb |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Tue Aug 29, 2006 6:54 pm Post subject: |
|
|
Would look better if correctly formatted. _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
deadite66 Halfop
Joined: 30 May 2005 Posts: 74 Location: Great Yarmouth, UK
|
Posted: Tue Aug 29, 2006 11:54 pm Post subject: |
|
|
quite possibly  _________________ <- tcl newb |
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Wed Aug 30, 2006 6:06 am Post subject: |
|
|
| Alchera was giving you a clear hint, format it properly first. |
|
| Back to top |
|
 |
deadite66 Halfop
Joined: 30 May 2005 Posts: 74 Location: Great Yarmouth, UK
|
Posted: Wed Aug 30, 2006 9:28 am Post subject: |
|
|
it works for the me and channels it runs on if your not happy with it then feel free to bin this thread, i only posted it incase someone else might make us of it. _________________ <- tcl newb |
|
| Back to top |
|
 |
|