From 35131b4740ac719436a9afe30356ca1eda656a87 Mon Sep 17 00:00:00 2001 From: RouxRC Date: Sun, 30 Apr 2017 17:22:35 +0200 Subject: [PATCH] handle newsurl for pages (#18) --- gazouilleur/bot.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gazouilleur/bot.py b/gazouilleur/bot.py index f7cd8a3..baac82e 100644 --- a/gazouilleur/bot.py +++ b/gazouilleur/bot.py @@ -1248,12 +1248,11 @@ def command_list(self, database, channel=None, *args): @inlineCallbacks def command_newsurl(self, name, channel=None, *args): - """newsurl : Displays the url of a RSS feed saved as for current channel.""" - # TODO Handle urls for monitor + """newsurl : Displays the url of a RSS feed or a monitored page saved as for current channel.""" channel = self.getMasterChan(channel) - res = yield self.db['feeds'].find({'database': 'news', 'channel': channel, 'name': name.lower().strip()}, fields=['query', 'name'], limit=1) + res = yield self.db['feeds'].find({'database': {"$in": ['news', 'pages']}, 'channel': channel, 'name': name.lower().strip()}, fields=['query', 'name', 'database']) if res: - returnD("«%s» : %s" % (res[0]['name'].encode('utf-8'), res[0]['query'].encode('utf-8'))) + returnD(u"\n".join([u"«%s» (%s) : %s" % (r['name'], r['database'], r['query']) for r in res]).encode('utf-8')) returnD("No news feed named «%s» for this channel" % name) @inlineCallbacks