diff --git a/cardcast_api.py b/cardcast_api.py index b96e6d0..ea101fe 100644 --- a/cardcast_api.py +++ b/cardcast_api.py @@ -8,8 +8,8 @@ default_timeout = 10 class CodeValidationError(Exception): pass def check_code(code): - if not code.isalnum(): - raise CodeValidationError('Code %s contains disallowed characters (0-9 A-Z a-z are allowed)' % code) + if not all(i.isalnum() or i == '-' for i in code): + raise CodeValidationError('Code %s contains disallowed characters (0-9 A-Z a-z - are allowed)' % code) def request(base_url, additional, timeout): if base_url is None: diff --git a/gameloop.py b/gameloop.py index f4c9f44..d8287c6 100644 --- a/gameloop.py +++ b/gameloop.py @@ -26,8 +26,8 @@ Card = namedtuple('Card', ['deck', 'text']) Namespace = namedtuple('Namespace', ['url', 'supports_random']) deck_namespaces = { - 'cardcast': Namespace(None, True), # Use the library's default URL - 'bslsk05': Namespace('https://dl.puckipedia.com/', False) + 'bslsk05': Namespace('https://dl.puckipedia.com/', False), + 'ahti': Namespace('https://ahti.space/cards/', True) } @@ -429,24 +429,24 @@ def game(send, notice, voice, devoice, get_event): def start_game(rest): if len(rest) == 0 or rest[0] == 'default': - send('Adding the default CAH deck (cardcast A5DCM)') + send('Adding the default CAH deck (ahti Base)') - deck_add_handler('cardcast', 'A5DCM') + deck_add_handler('ahti', 'Base') elif rest[0] == 'offtopia-random': - send('Adding the default CAH deck (cardcast A5DCM), offtopia injoke deck (bslsk05 offtopiadeck), :Deck (bslsk05 colondeck) and three random cardcast decks') + send('Adding the default CAH deck (ahti Base), offtopia injoke deck (bslsk05 offtopiadeck), :Deck (bslsk05 colondeck) and three random ahti decks') - deck_add_handler('cardcast', 'A5DCM') + deck_add_handler('ahti', 'Base') deck_add_handler('bslsk05', 'offtopiadeck') deck_add_handler('bslsk05', 'colondeck') for _ in range(3): - deck_add_random_handler('cardcast') + deck_add_random_handler('ahti') elif rest[0] == 'offtopia': - send('Adding the default CAH deck (cardcast A5DCM), offtopia injoke deck (bslsk05 offtopiadeck), and :Deck (bslsk05 colondeck)') + send('Adding the default CAH deck (ahti Base), offtopia injoke deck (bslsk05 offtopiadeck), and :Deck (bslsk05 colondeck)') - deck_add_handler('cardcast', 'A5DCM') + deck_add_handler('ahti', 'Base') deck_add_handler('bslsk05', 'offtopiadeck') deck_add_handler('bslsk05', 'colondeck')