2018-10-03 12:22:37 +00:00
|
|
|
from src import ModuleManager, utils
|
2016-03-29 11:56:58 +00:00
|
|
|
|
2018-10-03 12:22:37 +00:00
|
|
|
@utils.export("serverset", {"setting": "accept-invites",
|
2018-09-27 11:08:07 +00:00
|
|
|
"help": "Set whether I accept invites on this server",
|
2018-10-03 12:22:37 +00:00
|
|
|
"validate": utils.bool_or_none})
|
2018-09-27 11:08:07 +00:00
|
|
|
class Module(ModuleManager.BaseModule):
|
2018-10-03 12:22:37 +00:00
|
|
|
@utils.hook("received.invite")
|
2016-03-29 11:56:58 +00:00
|
|
|
def on_invite(self, event):
|
2018-09-03 10:47:11 +00:00
|
|
|
if event["server"].is_own_nickname(event["target_user"].nickname):
|
|
|
|
if event["server"].get_setting("accept-invites", True):
|
|
|
|
event["server"].send_join(event["target_channel"])
|
2018-09-09 09:17:22 +00:00
|
|
|
|