Created
June 14, 2016 13:42
-
-
Save reportingsjr/4bbc404cf804c7a8be42f6213f1e0fd4 to your computer and use it in GitHub Desktop.
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
SodaTemp plugin | |
import supybot.utils as utils | |
from supybot.commands import * | |
import supybot.plugins as plugins | |
import supybot.ircutils as ircutils | |
import supybot.callbacks as callbacks | |
import feedparser | |
try: | |
from supybot.i18n import PluginInternationalization | |
_ = PluginInternationalization('SodaTemp') | |
except ImportError: | |
# Placeholder that allows to run the plugin on a bot | |
# without the i18n module | |
_ = lambda x: x | |
class SodaTemp(callbacks.Plugin): | |
"""Replies to the channel with the current temperature of the hive soda machine.""" | |
def __init__(self, irc): | |
self.__parent = super(SodaTemp, self) | |
self.__parent.__init__(irc) | |
self.rssURL = "http://portal.hive13.org/isOpen/RSS.php?sodatemp=0" | |
def sodatemp(self, irc, msg, args): | |
"""Takes no arguments | |
Returns current temperature in the space | |
""" | |
feed = feedparser.parse(self.rssURL) | |
irc.reply("The temperature is: " + str(feed.entries[0].title)) | |
Class = SodaTemp | |
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: | |
Temp plugin | |
import supybot.utils as utils | |
from supybot.commands import * | |
import supybot.plugins as plugins | |
import supybot.ircutils as ircutils | |
import supybot.callbacks as callbacks | |
import feedparser | |
try: | |
from supybot.i18n import PluginInternationalization | |
_ = PluginInternationalization('Temp') | |
except ImportError: | |
# Placeholder that allows to run the plugin on a bot | |
# without the i18n module | |
_ = lambda x: x | |
class Temp(callbacks.Plugin): | |
"""Replies to the channel with the current temperature at Hive13.""" | |
pass | |
def __init__(self, irc): | |
self.__parent = super(Temp, self) | |
self.__parent.__init__(irc) | |
self.rssURL = "http://portal.hive13.org/isOpen/RSS.php?temp=0" | |
def temp(self, irc, msg, args): | |
"""Takes no arguments | |
Returns current temperature in the space | |
""" | |
feed = feedparser.parse(self.rssURL) | |
irc.reply("The temperature is: " + str(feed.entries[0].title)) | |
Class = Temp | |
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment