diff options
author | timm <timm@timm-700Z3C-700Z5C.(none)> | 2013-02-08 17:24:11 +0100 |
---|---|---|
committer | timm <timm@timm-700Z3C-700Z5C.(none)> | 2013-02-08 17:24:11 +0100 |
commit | 6228db160f3c2d710c87938c4ef2c5b819da764d (patch) | |
tree | ee1a5171401ff9b739f1ca3b0f8c82fce5322833 /ircbot/bot.py | |
parent | 4107615bf00330f9645e8e4d97faa903a936e76b (diff) | |
parent | d7ff9d79f3a7a589e92dd4eec835953af5fea21f (diff) |
Merge branch 'master' of https://github.com/krebscode/painload
Diffstat (limited to 'ircbot/bot.py')
-rwxr-xr-x | ircbot/bot.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/ircbot/bot.py b/ircbot/bot.py index 607e65c7..25a1014f 100755 --- a/ircbot/bot.py +++ b/ircbot/bot.py @@ -18,7 +18,11 @@ class TestBot(irc.bot.SingleServerIRCBot): self.oldnews = [] self.sendqueue = [] for entry in self.feed.entries: - self.sendqueue.append(entry.title + " " + entry.link) + try: + self.sendqueue.append(entry.title + " " + entry.link + " com: " + entry.comments) + except AttributeError: + self.sendqueue.append(entry.title + " " + entry.link) + self.oldnews.append(entry.link) def start(self): @@ -32,7 +36,10 @@ class TestBot(irc.bot.SingleServerIRCBot): self.feed = feedparser.parse(self.url) for entry in self.feed.entries: if not entry.link in self.oldnews: - self.send(entry.title + " " + entry.link) + try: + self.send(entry.title + " " + entry.link + " com: " + entry.comments) + except AttributeError: + self.send(entry.title + " " + entry.link) self.oldnews.append(entry.link) def sendall(self): @@ -44,8 +51,11 @@ class TestBot(irc.bot.SingleServerIRCBot): if len(string) < 450: self.connection.privmsg(self.chan, string) else: - for x in range(math.ceil(len(string)/450)): - self.connection.privmsg(self.chan, string[x*450:(x+1)*450]) + space = 0 + for x in range(math.ceil(len(string)/400)): + oldspace = space + space = string.find(" ", (x+1)*400, (x+1)*400+50) + self.connection.privmsg(self.chan, string[oldspace:space]) sleep(1) |