From 1b44b58aca104056b9b8db803166729b6097ba9a Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 12 Sep 2019 10:24:10 +0100 Subject: [PATCH] add !invite --- modules/channel_op.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/modules/channel_op.py b/modules/channel_op.py index e4a7e8ba..67a2cb5b 100644 --- a/modules/channel_op.py +++ b/modules/channel_op.py @@ -213,3 +213,21 @@ class Module(ModuleManager.BaseModule): if server and event["channel_name"] in server.channels: channel = server.channels.get(event["channel_name"]) channel.send_mode("-%s" % event["mode"], [event["mask"]]) + + @utils.hook("received.command.invite") + @utils.kwarg("min_args", 1) + @utils.kwarg("channel_only", True) + @utils.kwarg("require_mode", "o") + @utils.kwarg("require_access", "invite") + @utils.kwarg("help", "Invite a given user") + @utils.kwarg("usage", "") + def invite(self, event): + user_nickname = event["args_split"][0] + + event["target"].send_invite(user_nickname) + + user = event["server"].get_user(user_nickname, create=False) + if user: + user_nickname = user.nickname + + event["stdout"].write("Invited %s" % user_nickname)