sir-lancebot icon indicating copy to clipboard operation
sir-lancebot copied to clipboard

KeyError: 'image_url' in spookygif command

Open sentry[bot] opened this issue 3 years ago • 4 comments

Sentry Issue: SIR-LANCEBOT-83

KeyError: 'image_url'
  File "discord/ext/commands/core.py", line 167, in wrapped
    ret = await coro(*args, **kwargs)
  File "bot/exts/holidays/halloween/spookygif.py", line 28, in spookygif
    url = data["data"]["image_url"]

Unhandled command error: 'image_url'

This happens whenever running the .spookygif command, as image_url doesn't exist in the reponse from the API. Changing the line to url = data["data"]["url"] might work instead. See the API docs here https://developers.giphy.com/docs/api/endpoint#random

posted by wookie184

sentry[bot] avatar May 03 '22 13:05 sentry[bot]

Can you please assign this to me?

SaumyaBhushan avatar May 03 '22 17:05 SaumyaBhushan

@SaumyaBhushan Thanks, I've assigned you. Note that the fix I mentioned in the issue may not be right. I think Discord may need a GIF, so looking at the docs we may need one of the other URLs in the response like data["data"]["images"]["downsized_large"]["url"] for it to work.

wookie184 avatar May 03 '22 17:05 wookie184

@wookie184 how about using embed_url in gif object, its given in documentation, they must serve the purpose rightly here if i am not wrong ? image

Hashed0719 avatar Aug 01 '22 20:08 Hashed0719

@wookie184 how about using embed_url in gif object, its given in documentation, they must serve the purpose rightly here if i am not wrong ? image

It does look like it should work although I think I tried it a while back and it didn't seem to. Would be fine if it does work, although any solution would need testing.

wookie184 avatar Aug 02 '22 15:08 wookie184

Can I please be assigned this issue?

I believe I have fixed this.

JBarth86 avatar Sep 14 '22 01:09 JBarth86

@JBarth86 it is done.

Xithrius avatar Sep 14 '22 04:09 Xithrius