Difference between revisions of "Ircbot"

From Fixme.ch
Jump to: navigation, search
(Configuration and Installation)
Line 18: Line 18:
  
 
=== Fix RSS ===
 
=== Fix RSS ===
 +
* https://github.com/embolalia/willie/issues/304
 
<pre>
 
<pre>
 
--- /tmp/willie/willie/modules/rss.py  2013-07-20 17:43:43.570496043 +0200
 
--- /tmp/willie/willie/modules/rss.py  2013-07-20 17:43:43.570496043 +0200

Revision as of 03:15, 21 July 2013

Information

Configuration and Installation

  • /home/irc-bot/.willie/default.cfg
  • Started in /etc/rc.local
  • Installation (latest version with better rss module)
cd /tmp; git clone git://github.com/embolalia/willie.git
cd willie; python setup.py install; rm -fr /tmp/willie
pip install feedparser pytz lxml pygeoip praw
apt-get install python-enchant
su -c 'willie -w' irc-bot #configuration
su -c 'willie --fork' irc-bot #run in background

Fix RSS

--- /tmp/willie/willie/modules/rss.py   2013-07-20 17:43:43.570496043 +0200
+++ /usr/local/lib/python2.7/dist-packages/willie/modules/rss.py        2013-07-20 19:54:21.564482921 +0200
@@ -11,6 +11,7 @@
 import time
 import re
 import socket
+import base64, hashlib
 
 import feedparser
 
@@ -355,10 +356,11 @@
         bot.msg(feed_channel, message)
         
         # save into recent
+        etag = base64.b64encode(hashlib.md5(entry.link).digest())
         c.execute('''
             UPDATE rss_feeds SET article_title = %s, article_url = %s, published = %s, etag = %s
             WHERE channel = %s AND feed_name = %s
-            ''' % (SUB * 6), (entry.title, entry.link, entry_dt, fp.etag, feed_channel, feed_name))
+            ''' % (SUB * 6), (entry.title, entry.link, entry_dt, etag, feed_channel, feed_name))
         conn.commit()
 
     c.close()

Plugins

RSS

.rss add #channel name http://example.com/rss
.rss del name
.rss list
.startrss