Skip to content

Commit 62555f9

Browse files
orientortimabbott
authored andcommitted
Bots: Update Owlbot from v1 to v2.
1 parent f253819 commit 62555f9

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

zulip_bots/zulip_bots/bots/define/define.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class DefineHandler(object):
1313
looks for messages starting with '@mention-bot'.
1414
'''
1515

16-
DEFINITION_API_URL = 'https://owlbot.info/api/v1/dictionary/{}?format=json'
16+
DEFINITION_API_URL = 'https://owlbot.info/api/v2/dictionary/{}?format=json'
1717
REQUEST_ERROR_MESSAGE = 'Could not load definition.'
1818
EMPTY_WORD_REQUEST_ERROR_MESSAGE = 'Please enter a word to define.'
1919
PHRASE_ERROR_MESSAGE = 'Definitions for phrases are not available.'
@@ -64,7 +64,7 @@ def get_bot_define_response(self, original_content: str) -> str:
6464
# Show definitions line by line.
6565
for d in definitions:
6666
example = d['example'] if d['example'] else '*No example available.*'
67-
response += '\n' + '* (**{}**) {}\n  {}'.format(d['type'], d['defenition'], html2text.html2text(example))
67+
response += '\n' + '* (**{}**) {}\n  {}'.format(d['type'], d['definition'], html2text.html2text(example))
6868

6969
except Exception as e:
7070
response += self.REQUEST_ERROR_MESSAGE

zulip_bots/zulip_bots/bots/define/fixtures/test_incorrect_word.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"request":{
3-
"api_url":"https://owlbot.info/api/v1/dictionary/foo?format=json"
3+
"api_url":"https://owlbot.info/api/v2/dictionary/foo?format=json"
44
},
55
"response":[
66
],

zulip_bots/zulip_bots/bots/define/fixtures/test_multi_type_word.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
{
22
"request":{
3-
"api_url":"https://owlbot.info/api/v1/dictionary/help?format=json"
3+
"api_url":"https://owlbot.info/api/v2/dictionary/help?format=json"
44
},
55
"response":[
66
{
77
"type":"verb",
8-
"defenition":"make it easier or possible for (someone) to do something by offering them one's services or resources.",
8+
"definition":"make it easier or possible for (someone) to do something by offering them one's services or resources.",
99
"example":"they helped her with domestic chores"
1010
},
1111
{
1212
"type":"verb",
13-
"defenition":"serve someone with (food or drink).",
13+
"definition":"serve someone with (food or drink).",
1414
"example":"may I help you to some more meat?"
1515
},
1616
{
1717
"type":"verb",
18-
"defenition":"cannot or could not avoid.",
18+
"definition":"cannot or could not avoid.",
1919
"example":"he couldn't help laughing"
2020
},
2121
{
2222
"type":"noun",
23-
"defenition":"the action of helping someone to do something.",
23+
"definition":"the action of helping someone to do something.",
2424
"example":"I asked for help from my neighbours"
2525
},
2626
{
2727
"type":"exclamation",
28-
"defenition":"used as an appeal for urgent assistance.",
28+
"definition":"used as an appeal for urgent assistance.",
2929
"example":"Help! I'm drowning!"
3030
}
3131
],

zulip_bots/zulip_bots/bots/define/fixtures/test_single_type_word.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"request":{
3-
"api_url":"https://owlbot.info/api/v1/dictionary/cat?format=json"
3+
"api_url":"https://owlbot.info/api/v2/dictionary/cat?format=json"
44
},
55
"response":[
66
{
77
"type":"noun",
8-
"defenition":"a small domesticated carnivorous mammal with soft fur, a short snout, and retractile claws. It is widely kept as a pet or for catching mice, and many breeds have been developed.",
8+
"definition":"a small domesticated carnivorous mammal with soft fur, a short snout, and retractile claws. It is widely kept as a pet or for catching mice, and many breeds have been developed.",
99
"example":"their pet cat"
1010
}
1111
],

0 commit comments

Comments
 (0)