discord.User.AvatarDecoration not working because discord modified the json payload
vaporvee opened this issue · 8 comments
Describe the bug
When i try to use discord.User.AvatarDecoration or AvatarDecorationURL() it returns null. When i tried it with postman directly on the api it seems that discord changed the json formatting for the user payload.
Error
The error which gets logged if there is any:
2024/04/07 20:30:59 ERROR recovered from panic in event listener name=bot_event_manager arg="runtime error: invalid memory address or nil pointer dereference" stack="goroutine 27 [running]:\nruntime/debug.Stack()\n\t/usr/local/go1.22.1.linux-amd64/src/runtime/debug/stack.go:24 +0x5e\ngithub.com/disgoorg/disgo/bot.(*eventManagerImpl).DispatchEvent.func1()\n\t/home/vaporvee/go/pkg/mod/github.com/disgoorg/disgo@v0.17.2/bot/event_manager.go:151 +0x8c\npanic({0x7dfdc0?, 0xbcd940?})\n\t/usr/local/go1.22.1.linux-amd64/src/runtime/panic.go:770 +0x132\nmain.init.func1(0xc0000000c0)\n\t/home/vaporvee/acecore/cmd_info.go:113 +0x514\nmain.applicationCommandInteractionCreate(0xc0000000c0)\n\t/home/vaporvee/acecore/handlers.go:74 +0x204\ngithub.com/disgoorg/disgo/bot.(*listenerFunc[...]).OnEvent(...)\n\t/home/vaporvee/go/pkg/mod/github.com/disgoorg/disgo@v0.17.2/bot/event_manager.go:64\ngithub.com/disgoorg/disgo/bot.(*eventManagerImpl).DispatchEvent(0xc00007a660, {0x9465d0, 0xc0000000c0})\n\t/home/vaporvee/go/pkg/mod/github.com/disgoorg/disgo@v0.17.2/bot/event_manager.go:170 +0x142\ngithub.com/disgoorg/disgo/handlers.handleInteraction({0x950a90, 0xc0000a3cc0}, 0x6, 0x0, 0x0, {0x94f530, 0xc0000b4370})\n\t/home/vaporvee/go/pkg/mod/github.com/disgoorg/disgo@v0.17.2/handlers/interaction_create_handler.go:43 +0x968\ngithub.com/disgoorg/disgo/handlers.gatewayHandlerInteractionCreate({0x950a90?, 0xc0000a3cc0?}, 0xc00045a2a8?, 0x7cfc40?, {{0x94f530?, 0xc0000b4370?}})\n\t/home/vaporvee/go/pkg/mod/github.com/disgoorg/disgo@v0.17.2/handlers/interaction_create_handler.go:16 +0x2f\ngithub.com/disgoorg/disgo/bot.(*genericGatewayEventHandler[...]).HandleGatewayEvent(0x418545?, {0x950a90?, 0xc0000a3cc0?}, 0xc000113320?, 0x100?, {0x948588?, 0xc0002fcb00?})\n\t/home/vaporvee/go/pkg/mod/github.com/disgoorg/disgo@v0.17.2/bot/event_manager.go:111 +0x4e\ngithub.com/disgoorg/disgo/bot.(*eventManagerImpl).HandleGatewayEvent(0xc00007a660, {0xc0002f63d8, 0x12}, 0x6, 0x0, {0x948588, 0xc0002fcb00})\n\t/home/vaporvee/go/pkg/mod/github.com/disgoorg/disgo@v0.17.2/bot/event_manager.go:136 +0x12c\ngithub.com/disgoorg/disgo/gateway.(*gatewayImpl).listen(0xc0001e2640, 0xc000133600)\n\t/home/vaporvee/go/pkg/mod/github.com/disgoorg/disgo@v0.17.2/gateway/gateway_impl.go:421 +0x16ef\ncreated by github.com/disgoorg/disgo/gateway.(*gatewayImpl).open in goroutine 1\n\t/home/vaporvee/go/pkg/mod/github.com/disgoorg/disgo@v0.17.2/gateway/gateway_impl.go:125 +0x453\n"
it panics obviously when i use the returned null value
To Reproduce
Steps to reproduce the behavior:
var user discord.User = e.SlashCommandInteractionData().User("user") // get the user from my slash command (other things work with that user value)
logrus.Debug(user.AvatarDecorationURL()) // returns null
logrus.Debug(user.AvatarDecorationURL()) // returns null too
Disgo Version(please complete the following information):
- Version [e.g. v0.8.3]
Additional context
Also AccentColor seems to be broken too.
a PR to fix this has already been created, but unfortunately we're waiting on Discord to merge the docs update (as always): #320
a PR to fix this has already been created, but unfortunately we're waiting on Discord to merge the docs update (as always): #320
whats the sense of waiting on docs pr? are you scared that someone will kill disgo because it includes undocumented features?
documentation changes that have yet to be merged are always subject to additional changes, whatever the reason might be
but whats about the accentcolor?
and btw i love how active the issues are
not sure what you're experiencing with accent color, can you give more details? ideally in our discord server so we stay on topic in this issue
The avatar decoration url has an .gif at the end wich breaks the url