Browse Source

Merge branch 'master' of ssh://git.73k.us:2222/adam/err-doggo

master
Adam Piontek 1 year ago
parent
commit
755ddc2f36
3 changed files with 10 additions and 3 deletions
  1. +1
    -0
      .editorconfig
  2. +6
    -1
      .gitignore
  3. +3
    -2
      doggo.py

+ 1
- 0
.editorconfig View File

@@ -3,6 +3,7 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space

+ 6
- 1
.gitignore View File

@@ -8,7 +8,6 @@ __pycache__/

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
@@ -24,6 +23,7 @@ wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
@@ -45,6 +45,7 @@ nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
@@ -53,6 +54,7 @@ coverage.xml
# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
@@ -84,8 +86,11 @@ celerybeat-schedule

# virtualenv
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject

+ 3
- 2
doggo.py View File

@@ -6,6 +6,7 @@ from errbot import botcmd, BotPlugin

class Doggo(BotPlugin):
"""Fetch random dog image URLs"""
min_err_version = '3.0.0' # Optional, but recommended

BASE_URL = 'https://dog.ceo/api'

@@ -140,7 +141,7 @@ class Doggo(BotPlugin):
return 'Breed not found: {}. List breeds with !listbreeds'.format(breed)
else:
return 'Please tell me the breed for which you want sub-breeds, like: *!reloadsubbreeds terrier*'
try:
resp = requests.get(url)
resp.raise_for_status()
@@ -151,7 +152,7 @@ class Doggo(BotPlugin):
data = resp.json()['message']
if not isinstance(data, list):
return 'Unable to load sub-breeds list'
self.breeds[breed] = data
if 'calledbyfunction' not in args:
# Tell user command was successful

Loading…
Cancel
Save