Support setting strip-color per-channel not just per-server
This commit is contained in:
parent
5c5b4ef139
commit
2d949391a6
1 changed files with 6 additions and 1 deletions
|
@ -3,11 +3,16 @@ from src import ModuleManager, utils
|
||||||
@utils.export("serverset", {"setting": "strip-color",
|
@utils.export("serverset", {"setting": "strip-color",
|
||||||
"help": "Set whether I strip colors from my messages on this server",
|
"help": "Set whether I strip colors from my messages on this server",
|
||||||
"validate": utils.bool_or_none})
|
"validate": utils.bool_or_none})
|
||||||
|
@utils.export("channelset", {"setting": "strip-color",
|
||||||
|
"help": "Set whether I strip colors from my messages on in this channel",
|
||||||
|
"validate": utils.bool_or_none})
|
||||||
class Module(ModuleManager.BaseModule):
|
class Module(ModuleManager.BaseModule):
|
||||||
@utils.hook("preprocess.send.privmsg")
|
@utils.hook("preprocess.send.privmsg")
|
||||||
@utils.hook("preprocess.send.notice")
|
@utils.hook("preprocess.send.notice")
|
||||||
def preprocess(self, event):
|
def preprocess(self, event):
|
||||||
if event["server"].get_setting("strip-color", False):
|
strip_color = event["channel"].get_setting("strip-color",
|
||||||
|
event["server"].get_setting("strip-color", False))
|
||||||
|
if strip_color:
|
||||||
message = event["line"].args.get(-1)
|
message = event["line"].args.get(-1)
|
||||||
if not message == None:
|
if not message == None:
|
||||||
event["line"].args[-1] = utils.irc.strip_font(message)
|
event["line"].args[-1] = utils.irc.strip_font(message)
|
||||||
|
|
Loading…
Reference in a new issue