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

Allow setting bool fields of ChannelEdit to false #1199

Merged
merged 1 commit into from Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions examples/threads/main.go
Expand Up @@ -48,9 +48,11 @@ func main() {
games[m.ChannelID] = time.Now()
<-time.After(timeout)
if time.Since(games[m.ChannelID]) >= timeout {
archived := true
locked := true
_, err := s.ChannelEditComplex(m.ChannelID, &discordgo.ChannelEdit{
Archived: true,
Locked: true,
Archived: &archived,
Locked: &locked,
})
if err != nil {
panic(err)
Expand Down
10 changes: 5 additions & 5 deletions structs.go
Expand Up @@ -360,7 +360,7 @@ func (c *Channel) IsThread() bool {
type ChannelEdit struct {
Name string `json:"name,omitempty"`
Topic string `json:"topic,omitempty"`
NSFW bool `json:"nsfw,omitempty"`
NSFW *bool `json:"nsfw,omitempty"`
Position int `json:"position"`
Bitrate int `json:"bitrate,omitempty"`
UserLimit int `json:"user_limit,omitempty"`
Expand All @@ -370,10 +370,10 @@ type ChannelEdit struct {

// NOTE: threads only

Archived bool `json:"archived,omitempty"`
AutoArchiveDuration int `json:"auto_archive_duration,omitempty"`
Locked bool `json:"locked,bool"`
Invitable bool `json:"invitable,omitempty"`
Archived *bool `json:"archived,omitempty"`
AutoArchiveDuration int `json:"auto_archive_duration,omitempty"`
Locked *bool `json:"locked,omitempty"`
Invitable *bool `json:"invitable,omitempty"`
}

// A ChannelFollow holds data returned after following a news channel
Expand Down