mirror of
https://github.com/solero/houdini.git
synced 2024-11-25 06:57:24 +00:00
Fix StopIteration error when chat filter active but not triggered
This commit is contained in:
parent
e58f00171c
commit
052742b478
@ -26,14 +26,14 @@ async def handle_send_message(p, penguin_id: int, message: str):
|
|||||||
if p.server.chat_filter_words:
|
if p.server.chat_filter_words:
|
||||||
tokens = message.lower().split()
|
tokens = message.lower().split()
|
||||||
|
|
||||||
word, consequence = next(((w, c) for w, c in p.server.chat_filter_words.items() if w in tokens))
|
consequence = next((c for w, c in p.server.chat_filter_words.items() if w in tokens), None)
|
||||||
|
|
||||||
if consequence.ban:
|
if consequence is not None:
|
||||||
return await moderator_ban(p, p.id, comment='Inappropriate language', message=message)
|
if consequence.ban:
|
||||||
elif consequence.warn:
|
await moderator_ban(p, p.id, comment='Inappropriate language', message=message)
|
||||||
return
|
return
|
||||||
elif consequence.filter:
|
if consequence.filter:
|
||||||
return
|
return
|
||||||
|
|
||||||
if has_command_prefix(p.server.config.command_prefix, message):
|
if has_command_prefix(p.server.config.command_prefix, message):
|
||||||
await invoke_command_string(p.server.commands, p, message)
|
await invoke_command_string(p.server.commands, p, message)
|
||||||
|
Loading…
Reference in New Issue
Block a user