def error(self, message, **args): """Prints errors to console or channel. Overrides default one. args: target: Channel/user to output to. console: Boolean saying if we should output to console or not.""" error_message = Utils.boldCode() + "Error: " + Utils.normalCode() + message if args.has_key("target"): self.sendMessage(args["target"], error_message) if args.has_key("console"): if args["console"]: print self.errorTime(), "<ERROR>", Utils.stripCodes(message) else: print self.errorTime(), "<ERROR>", Utils.stripCodes(message)
def error(self, message, **args): """Prints errors to console or channel. Overrides default one. args: target: Channel/user to output to. console: Boolean saying if we should output to console or not.""" error_message = Utils.boldCode() + "Error: " + Utils.normalCode( ) + message if args.has_key("target"): self.sendMessage(args["target"], error_message) if args.has_key("console"): if args["console"]: print self.errorTime(), "<ERROR>", Utils.stripCodes(message) else: print self.errorTime(), "<ERROR>", Utils.stripCodes(message)
def cardColorCode(self, card): """Returns the appropriate colour code for a card.""" colors = { "r":{"fg":0, "bg":4}, "g":{"fg":0, "bg":3}, "b":{"fg":0, "bg":12}, "y":{"fg":1, "bg":8}, "w":{"fg":0, "bg":1} } if len(card) == 2: if card[0] == "w": color = colors[card[1]] else: color = colors[card[0]] else: color = colors[card[0]] return Utils.colorCode(**color)
def cardColorCode(self, card): # Define card colours. colors = { "r": {"fg": 0, "bg": 4}, "g": {"fg": 0, "bg": 3}, "b": {"fg": 0, "bg": 12}, "y": {"fg": 1, "bg": 8}, "w": {"fg": 0, "bg": 1}, } if len(card) == 2: if card[0] == "w": color = colors[card[1]] else: color = colors[card[0]] else: color = colors[card[0]] # Return colourized string. return Utils.colorCode(**color)
def cardColorCode(self, card): # Define card colours. colors = { "r": { "fg": 0, "bg": 4 }, "g": { "fg": 0, "bg": 3 }, "b": { "fg": 0, "bg": 12 }, "y": { "fg": 1, "bg": 8 }, "w": { "fg": 0, "bg": 1 } } if len(card) == 2: if card[0] == "w": color = colors[card[1]] else: color = colors[card[0]] else: color = colors[card[0]] # Return colourized string. return Utils.colorCode(**color)
def cardString(self, card): return self.cardColorCode(card) + card + Utils.normalCode()
def cardString(self, card): """Returns the card name including colours.""" return self.cardColorCode(card) + card + Utils.normalCode()