Add guild member timeouts (#1061)
* added guild member timeouts * fix spelling error * Use time.Time, allow timeout removal Co-authored-by: Carson Hoffman <c@rsonhoffman.com>
This commit is contained in:
parent
7c455ffc70
commit
29269347e8
2 changed files with 19 additions and 0 deletions
14
restapi.go
14
restapi.go
|
@ -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.
|
||||
CommunicationDisabledUntil *time.Time `json:"communication_disabled_until"`
|
||||
}
|
||||
|
||||
// Mention creates a member mention
|
||||
|
@ -1296,6 +1300,7 @@ const (
|
|||
PermissionViewAuditLogs = 0x0000000000000080
|
||||
PermissionViewChannel = 0x0000000000000400
|
||||
PermissionViewGuildInsights = 0x0000000000080000
|
||||
PermissionModerateMembers = 0x0000010000000000
|
||||
|
||||
PermissionAllText = PermissionViewChannel |
|
||||
PermissionSendMessages |
|
||||
|
|
Loading…
Reference in a new issue