diff --git a/zulip_bots/zulip_bots/bots/xkcd/test_xkcd.py b/zulip_bots/zulip_bots/bots/xkcd/test_xkcd.py index 310a8f5..3659bf1 100755 --- a/zulip_bots/zulip_bots/bots/xkcd/test_xkcd.py +++ b/zulip_bots/zulip_bots/bots/xkcd/test_xkcd.py @@ -13,7 +13,7 @@ class TestXkcdBot(BotTestCase): @mock.patch('logging.exception') def test_bot(self, mock_logging_exception): help_txt = "xkcd bot supports these commands:" - err_txt = "xkcd bot only supports these commands:" + err_txt = "xkcd bot only supports these commands, not `{}`:" commands = ''' * `@xkcd help` to show this help message. * `@xkcd latest` to fetch the latest comic strip from xkcd. @@ -78,7 +78,7 @@ class TestXkcdBot(BotTestCase): ) # Empty query, no request made to the Internet. - bot_response = err_txt+commands + bot_response = err_txt.format('')+commands self.assert_bot_response( message = {'content': ''}, response = {'content': bot_response}, @@ -94,7 +94,7 @@ class TestXkcdBot(BotTestCase): ) # wrong command. - bot_response = err_txt+commands + bot_response = err_txt.format('x')+commands self.assert_bot_response( message = {'content': 'x'}, response = {'content': bot_response}, diff --git a/zulip_bots/zulip_bots/bots/xkcd/xkcd.py b/zulip_bots/zulip_bots/bots/xkcd/xkcd.py index 3d057be..7bccf7b 100644 --- a/zulip_bots/zulip_bots/bots/xkcd/xkcd.py +++ b/zulip_bots/zulip_bots/bots/xkcd/xkcd.py @@ -68,7 +68,7 @@ def get_xkcd_bot_response(message): elif command.isdigit(): fetched = fetch_xkcd_query(XkcdBotCommand.COMIC_ID, command) else: - return commands_help % ('xkcd bot only supports these commands:') + return commands_help % ("xkcd bot only supports these commands, not `%s`:" % (command,)) except (requests.exceptions.ConnectionError, XkcdServerError): logging.exception('Connection error occurred when trying to connect to xkcd server') return 'Sorry, I cannot process your request right now, please try again later!'