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

Conversation

0xAozora
Copy link

@0xAozora 0xAozora commented Aug 1, 2022

This allows to timeout an user.

Closes #1213

@FedorLap2006 FedorLap2006 added the feature Feature implementation label Aug 1, 2022
@FedorLap2006 FedorLap2006 changed the title Added communication_disabled_until tag Add communication_disabled_until to GuildMemberParams Aug 1, 2022
@FedorLap2006 FedorLap2006 added this to the v0.26.0 milestone Aug 7, 2022
@@ -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.

@FedorLap2006 FedorLap2006 removed this from the v0.26.0 milestone Aug 15, 2022
@FedorLap2006
Copy link
Collaborator

Since GuildMemberParams had other unimplemented params and the communication_disabled_until needs custom marshalling for the null, I've decided to implement it all together in #1226. Therefore I'm going to close this PR.

@0xAozora
Copy link
Author

Cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Timeout User
2 participants