Browse Source

Remove cardcast namespace in favour of ahti namespace

pull/1/head
Juhani Krekelä 3 years ago
parent
commit
54ca90a1a7
  1. 4
      cardcast_api.py
  2. 18
      gameloop.py

4
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:

18
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')

Loading…
Cancel
Save