blob: 28288209915a5e58b29e6272037cc05b812d95d2 (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#--depends-on config
from src import ModuleManager, utils
@utils.export("serverset", {"setting": "strip-color",
"help": "Set whether I strip colors from my messages on this server",
"validate": utils.bool_or_none, "example": "on"})
@utils.export("channelset", {"setting": "strip-color",
"help": "Set whether I strip colors from my messages on in this channel",
"validate": utils.bool_or_none, "example": "on"})
class Module(ModuleManager.BaseModule):
@utils.hook("preprocess.send.privmsg")
@utils.hook("preprocess.send.notice")
def preprocess(self, event):
if len(event["line"].args) > 1:
strip_color = event["server"].get_setting("strip-color", False)
target = event["line"].args[0]
if not strip_color and target in event["server"].channels:
channel = event["server"].channels.get(target)
strip_color = channel.get_setting("strip-color", False)
if strip_color:
message = event["line"].args[1]
event["line"].args[1] = utils.irc.strip_font(message)
|