diff --git a/gameloop.py b/gameloop.py index 92ce736..1b4dc48 100644 --- a/gameloop.py +++ b/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,