Merge pull request #344 from bitbot-irc/jess/channel-context
support +draft/channel-context in modules/greeting.py
This commit is contained in:
commit
b4c4960578
1 changed files with 7 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue