* added guild member timeouts * fix spelling error * Use time.Time, allow timeout removal Co-authored-by: Carson Hoffman <c@rsonhoffman.com>
@@ -903,6 +903,20 @@ func (s *Session) GuildMemberMute(guildID string, userID string, mute bool) (err
return
}
+// GuildMemberTimeout times out a guild member
+// guildID : The ID of a Guild.
+// userID : The ID of a User.
+// until : The timestamp for how long a member should be timed out.
+// Set to nil to remove timeout.
+func (s *Session) GuildMemberTimeout(guildID string, userID string, until *time.Time) (err error) {
+ data := struct {
+ CommunicationDisabledUntil *time.Time `json:"communication_disabled_until"`
+ }{until}
+
+ _, err = s.RequestWithBucketID("PATCH", EndpointGuildMember(guildID, userID), data, EndpointGuildMember(guildID, ""))
+ return
+}
// GuildMemberDeafen server deafens a guild member
// guildID : The ID of a Guild.
// userID : The ID of a User.
@@ -808,6 +808,10 @@ type Member struct {
// Total permissions of the member in the channel, including overrides, returned when in the interaction object.
Permissions int64 `json:"permissions,string"`
+ // The time at which the member's timeout will expire.
+ // Time in the past or nil if the user is not timed out.
// Mention creates a member mention
@@ -1296,6 +1300,7 @@ const (
PermissionViewAuditLogs = 0x0000000000000080
PermissionViewChannel = 0x0000000000000400
PermissionViewGuildInsights = 0x0000000000080000
+ PermissionModerateMembers = 0x0000010000000000
PermissionAllText = PermissionViewChannel |
PermissionSendMessages |