Merge branch 'fix-issue-19589' of github.com:salandei/zulip into fix-issue-19589

This commit is contained in:
Samson Oderinwale 2024-05-17 13:29:37 +01:00
commit 4161bebd97
2 changed files with 7 additions and 3 deletions

View File

@ -149,6 +149,10 @@ Here's how we fill in the fields that a Slack-format webhook expects:
<tr>
<td><code>text</code></td>
<td>The content of the message (in Markdown)</td>
</tr>
<tr>
<td><code>command</code></td>
<td>The bot mention</td>
</tr>
<tr>
<td><code>trigger_word</code></td>
@ -173,8 +177,8 @@ The above data is posted as list of tuples (not JSON), here's an example:
('timestamp', 1532078950),
('user_id', 'U21'),
('user_name', 'Full Name'),
('command', '@**test**'),
('text', 'The content of the message'),
('command', '/test'),
('text', 'content'),
('trigger_word', 'mention'),
('service_id', 27)]
```

View File

@ -137,7 +137,7 @@ class SlackOutgoingWebhookService(OutgoingWebhookServiceInterface):
command_re = r"(@\*\*[\w]+\*\*)"
text = event["command"]
message_parts = re.split(command_re, text)
if re.fullmatch(command_re, message_parts[1]):
if len(message_parts) == 3 and re.fullmatch(command_re, message_parts[1]):
slash_command = "/" + message_parts[1][3:-2]
text = message_parts[2].strip()