bitbot-3.11-fork/modules/greeting.py

15 lines
496 B
Python
Raw Normal View History

#--depends-on config
from src import ModuleManager, utils
2018-09-03 07:29:58 +00:00
@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")
2018-09-03 07:29:58 +00:00
def join(self, event):
greeting = event["channel"].get_setting("greeting", None)
if greeting:
event["user"].send_notice("[%s] %s" % (event["channel"].name,
greeting))