Skip to content

Commit

Permalink
Merge pull request snoonetIRC#206 from typoguy/gonzobot
Browse files Browse the repository at this point in the history
Create deals.py -- a plugin for listing shopping deals
  • Loading branch information
edwardslabs authored Nov 14, 2017
2 parents 4dc0e80 + 979aa00 commit ca08326
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions plugins/deals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from cloudbot import hook
from cloudbot.util import web
import feedparser


@hook.command('meh', autohelp=False)
def meh():
"""- List the current meh.com deal."""
url = "https://meh.com/deals.rss"

feed = feedparser.parse(url)
title = feed.entries[0].title
link = web.try_shorten(feed.entries[0].link)

return "meh.com: {} ({})".format(title, link)


@hook.command('slickdeals', autohelp=False)
def slickdeals():
"""- List the top 3 frontpage slickdeals.net deals."""
url = "https://slickdeals.net/newsearch.php?mode=frontpage&searcharea=deals&searchin=first&rss=1"

feed = feedparser.parse(url)
items = (
"{} ({})".format(item.title, web.try_shorten(item.link))
for item in feed.entries[:3]
)

out = "slickdeals.net: " + ' \u2022 '.join(items)

return out

0 comments on commit ca08326

Please sign in to comment.