aboutsummaryrefslogtreecommitdiff
path: root/modules/imgur.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-10-31 17:54:44 +0000
committerGravatar jesopo2018-10-31 17:54:44 +0000
commit18d055bb9e5e87598006d6e2ab6f6853b3a0b518 (patch)
treeb7a461c95a02a8cd0fdc8b724cb5fca2acfa6d36 /modules/imgur.py
parentUse gallery API endpoint for gallery urls (diff)
signature
Check if a url is a gallery first, 'event' -> 'data' typo, actually return from
_prefix
Diffstat (limited to 'modules/imgur.py')
-rw-r--r--modules/imgur.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/modules/imgur.py b/modules/imgur.py
index dd586b4f..1b3bfadf 100644
--- a/modules/imgur.py
+++ b/modules/imgur.py
@@ -16,6 +16,7 @@ class Module(ModuleManager.BaseModule):
text += "[NSFW] "
if data["account_url"]:
text += "%s " % data["account_url"]
+ return text
def _image_info(self, hash):
api_key = self.bot.config["imgur-api-key"]
@@ -27,10 +28,10 @@ class Module(ModuleManager.BaseModule):
data = result["data"]
text = self._prefix(data)
- text += "(%s %dx%d, %d views) " % (data["type"], data["width"],
+ text += "(%s %dx%d, %d views)" % (data["type"], data["width"],
data["height"], data["views"])
if data["title"]:
- text += data["title"]
+ text += " %s" % data["title"]
return text
else:
raise utils.EventsResultsError()
@@ -44,10 +45,10 @@ class Module(ModuleManager.BaseModule):
if result and result["success"]:
data = result["data"]
text = self._prefix(data)
- text += "(%d views, %d▲▼%d)" % (event["views"],
- event["ups"], event["downs"])
+ text += "(%d views, %d▲▼%d)" % (data["views"],
+ data["ups"], data["downs"])
if data["title"]:
- text += data["title"]
+ text += " %s" % data["title"]
return text
else:
raise utils.EventsResultsError()
@@ -58,9 +59,11 @@ class Module(ModuleManager.BaseModule):
:help: Get information about a given imgur image URL
:usage: <url>
"""
- match = REGEX_IMAGE.match(event["args_split"][0])
- if match:
- event["stdout"].write(self._image_info(match.group(1)))
match = REGEX_GALLERY.match(event["args_split"][0])
if match:
event["stdout"].write(self._gallery_info(match.group(1)))
+ return
+ match = REGEX_IMAGE.match(event["args_split"][0])
+ if match:
+ event["stdout"].write(self._image_info(match.group(1)))
+ return