Fix StopIteration exception thrown when chat_filter_words is empty

This commit is contained in:
Ben 2020-03-14 18:25:32 +00:00
parent c02b6e164d
commit 7af9344a00

View File

@ -25,6 +25,7 @@ async def handle_send_message(p, penguin_id: int, message: str):
await penguin.send_xt("mm", message, penguin_id)
return
if p.server.chat_filter_words:
tokens = message.lower().split()
word, consequence = next(((w, c) for w, c in p.server.chat_filter_words.items() if w in tokens))