2018-09-24 14:13:27 +00:00
|
|
|
from src import Utils
|
2016-03-29 11:56:58 +00:00
|
|
|
|
|
|
|
class Module(object):
|
2018-09-02 18:54:45 +00:00
|
|
|
def __init__(self, bot, events, exports):
|
2018-09-09 09:17:22 +00:00
|
|
|
exports.add("serverset", {"setting": "accept-invites",
|
|
|
|
"help": "Set whether I accept invites on this server",
|
|
|
|
"validate": Utils.bool_or_none})
|
2016-03-29 11:56:58 +00:00
|
|
|
|
2018-09-26 17:27:17 +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
|
|
|
|