diff options
| author | 2018-09-06 18:06:29 +0100 | |
|---|---|---|
| committer | 2018-09-06 18:06:29 +0100 | |
| commit | c8309d96eafb354b6f6f5d21226b4869c6176207 (patch) | |
| tree | 24eb59a7d0355cca32d817e449ed419add8ba38b /modules/auto_mode.py | |
| parent | Finally implement auto_mode.py! (diff) | |
| signature | ||
Only do automode when a user is identified, also do automode on an IRCv3
ACCOUNT command
Diffstat (limited to 'modules/auto_mode.py')
| -rw-r--r-- | modules/auto_mode.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/modules/auto_mode.py b/modules/auto_mode.py index 9cdd47a8..6deff530 100644 --- a/modules/auto_mode.py +++ b/modules/auto_mode.py @@ -27,13 +27,18 @@ class Module(object): "help": "Disable/Enable automode", "validate": Utils.bool_or_none}) - def on_join(self, event): - if event["channel"].get_setting("automode", False): - modes = event["channel"].get_user_setting(event["user"].get_id(), - "automodes", []) + def _check_modes(self, channel, user): + identified_account = user.get_identified_account() + if identified_account and channel.get_setting("automode", False): + modes = channel.get_user_setting(user.get_id(), "automodes", []) if modes: - event["channel"].send_mode("+%s" % "".join(modes), - " ".join([event["user"].nickname for mode in modes])) + channel.send_mode("+%s" % "".join(modes), + " ".join([user.nickname for mode in modes])) + def on_join(self, event): + self._check_modes(event["channel"], event["user"]) + def on_account(self, event): + for channel in event["user"].channels: + self._check_modes(channel, event["user"]) def _add_mode(self, event, mode, mode_name): target_user = event["server"].get_user(event["args_split"][0]) |
