Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(UserGuilds): support with_counts parameter #1500

Merged
merged 7 commits into from
Mar 15, 2024
Merged

feat(UserGuilds): support with_counts parameter #1500

merged 7 commits into from
Mar 15, 2024

Conversation

hhaste
Copy link
Contributor

@hhaste hhaste commented Feb 27, 2024

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
Copy link
Contributor

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
Copy link
Contributor Author

hhaste commented Feb 28, 2024

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
Copy link
Contributor

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
Copy link
Collaborator

FedorLap2006 commented Mar 3, 2024

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.

restapi.go Outdated Show resolved Hide resolved
structs.go Outdated Show resolved Hide resolved
hhaste and others added 2 commits March 12, 2024 21:01
Co-authored-by: Fedor Lapshin <[email protected]>
Co-authored-by: Fedor Lapshin <[email protected]>
structs.go Outdated Show resolved Hide resolved
@FedorLap2006 FedorLap2006 changed the title Update UserGuilds() feat(UserGuilds): support with_counts parameter Mar 15, 2024
@FedorLap2006 FedorLap2006 merged commit 93cb440 into bwmarrin:master Mar 15, 2024
8 checks passed
FedorLap2006 added a commit that referenced this pull request Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants