mirror of
https://github.com/solero/houdini.git
synced 2024-11-21 21:17:21 +00:00
Fix StopIteration exception thrown when chat_filter_words
is empty
This commit is contained in:
parent
c02b6e164d
commit
7af9344a00
@ -25,16 +25,17 @@ async def handle_send_message(p, penguin_id: int, message: str):
|
|||||||
await penguin.send_xt("mm", message, penguin_id)
|
await penguin.send_xt("mm", message, penguin_id)
|
||||||
return
|
return
|
||||||
|
|
||||||
tokens = message.lower().split()
|
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))
|
word, consequence = next(((w, c) for w, c in p.server.chat_filter_words.items() if w in tokens))
|
||||||
|
|
||||||
if consequence.ban:
|
if consequence.ban:
|
||||||
return await moderator_ban(p, p.id, comment='Inappropriate language', message=message)
|
return await moderator_ban(p, p.id, comment='Inappropriate language', message=message)
|
||||||
elif consequence.warn:
|
elif consequence.warn:
|
||||||
return
|
return
|
||||||
elif consequence.filter:
|
elif 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