2018-10-03 12:22:37 +00:00
|
|
|
from src import ModuleManager, utils
|
2018-09-30 19:12:11 +00:00
|
|
|
|
2018-10-03 12:22:37 +00:00
|
|
|
@utils.export("serverset", {"setting": "strip-color",
|
2018-09-30 19:12:11 +00:00
|
|
|
"help": "Set whether I strip colors from my messages on this server",
|
2018-10-03 12:22:37 +00:00
|
|
|
"validate": utils.bool_or_none})
|
2018-09-30 19:12:11 +00:00
|
|
|
class Module(ModuleManager.BaseModule):
|
2019-02-23 21:40:11 +00:00
|
|
|
@utils.hook("preprocess.send.privmsg")
|
|
|
|
@utils.hook("preprocess.send.notice")
|
2018-09-30 19:12:11 +00:00
|
|
|
def preprocess(self, event):
|
|
|
|
if event["server"].get_setting("strip-color", False):
|
2019-02-23 21:40:11 +00:00
|
|
|
line = event["line"]
|
|
|
|
line.args[-1] = utils.irc.strip_font(line.args[-1])
|