use color emoji
This commit is contained in:
parent
bc9c057d57
commit
c5c314a9b1
1 changed files with 14 additions and 1 deletions
15
card.py
15
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 """
|
||||
|
|
Loading…
Reference in a new issue