Put a maximum length for cards
This commit is contained in:
parent
8db8da3d16
commit
1781614e27
18
gameloop.py
18
gameloop.py
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue