Skip to content

Commit

Permalink
add update endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Earlopain committed Aug 10, 2023
1 parent f245bdf commit 34f0fa5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
16 changes: 16 additions & 0 deletions restapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -3265,6 +3265,22 @@ func (s *Session) GuildOnboarding(guildID string, options ...RequestOption) (onb
return
}

// GuildOnboardingEdit edits Onboarding for a Guild.
// guildID : The ID of a Guild.
// o : A GuildOnboardingParams struct.
func (s *Session) GuildOnboardingEdit(guildID string, o *GuildOnboardingParams, options ...RequestOption) (onboarding *GuildOnboarding, err error) {
endpoint := EndpointGuildOnboarding(guildID)

var body []byte
body, err = s.RequestWithBucketID("PUT", endpoint, o, endpoint, options...)
if err != nil {
return
}

err = unmarshal(body, &onboarding)
return
}

// ----------------------------------------------------------------------
// Functions specific to auto moderation
// ----------------------------------------------------------------------
Expand Down
19 changes: 19 additions & 0 deletions structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,22 @@ type GuildOnboarding struct {
Mode GuildOnboardingMode `json:"mode"`
}

// GuildOnboardingParams stores all the data needed to update discord onboarding settings.
// https://discord.com/developers/docs/resources/guild#modify-guild-onboarding-json-params
type GuildOnboardingParams struct {
// Prompts shown during onboarding and in the Channel & Roles tab.
Prompts []GuildOnboardingPrompt `json:"prompts,omitempty"`

// Channel IDs that members get opted into automatically.
DefaultChannelIDs []string `json:"default_channel_ids,omitempty"`

// Whether onboarding is enabled.
Enabled *bool `json:"enabled,omitempty"`

// Mode of onboarding.
Mode GuildOnboardingMode `json:"mode,omitempty"`
}

// GuildOnboardingPrompt is a prompt shown during onboarding and in customize community.
// https://discord.com/developers/docs/resources/guild#guild-onboarding-object-onboarding-prompt-structure
type GuildOnboardingPrompt struct {
Expand Down Expand Up @@ -2442,6 +2458,9 @@ const (

ErrCodeCannotUpdateAFinishedEvent = 180000
ErrCodeFailedToCreateStageNeededForStageEvent = 180002

ErrCodeCannotEnableOnboardingRequirementsAreNotMet = 350000
ErrCodeCannotUpdateOnboardingWhileBelowRequirements = 350001
)

// Intent is the type of a Gateway Intent
Expand Down

0 comments on commit 34f0fa5

Please sign in to comment.