File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55from cloudbot import hook
66from cloudbot.hook import Priority
7+ from cloudbot.util import colors
78
89NEW_LINE_TRANS_TBL = str.maketrans({
910 '\r': None,
@@ -41,3 +42,15 @@ def encode_line(line, conn):
4142 encoding = conn.config.get("encoding", "utf-8")
4243 errors = conn.config.get("encoding_errors", "replace")
4344 return line.encode(encoding, errors)
45+
46+
47+ @hook.irc_out(priority=Priority.HIGH)
48+ def strip_command_chars(parsed_line, conn, line):
49+ chars = conn.config.get("strip_cmd_chars", "!.@;$")
50+ if chars and parsed_line and parsed_line.command == "PRIVMSG" and parsed_line.parameters[-1][0] in chars:
51+ new_msg = colors.parse("$(red)[!!]$(clear) ") + parsed_line.parameters[-1]
52+ parsed_line.parameters[-1] = new_msg
53+ parsed_line.has_trail = True
54+ return parsed_line
55+
56+ return line
You can’t perform that action at this time.
0 commit comments