aboutsummaryrefslogtreecommitdiff
path: root/modules/greeting.py
blob: a25e2e12fb930ba5a040cc374ce00e490c7c217d (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#--depends-on config

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!"))
class Module(ModuleManager.BaseModule):
    @utils.hook("received.join")
    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), tags)