Skip to content

Supybot Website

Sections
Personal tools
You are here: Home » Supybot Discussion Forums » User Forum » Modifying Topic plugin

 • Modifying Topic plugin

Document Actions
Replies: 0   Views: 1008
Up one level
You need to be a registered member to post to this forum. Register now.

 • Modifying Topic plugin

Posted by Friczy at 07:33 March 24, 2008
Hello,

I have a bot which puts part of the topic from an RSS feed. The simplest way of it is to use
Scheduler repeat topicchange <seconds> "topic replace <#channel> 2

It works almost perfectly but the problem is that te bot changes the topic every n seconds even if the content of the topic remains unchanged.

So to solve this problem I modified the Topic plugin this way:
code:
--- /home/friczyne/backup/supybot/plugins/Topic/plugin.py       2006-07-24 01:29:58.000000000 +0200
+++ plugin.py   2008-03-24 11:48:26.000000000 +0100
@@ -213,8 +213,9 @@
         Replaces topic <number> with <topic>.
         """
         topics = self._splitTopic(irc.state.getTopic(channel), channel)
-        topics= topic
- self._sendTopics(irc, channel, topics)
+ if topics!= topic:
+ topics= topic
+ self._sendTopics(irc, channel, topics)
replace = wrap(replace,['canChangeTopic', 'topicNumber', rest('topic')])

def insert(self, irc, msg, args, channel, topic):

With this modification the Topic replace command changes the topic only when the content differs from the current.

If you find it useful I would be glad if you modify the original source too.

Regards,

Friczy
Member
Posts: 1
This topic contains no replies

 

Powered by Plone

This site conforms to the following standards: