Skip to content

Commit

Permalink
handle newsurl for pages (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
RouxRC committed Apr 30, 2017
1 parent 87b3553 commit 35131b4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions gazouilleur/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1248,12 +1248,11 @@ def command_list(self, database, channel=None, *args):

@inlineCallbacks
def command_newsurl(self, name, channel=None, *args):
"""newsurl <name> : Displays the url of a RSS feed saved as <name> for current channel."""
# TODO Handle urls for monitor
"""newsurl <name> : Displays the url of a RSS feed or a monitored page saved as <name> 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
Expand Down

0 comments on commit 35131b4

Please sign in to comment.