Put a maximum length for cards

This commit is contained in:
Juhani Krekelä 2019-05-12 19:29:50 +03:00
parent 8db8da3d16
commit 1781614e27
1 changed files with 18 additions and 0 deletions

View File

@ -143,6 +143,24 @@ def game(send, notice, voice, devoice, get_event):
calls[i] = call
# Preprocess calls so that they are cut short if they're >200 chars
for i in range(len(calls)):
call = []
combined_length = 0
for index, part in enumerate(calls[i]):
if combined_length + len(part) > 200:
part = part[:200 - combined_length] + ''
call.append(part)
combined_length += len(part) + 1
calls[i] = call
# Preprocess responses so that they are at max. 160 chars
for i in range(len(responses)):
if len(responses[i]) > 160:
responses[i] = responses[i][:159] + ''
# Add a new deck to list of decks
decks[code] = Deck(
code = code,