From 5efa4e80e24fb4d3d031d84de3030a60376b3d33 Mon Sep 17 00:00:00 2001 From: Someone Date: Thu, 27 Jan 2022 13:14:59 +0100 Subject: [PATCH] modules/CommandGetPostSrc.py --- modules/CommandGetPostSrc.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/CommandGetPostSrc.py b/modules/CommandGetPostSrc.py index 11429e2..955400c 100644 --- a/modules/CommandGetPostSrc.py +++ b/modules/CommandGetPostSrc.py @@ -5,15 +5,16 @@ # This command relies on the priviledged DB-Cleaner maint script. +import re # pylint: disable=wrong-import-position from AbstractCommand import AbstractCommand class CommandGetPostSrc(AbstractCommand): TRIGGER = "get-post-src" CONFIG = {"display_name": "somebot-command", "auto_complete": True, - "auto_complete_hint": "", + "auto_complete_hint": " [--channel]", } - CONFIG["auto_complete_desc"] = CONFIG["description"] = AbstractCommand.ICON_PRIVATE+"Get the unparsed post message of permalinked post (useful when wantng to get the latex source of a post)" + CONFIG["auto_complete_desc"] = CONFIG["description"] = AbstractCommand.ICON_PRIVATE+"Get the unparsed post message of permalinked post (useful when wantng to get the latex source of a post) --channel to post to channel." def on_POST(self, request, data): @@ -31,5 +32,8 @@ class CommandGetPostSrc(AbstractCommand): request.respond_cmd_err("``/"+self.TRIGGER+"`` Must be executed in the same channel as the permalinked post.") return - #request.respond_cmd_temp("## :white_check_mark: Success! :)\n``````\n"+post["message"]+"\n``````") - request.respond_cmd_temp("``````\n"+post["message"]+"\n``````") + if len(msg_text) == 2 and re.match(r"^(-|—|–)+channel$", msg_text[1]): + request.respond_cmd_chan("``````\n"+post["message"]+"\n``````") + else: + #request.respond_cmd_temp("## :white_check_mark: Success! :)\n``````\n"+post["message"]+"\n``````") + request.respond_cmd_temp("``````\n"+post["message"]+"\n``````") -- 2.43.0