support +draft/channel-context in modules/greeting.py

This commit is contained in:
jesopo 2022-04-22 10:14:47 +00:00
parent 4a6037c774
commit bb0eadbbea

View file

@ -2,6 +2,8 @@
from src import ModuleManager, utils
CAP = utils.irc.Capability("message-tags", "draft/message-tags-0.2")
@utils.export("channelset", utils.Setting("greeting",
"Set a greeting to send to users when they join",
example="welcome to the channel!"))
@ -10,5 +12,9 @@ class Module(ModuleManager.BaseModule):
def join(self, event):
greeting = event["channel"].get_setting("greeting", None)
if greeting:
tags = {}
if event["server"].has_capability(CAP):
tags["+draft/channel-context"] = event["channel"].name
event["user"].send_notice("[%s] %s" % (event["channel"].name,
greeting))
greeting), tags)