From 8d97382f5eae70938dbeb490679114c8b85e5991 Mon Sep 17 00:00:00 2001 From: HoraK-FDF Date: Fri, 4 Mar 2022 13:34:46 +0100 Subject: chat ignore and some fixes --- chat.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'chat.py') diff --git a/chat.py b/chat.py index 5fecb51..73a4ae4 100755 --- a/chat.py +++ b/chat.py @@ -3,7 +3,7 @@ from collections import deque import net.mapserv as mapserv import badge from loggers import debuglog -from utils import extends +from utils import extends, preloadArray from textutils import preprocess as pp from textutils import (simplify_links, remove_formatting, replace_emotes) @@ -15,6 +15,8 @@ afk_message = '*AFK* I am away from keyboard' afk_ts = 0 chat_bots = ["guild", "_IRC_"] +chat_beings_ignored = preloadArray("config/chat_beings_ignored.txt") +chat_wisper_ignored = preloadArray("config/chat_wisper_ignored.txt") def send_whisper(nick, message): badge.is_afk = False @@ -48,6 +50,11 @@ def send_whisper_result(data): @extends('smsg_being_chat') def being_chat(data): + if '*' in chat_beings_ignored: + return + real_name, _ = data.message.split(' : ', 1) + if real_name in chat_beings_ignored: + return message = pp(data.message, pp_actions) debuglog.info(message) @@ -61,6 +68,10 @@ def player_chat(data): @extends('smsg_whisper') def got_whisper(data): nick, message = data.nick, data.message + if '*' in chat_wisper_ignored: + return + if nick in chat_wisper_ignored: + return message = pp(message, pp_actions) m = "[{} ->] {}".format(nick, message) debuglog.info(m) -- cgit v1.2.3-70-g09d2