move accept_invite.py to core modules, default to not accepting invites bot-wide

This commit is contained in:
jesopo 2020-02-26 17:30:56 +00:00
parent f82e3536f0
commit 02e734824f

View file

@ -2,12 +2,15 @@
from src import ModuleManager, utils
@utils.export("serverset", utils.BoolSetting("accept-invites",
"Set whether I accept invites on this server"))
SETTING = utils.BoolSetting("accept-invites",
"Set whether I accept invites")
@utils.export("botset", SETTING)
@utils.export("serverset", SETTING)
class Module(ModuleManager.BaseModule):
@utils.hook("received.invite")
def on_invite(self, event):
if event["server"].is_own_nickname(event["target_user"].nickname):
if event["server"].get_setting("accept-invites", True):
if event["server"].get_setting("accept-invites",
self.bot.get_setting("accept-invites", False)):
event["server"].send_join(event["target_channel"])