forked from snoonetIRC/CloudBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request snoonetIRC#206 from typoguy/gonzobot
Create deals.py -- a plugin for listing shopping deals
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |