def steam(self, irc, msg, args): """takes no or one argument(s) <service key> Returns steams status fetched from steamstat.us """ if len(args): return self.steamservice(irc, msg, args) try: status = self.fetch() except Exception as e: irc.error(e, True) response = "Steamstatus: " if len(self.services) < 1: irc.error("No services defined.", True) for (name, key) in sorted(self.services.items()): try: service = status["services"][key] # name, key, status, health, time=None response += str(create_service(key, name, service)) + ", " except KeyError: irc.error("Status of service " + name + " (" + key + ") is (temporarily) not available.") irc.reply(response[:-2])
def steamservice(self, irc, msg, args): """takes no or one argument(s) <service key> Returns status of specified steam service fetched from steamstat.us """ status = self.fetch() if not len(args): return self.steam(irc, msg, args) else: key = args[0] try: service = status["services"][key] irc.reply("Status of service " + str(create_service(key, key, service))) except KeyError: irc.error("Status of service " + key + " is (temporarily) not available.")