def _command_details(self, output, link_only=False):
response = ""
command = output.get('@mention').split()
if len(command) != 2:
response += "command must be in the form `details <meme_url>`\n"
else:
meme_url = html.unescape(command[1][1:-1])
meme_data = scrape_reddit.update_reddit_meme(
self.cursor, self.conn, meme_url, self.lock
)
if meme_data is None:
response += "I could find any data for this url: `{}`, sorry\n".format(meme_url)
else:
if link_only:
for meme in meme_data:
response += meme.get('link') + '\n'
else:
for meme in meme_data:
for key, val in sorted(meme.items()):
response += "`{key}`: {data}\n".format(key=key, data=val)
response += '\n'
return response
评论列表
文章目录