@@ -1727,10 +1727,57 @@ type UserGuildSettingsEdit struct {
1727
1727
// GuildMemberParams stores data needed to update a member
1728
1728
// https://discord.com/developers/docs/resources/guild#modify-guild-member
1729
1729
type GuildMemberParams struct {
1730
- // Value to set user's nickname to
1730
+ // Value to set user's nickname to.
1731
1731
Nick string `json:"nick,omitempty"`
1732
- // Array of role ids the member is assigned
1732
+ // Array of role ids the member is assigned.
1733
1733
Roles * []string `json:"roles,omitempty"`
1734
+ // ID of channel to move user to (if they are connected to voice).
1735
+ // Set to "" to remove user from a voice channel.
1736
+ ChannelID * string `json:"channel_id,omitempty"`
1737
+ // Whether the user is muted in voice channels.
1738
+ Mute * bool `json:"mute,omitempty"`
1739
+ // Whether the user is deafened in voice channels.
1740
+ Deaf * bool `json:"deaf,omitempty"`
1741
+ // When the user's timeout will expire and the user will be able
1742
+ // to communicate in the guild again (up to 28 days in the future).
1743
+ // Set to time.Time{} to remove timeout.
1744
+ CommunicationDisabledUntil * time.Time `json:"communication_disabled_until,omitempty"`
1745
+ }
1746
+
1747
+ // MarshalJSON is a helper function to marshal GuildMemberParams.
1748
+ func (p GuildMemberParams ) MarshalJSON () (res []byte , err error ) {
1749
+ type guildMemberParams GuildMemberParams
1750
+ v := struct {
1751
+ guildMemberParams
1752
+ ChannelID json.RawMessage `json:"channel_id,omitempty"`
1753
+ CommunicationDisabledUntil json.RawMessage `json:"communication_disabled_until,omitempty"`
1754
+ }{guildMemberParams : guildMemberParams (p )}
1755
+
1756
+ if p .ChannelID != nil {
1757
+ if * p .ChannelID == "" {
1758
+ v .ChannelID = json .RawMessage (`null` )
1759
+ } else {
1760
+ res , err = json .Marshal (p .ChannelID )
1761
+ if err != nil {
1762
+ return
1763
+ }
1764
+ v .ChannelID = res
1765
+ }
1766
+ }
1767
+
1768
+ if p .CommunicationDisabledUntil != nil {
1769
+ if p .CommunicationDisabledUntil .IsZero () {
1770
+ v .CommunicationDisabledUntil = json .RawMessage (`null` )
1771
+ } else {
1772
+ res , err = json .Marshal (p .CommunicationDisabledUntil )
1773
+ if err != nil {
1774
+ return
1775
+ }
1776
+ v .CommunicationDisabledUntil = res
1777
+ }
1778
+ }
1779
+
1780
+ return json .Marshal (v )
1734
1781
}
1735
1782
1736
1783
// An APIErrorMessage is an api error message returned from discord
0 commit comments