Basic chat-filter functionality

This commit is contained in:
Ben 2019-12-02 23:28:55 +00:00
parent c9907ba178
commit 399df4ad16
2 changed files with 11 additions and 0 deletions

View File

@ -16,6 +16,15 @@ async def handle_send_message(p, penguin_id: int, message: str):
return
tokens = message.lower()
for word, consequence in p.server.chat_filter_words.items():
if word in tokens:
if consequence.ban:
return
elif consequence.warn:
return
elif consequence.filter:
return
if has_command_prefix(p.server.config.command_prefix, message):
await invoke_command_string(p.server.commands, p, message)
else:

View File

@ -24,6 +24,7 @@ from houdini.data.mail import PostcardCollection
from houdini.data.pet import PuffleCollection, PuffleItemCollection
from houdini.data.permission import PermissionCollection
from houdini.data.buddy import CharacterCollection
from houdini.data.moderator import ChatFilterRuleCollection
try:
import uvloop
@ -74,6 +75,7 @@ class Houdini:
self.plugins = PluginManager(self)
self.permissions = None
self.chat_filter_words = None
self.items = None
self.igloos = None