Skip to content

Commit

Permalink
check optional values like before
Browse files Browse the repository at this point in the history
  • Loading branch information
sebm253 committed Mar 20, 2024
1 parent 49c6925 commit 7d24eb0
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions oauth2/client_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,23 @@ func (c *clientImpl) GenerateAuthorizationURL(params AuthorizationURLParams) str
func (c *clientImpl) GenerateAuthorizationURLState(params AuthorizationURLParams) (string, string) {
state := c.StateController().NewState(params.RedirectURI)
values := discord.QueryValues{
"client_id": c.id,
"redirect_uri": params.RedirectURI,
"response_type": "code",
"scope": discord.JoinScopes(params.Scopes),
"state": state,
"permissions": params.Permissions,
"disable_guild_select": params.DisableGuildSelect,
"integration_type": params.IntegrationType,
"client_id": c.id,
"redirect_uri": params.RedirectURI,
"response_type": "code",
"scope": discord.JoinScopes(params.Scopes),
"state": state,
"integration_type": params.IntegrationType,
}

if params.Permissions != discord.PermissionsNone {
values["permissions"] = params.Permissions
}
if params.GuildID != 0 {
values["guild_id"] = params.GuildID
}
if params.DisableGuildSelect {
values["disable_guild_select"] = true
}
return discord.AuthorizeURL(values), state
}

Expand Down

0 comments on commit 7d24eb0

Please sign in to comment.