Merge pull request #344 from bitbot-irc/jess/channel-context

support +draft/channel-context in modules/greeting.py
This commit is contained in:
David Schultz 2022-07-11 17:48:49 -05:00 committed by GitHub
commit b4c4960578
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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)