Difference between revisions of "Ircbot"

From Fixme.ch
Jump to: navigation, search
(Configuration and Installation)
 
(3 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
* FIXMYBOT on Freenode in #fixme and #fixme-ctf
 
* FIXMYBOT on Freenode in #fixme and #fixme-ctf
 
* We're using [https://github.com/embolalia/willie Willie]
 
* We're using [https://github.com/embolalia/willie Willie]
 +
** extras modules https://github.com/embolalia/willie-extras
 
* https://github.com/embolalia/willie/wiki/Commands
 
* https://github.com/embolalia/willie/wiki/Commands
  
 
== Configuration and Installation ==
 
== Configuration and Installation ==
 
* /home/irc-bot/.willie/default.cfg
 
* /home/irc-bot/.willie/default.cfg
* Started in /etc/rc.local
+
* Started in <s>/etc/rc.local</s> /etc/inittab
 
* Installation (latest version with better rss module)
 
* Installation (latest version with better rss module)
 
  cd /tmp; git clone git://github.com/embolalia/willie.git
 
  cd /tmp; git clone git://github.com/embolalia/willie.git
 
  cd willie; python setup.py install; rm -fr /tmp/willie
 
  cd willie; python setup.py install; rm -fr /tmp/willie
  pip install feedparser pytz lxml pygeoip praw
+
  pip install feedparser pytz lxml pygeoip praw tweepy
  apt-get install python-enchant
+
  apt-get install python-enchant python-mysqldb
  
 
  su -c 'willie -w' irc-bot #configuration
 
  su -c 'willie -w' irc-bot #configuration
 
  su -c 'willie --fork' irc-bot #run in background
 
  su -c 'willie --fork' irc-bot #run in background
 
=== Fix RSS ===
 
* https://github.com/embolalia/willie/issues/304
 
<pre>
 
--- /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()
 
</pre>
 
  
 
== Plugins ==
 
== Plugins ==
Line 51: Line 24:
 
  .rss list
 
  .rss list
  
  .startrss
+
  .startrss -i 120 #interval in seconds

Latest revision as of 13:48, 28 August 2014

Information

Configuration and Installation

  • /home/irc-bot/.willie/default.cfg
  • Started in /etc/rc.local /etc/inittab
  • 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 tweepy
apt-get install python-enchant python-mysqldb
su -c 'willie -w' irc-bot #configuration
su -c 'willie --fork' irc-bot #run in background

Plugins

RSS

.rss add #channel name http://example.com/rss
.rss del name
.rss list
.startrss -i 120 #interval in seconds