This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

topic save and recall

Support & discussion of released scripts, and announcements of new releases.
Post Reply
d
deadite66
Halfop
Posts: 74
Joined: Mon May 30, 2005 2:49 am
Location: Great Yarmouth, UK

topic save and recall

Post by deadite66 »

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: 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
   }}
<- tcl newb
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Would look better if correctly formatted.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
d
deadite66
Halfop
Posts: 74
Joined: Mon May 30, 2005 2:49 am
Location: Great Yarmouth, UK

Post by deadite66 »

quite possibly :)
<- tcl newb
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Alchera was giving you a clear hint, format it properly first.
d
deadite66
Halfop
Posts: 74
Joined: Mon May 30, 2005 2:49 am
Location: Great Yarmouth, UK

Post by deadite66 »

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
Post Reply