Open riking opened 4 years ago
I wrote a small program that logs the response headers to prove this: https://github.com/riking/AutoDelete/blob/master/cmd/pinsHeaders.go
It consistently prints "X-Ratelimit-Bucket: 29438e9be9d5f3f082da200ec5a36e41" no matter what channel I request, plus:
X-Ratelimit-Limit: 1
X-Ratelimit-Remaining: 0
X-Ratelimit-Reset: <timestamp in near future>
X-Ratelimit-Reset-After: 5
This is the code currently in use:
body, err = c.bot.s.RequestWithBucketID("GET", discordgo.EndpointChannelMessagesPins(c.ChannelID), nil, "/custom/pinsGlobal")
The ChannelMessagesPinned function uses
EndpointChannelMessagesPins(channelID)
as its ratelimit bucket. https://github.com/bwmarrin/discordgo/blob/8416350/restapi.go#L1693This is incorrect. The ratelimit for pins requests is shared across all channels and guilds.
I recommend replacing the bucket with a constant of "/pins/global".