aboutsummaryrefslogtreecommitdiff
path: root/modules/strip_color.py
blob: c9c444b5ae1c78b49ab8a0434db9587c89263b93 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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})
class Module(ModuleManager.BaseModule):
    @utils.hook("preprocess.send.privmsg")
    @utils.hook("preprocess.send.notice")
    def preprocess(self, event):
        if event["server"].get_setting("strip-color", False):
            message = event["line"].args.get(-1)
            if not message == None:
                event["line"].args[-1] = utils.irc.strip_font(message)