mirror of
https://github.com/solero/houdini.git
synced 2024-11-09 20:58:20 +00:00
Filter words found in chat_filter_words
server crumbs
This commit is contained in:
parent
4027a7af08
commit
c6809070e7
@ -1,5 +1,7 @@
|
|||||||
from houdini import handlers
|
from houdini import handlers
|
||||||
from houdini.handlers import XTPacket
|
from houdini.handlers import XTPacket
|
||||||
|
from houdini.handlers.play.moderation import moderator_ban
|
||||||
|
|
||||||
from houdini.commands import invoke_command_string, has_command_prefix
|
from houdini.commands import invoke_command_string, has_command_prefix
|
||||||
|
|
||||||
from houdini.data.moderator import ChatFilterRuleCollection
|
from houdini.data.moderator import ChatFilterRuleCollection
|
||||||
@ -23,15 +25,16 @@ 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()
|
tokens = message.lower().split()
|
||||||
for word, consequence in p.server.chat_filter_words.items():
|
|
||||||
if word in tokens:
|
word, consequence = next(((w, c) for w, c in p.server.chat_filter_words.items() if w in tokens))
|
||||||
if consequence.ban:
|
|
||||||
return
|
if consequence.ban:
|
||||||
elif consequence.warn:
|
return await moderator_ban(p, p.id, comment='Inappropriate language', message=message)
|
||||||
return
|
elif consequence.warn:
|
||||||
elif consequence.filter:
|
return
|
||||||
return
|
elif consequence.filter:
|
||||||
|
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