2019-05-25 20:40:06 +00:00
|
|
|
#--depends-on config
|
|
|
|
|
2018-10-03 12:22:37 +00:00
|
|
|
from src import ModuleManager, utils
|
2018-09-30 19:12:11 +00:00
|
|
|
|
2019-06-28 22:16:05 +00:00
|
|
|
@utils.export("serverset", utils.BoolSetting("strip-color",
|
|
|
|
"Set whether I strip colors from my messages on this server"))
|
|
|
|
@utils.export("channelset", utils.BoolSetting("strip-color",
|
|
|
|
"Set whether I strip colors from my messages on in this channel"))
|
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):
|
2019-06-16 08:52:04 +00:00
|
|
|
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)
|
2019-03-10 13:09:37 +00:00
|
|
|
|
2019-06-16 08:52:04 +00:00
|
|
|
if strip_color:
|
|
|
|
message = event["line"].args[1]
|
|
|
|
event["line"].args[1] = utils.irc.strip_font(message)
|