specifying min_err_version
This commit is contained in:
parent
6a274b7767
commit
17f7932e40
1 changed files with 3 additions and 2 deletions
5
doggo.py
5
doggo.py
|
@ -6,6 +6,7 @@ from errbot import botcmd, BotPlugin
|
||||||
|
|
||||||
class Doggo(BotPlugin):
|
class Doggo(BotPlugin):
|
||||||
"""Fetch random dog image URLs"""
|
"""Fetch random dog image URLs"""
|
||||||
|
min_err_version = '3.0.0' # Optional, but recommended
|
||||||
|
|
||||||
BASE_URL = 'https://dog.ceo/api'
|
BASE_URL = 'https://dog.ceo/api'
|
||||||
|
|
||||||
|
@ -140,7 +141,7 @@ class Doggo(BotPlugin):
|
||||||
return 'Breed not found: {}. List breeds with !listbreeds'.format(breed)
|
return 'Breed not found: {}. List breeds with !listbreeds'.format(breed)
|
||||||
else:
|
else:
|
||||||
return 'Please tell me the breed for which you want sub-breeds, like: *!reloadsubbreeds terrier*'
|
return 'Please tell me the breed for which you want sub-breeds, like: *!reloadsubbreeds terrier*'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
resp = requests.get(url)
|
resp = requests.get(url)
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
|
@ -151,7 +152,7 @@ class Doggo(BotPlugin):
|
||||||
data = resp.json()['message']
|
data = resp.json()['message']
|
||||||
if not isinstance(data, list):
|
if not isinstance(data, list):
|
||||||
return 'Unable to load sub-breeds list'
|
return 'Unable to load sub-breeds list'
|
||||||
|
|
||||||
self.breeds[breed] = data
|
self.breeds[breed] = data
|
||||||
if 'calledbyfunction' not in args:
|
if 'calledbyfunction' not in args:
|
||||||
# Tell user command was successful
|
# Tell user command was successful
|
||||||
|
|
Loading…
Reference in a new issue