egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

topic save and recall

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
deadite66
Halfop


Joined: 30 May 2005
Posts: 74
Location: Great Yarmouth, UK

PostPosted: Tue Aug 29, 2006 3:58 pm    Post subject: topic save and recall Reply with quote

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
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Tue Aug 29, 2006 6:54 pm    Post subject: Reply with quote

Would look better if correctly formatted.
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
deadite66
Halfop


Joined: 30 May 2005
Posts: 74
Location: Great Yarmouth, UK

PostPosted: Tue Aug 29, 2006 11:54 pm    Post subject: Reply with quote

quite possibly Smile
_________________
<- tcl newb
Back to top
View user's profile Send private message
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Wed Aug 30, 2006 6:06 am    Post subject: Reply with quote

Alchera was giving you a clear hint, format it properly first.
Back to top
View user's profile Send private message
deadite66
Halfop


Joined: 30 May 2005
Posts: 74
Location: Great Yarmouth, UK

PostPosted: Wed Aug 30, 2006 9:28 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber