wikipedia bot: Update bot & tests to use bot identity functionality.

This commit is contained in:
neiljp (Neil Pilgrim) 2018-04-08 15:47:13 -07:00 committed by showell
parent 56c59d915a
commit f15356c4c8
2 changed files with 3 additions and 3 deletions

View file

@ -52,7 +52,7 @@ class TestWikipediaBot(BotTestCase):
# Empty query, no request made to the Internet. # Empty query, no request made to the Internet.
bot_request = '' bot_request = ''
bot_response = "Please enter your search term after @mention-bot" bot_response = "Please enter your search term after @**test-bot**"
self.verify_reply(bot_request, bot_response) self.verify_reply(bot_request, bot_response)
# Incorrect status code # Incorrect status code

View file

@ -40,12 +40,12 @@ class WikipediaHandler(object):
def get_bot_wiki_response(self, message: Dict[str, str], bot_handler: Any) -> Optional[str]: def get_bot_wiki_response(self, message: Dict[str, str], bot_handler: Any) -> Optional[str]:
'''This function returns the URLs of the requested topic.''' '''This function returns the URLs of the requested topic.'''
help_text = 'Please enter your search term after @mention-bot' help_text = 'Please enter your search term after {}'
# Checking if the link exists. # Checking if the link exists.
query = message['content'] query = message['content']
if query == '': if query == '':
return help_text return help_text.format(bot_handler.identity().mention)
query_wiki_url = 'https://en.wikipedia.org/w/api.php' query_wiki_url = 'https://en.wikipedia.org/w/api.php'
query_wiki_params = dict( query_wiki_params = dict(