Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions discord/guild.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,3 +384,8 @@ type GuildPrune struct {
type GuildPruneResult struct {
Pruned *int `json:"pruned"`
}

type GuildActiveThreads struct {
Threads []GuildThread `json:"threads"`
Members []ThreadMember `json:"members"`
}
1 change: 1 addition & 0 deletions rest/rest_endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ var (
GetPublicArchivedThreads = NewEndpoint(http.MethodGet, "/channels/{channel.id}/threads/archived/public")
GetPrivateArchivedThreads = NewEndpoint(http.MethodGet, "/channels/{channel.id}/threads/archived/private")
GetJoinedPrivateArchivedThreads = NewEndpoint(http.MethodGet, "/channels/{channel.id}/users/@me/threads/archived/private")
GetActiveGuildThreads = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/threads/active")
)

// Messages
Expand Down
6 changes: 6 additions & 0 deletions rest/threads.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type Threads interface {
GetPublicArchivedThreads(channelID snowflake.ID, before time.Time, limit int, opts ...RequestOpt) (threads *discord.GetThreads, err error)
GetPrivateArchivedThreads(channelID snowflake.ID, before time.Time, limit int, opts ...RequestOpt) (threads *discord.GetThreads, err error)
GetJoinedPrivateArchivedThreads(channelID snowflake.ID, before time.Time, limit int, opts ...RequestOpt) (threads *discord.GetThreads, err error)
GetActiveGuildThreads(guildID snowflake.ID, opts ...RequestOpt) (*discord.GuildActiveThreads, error)
}

type threadImpl struct {
Expand Down Expand Up @@ -133,6 +134,11 @@ func (s *threadImpl) GetJoinedPrivateArchivedThreads(channelID snowflake.ID, bef
return
}

func (s *threadImpl) GetActiveGuildThreads(guildID snowflake.ID, opts ...RequestOpt) (activeThreads *discord.GuildActiveThreads, err error) {
err = s.client.Do(GetActiveGuildThreads.Compile(nil, guildID), nil, &activeThreads, opts...)
return
}

func (s *threadImpl) getThreadMembers(threadID snowflake.ID, queryValues discord.QueryValues, opts ...RequestOpt) (threadMembers []discord.ThreadMember, err error) {
err = s.client.Do(GetThreadMembers.Compile(queryValues, threadID), nil, &threadMembers, opts...)
return
Expand Down