bwmarrin / discordgo

(Golang) Go bindings for Discord
BSD 3-Clause "New" or "Revised" License
5.11k stars 816 forks source link

feat(UserGuilds): support with_counts parameter #1500

Closed hhaste closed 8 months ago

hhaste commented 9 months ago

This PR adds support for the with_count query parameter on the UserGuilds() function.

Additionally, the limit of returned guilds has been increased from 100 to 200.

Reference: https://discord.com/developers/docs/resources/user#get-current-user-guilds

Earlopain commented 9 months ago

I think it would be better to add a new method UserGuildsWithCounts to not break current code. The old method can then just dispatch to the new one. Sad that go doesn't have default args...

You could also update struct member docs for ApproximateMemberCount and ApproximatePresenceCount since that doesn't currently mention this new way to obtain the information. Should probably switch that over to the methods you can call in discordgo for this instead of the verbatim copy from the discord api docs.

hhaste commented 9 months ago

I think it would be better to add a new method UserGuildsWithCounts to not break current code. The old method can then just dispatch to the new one.

@Earlopain There would be no withCounts argument on the UserGuildsWithCounts function, so having the old method dispatch to the new one wouldn't work. I could still make a new method for it, but it would just be a duplicate of the old code except passing the with_counts query which felt redundant.

Earlopain commented 9 months ago

Oh, right. Tbh, I don't know how this is usually handled, I haven't been around here for very long. @FedorLap2006 should be able to give some input there.

FedorLap2006 commented 8 months ago

I think there is no point in introducing a separate function for withCounts parameter. While yes, this would be a breaking change, this would be better than having two almost identical functions, with the only difference being that parameter.