diff options
| author | 2018-08-08 13:41:25 +0100 | |
|---|---|---|
| committer | 2018-08-08 13:41:25 +0100 | |
| commit | fda3d65d536145d1ccee93120f9ce79c8f7806cb (patch) | |
| tree | dd87906632c6601435b3eaa32f7f771057a29cdf | |
| parent | Also track BitBot's words in words.py (diff) | |
| signature | ||
Added a setting to disable ctcp responses
| -rw-r--r-- | modules/ctcp.py | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/modules/ctcp.py b/modules/ctcp.py index 933e02af..031b39cd 100644 --- a/modules/ctcp.py +++ b/modules/ctcp.py @@ -8,24 +8,25 @@ class Module(object): def private_message(self, event): if event["message"][0] == "\x01" and event["message"][-1] == "\x01": - ctcp_command = event["message_split"][0][1:].upper() - if ctcp_command.endswith("\x01"): - ctcp_command = ctcp_command[:-1] - ctcp_args = " ".join(event["message_split"][1:])[:-1] - ctcp_args_split = ctcp_args.split(" ") + if event["server"].get_setting("ctcp-responses", True): + ctcp_command = event["message_split"][0][1:].upper() + if ctcp_command.endswith("\x01"): + ctcp_command = ctcp_command[:-1] + ctcp_args = " ".join(event["message_split"][1:])[:-1] + ctcp_args_split = ctcp_args.split(" ") - ctcp_response = None - if ctcp_command == "VERSION": - ctcp_response = self.bot.config.get("ctcp-version", - "BitBot (https://github.com/jesopo/bitbot)") - elif ctcp_command == "SOURCE": - ctcp_response = self.bot.config.get("ctcp-source", - "https://github.com/jesopo/bitbot") - elif ctcp_command == "PING": - ctcp_response = " ".join(ctcp_args_split) - elif ctcp_command == "TIME": - ctcp_response = datetime.datetime.now().strftime("%c") + ctcp_response = None + if ctcp_command == "VERSION": + ctcp_response = self.bot.config.get("ctcp-version", + "BitBot (https://github.com/jesopo/bitbot)") + elif ctcp_command == "SOURCE": + ctcp_response = self.bot.config.get("ctcp-source", + "https://github.com/jesopo/bitbot") + elif ctcp_command == "PING": + ctcp_response = " ".join(ctcp_args_split) + elif ctcp_command == "TIME": + ctcp_response = datetime.datetime.now().strftime("%c") - if ctcp_response: - event["user"].send_ctcp_response(ctcp_command, - ctcp_response) + if ctcp_response: + event["user"].send_ctcp_response(ctcp_command, + ctcp_response) |
