link_shortener: Print `help` when no links found.
MODIFY
zulip_bots/zulip_bots/bots/link_shortener/link_shortener.py
zulip_bots/zulip_bots/bots/link_shortener/link_shortener.py
@@ -40,16 +40,18 @@ class LinkShortenerHandler(object):
')'
)
+ HELP_STR = (
+ 'Mention the link shortener bot in a conversation and '
+ 'then enter any URLs you want to shorten in the body of '
+ 'the message.'
+ )
+
content = message['content']
if content.strip() == 'help':
bot_handler.send_reply(
message,
- (
- 'Mention the link shortener bot in a conversation and '
- 'then enter any URLs you want to shorten in the body of '
- 'the message.'
- )
+ HELP_STR
)
return
@@ -67,7 +69,7 @@ class LinkShortenerHandler(object):
if final_response == '':
bot_handler.send_reply(
message,
- 'No links found. Send "help" to see usage instructions.'
+ 'No links found. ' + HELP_STR
)
return

MODIFY
zulip_bots/zulip_bots/bots/link_shortener/test_link_shortener.py
zulip_bots/zulip_bots/bots/link_shortener/test_link_shortener.py
@@ -13,7 +13,11 @@ class TestLinkShortenerBot(BotTestCase):
def test_bot_responds_to_empty_message(self) -> None:
with patch('requests.get'):
- self._test('', 'No links found. Send "help" to see usage instructions.')
+ self._test('',
+ ('No links found. '
+ 'Mention the link shortener bot in a conversation and '
+ 'then enter any URLs you want to shorten in the body of '
+ 'the message.'))
def test_normal(self) -> None:
with self.mock_http_conversation('test_normal'):
@@ -26,7 +30,10 @@ class TestLinkShortenerBot(BotTestCase):
# requests.
with patch('requests.get'):
self._test('Shorten nothing please.',
- 'No links found. Send "help" to see usage instructions.')
+ ('No links found. '
+ 'Mention the link shortener bot in a conversation and '
+ 'then enter any URLs you want to shorten in the body of '
+ 'the message.'))
def test_help(self) -> None:
# No `mock_http_conversation` is necessary because the bot will

link_shortener: Print `help` when no links found.