updated to allow specifying jpg or png; clarified instructions

This commit is contained in:
Adam Piontek 2018-08-26 10:46:22 -04:00
parent 70a58519c8
commit 5fbdef2b24
2 changed files with 8 additions and 3 deletions

View file

@ -8,4 +8,5 @@ Users can optionally specify whether to fetch a `gif` (animated) or a `still` (j
- `!catto` Fetches a random cat image, animated (gif) or still (jpg/png)
- `!catto gif` Fetches a random cat animated gif image
- `!catto still` Fetches a random cat still jpg/png image
- `!catto jpg` Fetches a random cat jpg image
- `!catto png` Fetches a random cat png image

View file

@ -43,14 +43,18 @@ class Catto(BotPlugin):
@botcmd(split_args_with=' ')
def catto(self, msg, args):
"""Fetch a random cat image, which may be animated (gif) or still (jpg/png)"""
"""Fetch a random cat image, optionally specifying 'gif' (animated), 'still' (jpg or png), or 'jpg' or 'png'"""
if len(args) > 0 and args[0]:
type = args[0]
if type == 'gif':
return self.get_catapi_pic("gif")
elif type == 'still':
return self.get_catapi_pic("jpg,png")
elif type == 'jpg':
return self.get_catapi_pic(type)
elif type == 'png':
return self.get_catapi_pic(type)
else:
return 'Unrecognized image type. Please use "gif" or "still" or leave blank to get either type.'
return 'Unrecognized image type. Please use "gif", "still", "jpg", "png", or leave blank to get any type.'
else:
return self.get_catpic()