Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
Enhance Slack message formatting with new regex rules
Aleksander W. Oleszkiewicz (Alek)90be9004487f
diff --git a/nanobot/channels/slack.py b/nanobot/channels/slack.pyindex 72984357a..6b685d103 100644--- a/nanobot/channels/slack.py+++ b/nanobot/channels/slack.py@@ -223,9 +223,21 @@ class SlackChannel(BaseChannel):# Step 3.a: ***text*** -> *_text_*converted_text = re.sub(r"(?m)(^|[^\*])\*\*\*([^\*].+?[^\*])\*\*\*([^\*]|$)", r"\1*_\2_*\3", converted_text)- # Step 3.b - ___text___ to *_text_*+ # Step 3.b - ___text___ -> *_text_*converted_text = re.sub(r"(?m)(^|[^_])___([^_].+?[^_])___([^_]|$)", r"\1*_\2_*\3", converted_text)+ # Convert strikethrough+ # Step 4: ~~text~~ -> ~text~+ converted_text = re.sub(+ r"(?m)(^|[^~])~~([^~].+?[^~])~~([^~]|$)", r"\1~\2~\3", converted_text)+ # Convert URL formatting+ # Step 6: [text](URL) -> <URL|text>+ converted_text = re.sub(+ r"(^|[^!])\[(.+?)\]\((http.+?)\)", r"<\2|\1>", converted_text)+ # Convert image URL+ # Step 6:  -> <URL>+ converted_text = re.sub(+ r"[!]\[.+?\]\((http.+?)(?: \".*?\")?\)", r"<\2>", converted_text)return converted_textdef escape_mrkdwn(text: str) -> str:return (text.replace('&', '&')