Add haikunator

This commit is contained in:
Lucas Verney 2016-06-23 14:35:31 +02:00
parent 38d0c1fbc3
commit 3a398a8416
2 changed files with 7 additions and 3 deletions

View File

@ -12,6 +12,8 @@ import irc.connection
import config import config
from haikunator import Haikunator
class Ampache2IRC(irc.bot.SingleServerIRCBot): class Ampache2IRC(irc.bot.SingleServerIRCBot):
""" """
@ -39,11 +41,12 @@ class Ampache2IRC(irc.bot.SingleServerIRCBot):
for entry in d.entries: for entry in d.entries:
if(self.last_seen is None or if(self.last_seen is None or
entry.published_parsed > self.last_seen): entry.published_parsed > self.last_seen):
haikunator = Haikunator(entry.comments
.replace(config.ampache_URL, "")
.strip("/"))
serv.privmsg(config.channel, serv.privmsg(config.channel,
"%s (%s)" % (entry.title, "%s (%s)" % (entry.title,
(entry.comments haikunator.haikunate(token_length=0)))
.replace(config.ampache_URL, "")
.strip("/"))))
self.last_seen = entry.published_parsed self.last_seen = entry.published_parsed
def on_welcome(self, serv, ev): def on_welcome(self, serv, ev):

View File

@ -1,2 +1,3 @@
feedparser==5.2.1 feedparser==5.2.1
irc==14.2.2 irc==14.2.2
haikunator