Try not to miss previously posted feeds.
authorCMDR furrycat <elite@furrycat.net>
Wed, 26 Oct 2016 12:54:08 +0000 (13:54 +0100)
committerCMDR furrycat <elite@furrycat.net>
Wed, 26 Oct 2016 12:56:41 +0000 (13:56 +0100)
app.py
plugins/feeds.py

diff --git a/app.py b/app.py
index 5cce8c3..aff5ea7 100644 (file)
--- a/app.py
+++ b/app.py
@@ -1472,7 +1472,7 @@ def builtin_commands(message, command, raw):
           lines.append(name)
       yield from bot.say_many(message.channel, lines)
     else:
-      yield from bot.say(message.channel, 'shrugs')
+      yield from bot.say(message.channel, '*shrugs*')
     return True
   return False
 
index a0441a6..7f80eed 100644 (file)
@@ -87,6 +87,7 @@ class Feeds(DBConnection):
     if not channel:
       log.warning("Can't get channel {} for feed.".format(channel_id))
       return
+    log.debug('{} feeds to get for {}.'.format(len(feeds), channel.name))
 
     all_entries = []
     now = time.time()
@@ -104,9 +105,12 @@ class Feeds(DBConnection):
           order = now
           now += 0.001
         all_entries.append({ 'order': order, 'date': date, 'summary': summary, 'url': feed['url'], 'link_json': feed['link_json'], 'entry': entry })
+    if not len(all_entries):
+      log.debug('No messages to post to {}'.format(channel.name))
+      return
     all_entries.sort(key = lambda entry: entry['order'])
 
-    limit = len(all_entries)
+    limit = len(all_entries) * 2
     if not limit:
       limit = bot.get('message_limit')