From c5c314a9b10df6aa286cec0c32aca2065cae6673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannes=20H=C3=B6ke?= Date: Tue, 19 Apr 2016 00:41:23 +0200 Subject: [PATCH] use color emoji --- card.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/card.py b/card.py index 7eb0554..cf127c5 100644 --- a/card.py +++ b/card.py @@ -1,3 +1,4 @@ +from telegram.emoji import Emoji # Colors RED = 'r' @@ -7,6 +8,13 @@ YELLOW = 'y' COLORS = (RED, BLUE, GREEN, YELLOW) +COLOR_ICONS = { + RED: Emoji.HEAVY_BLACK_HEART, + BLUE: Emoji.BLUE_HEART, + GREEN: Emoji.GREEN_HEART, + YELLOW: Emoji.YELLOW_HEART, +} + # Values ZERO = '0' ONE = '1' @@ -54,7 +62,12 @@ class Card(object): return '%s_%s' % (self.color, self.value) def __repr__(self): - return ' '.join([s.capitalize() for s in str(self).split('_')]) + if self.special: + return '%s%s' % (Emoji.BROKEN_HEART, + ' '.join([s.capitalize() + for s in self.special.split('_')])) + else: + return '%s%s' % (COLOR_ICONS[self.color], self.value.capitalize()) def __eq__(self, other): """ Needed for sorting the cards """