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

Add communication_disabled_until to GuildMemberParams #1214

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 2 additions & 0 deletions structs.go
Expand Up @@ -1699,6 +1699,8 @@ type GuildMemberParams struct {
Nick string `json:"nick,omitempty"`
// Array of role ids the member is assigned
Roles *[]string `json:"roles,omitempty"`
// Timeout user until as ISO8601 timestamp
CommunicationDisabledUntil string `json:"communication_disabled_until,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually use time.Time for timestamps.
Additionally this field must be both omittable and nullable (to unmute someone, a null value must be set).
There are two ways to implement that:

  • Custom MarshalJSON with *time.Time
  • NullTime type

NullTime might seem easier and more understandable, but it requires a lot of consideration, as we try to avoid helper types. MarshalJSON on other hand is easy to implement, and we've done that a few times, but might be weird to use for the user, as they would need to specify time.Time{} (zero'ed time) to unmute someone.

}

// An APIErrorMessage is an api error message returned from discord
Expand Down