mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-12-08 04:57:19 +00:00
Compare commits
4 commits
5287f0c177
...
7705eda93a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7705eda93a | ||
|
|
a891a653eb | ||
|
|
43b5c9dcad | ||
|
|
29f0a1ac5b |
|
|
@ -644,3 +644,59 @@ func (c *Client) JoinedPrivateArchivedThreadsBefore(
|
|||
before discord.Timestamp, limit uint) (*ArchivedThreads, error) {
|
||||
return c.JoinedPrivateArchivedThreads(channelID, before, limit)
|
||||
}
|
||||
|
||||
type ThreadTagSetting string
|
||||
|
||||
const (
|
||||
MatchSome ThreadTagSetting = "match_some"
|
||||
MatchAll ThreadTagSetting = "all"
|
||||
)
|
||||
|
||||
type ThreadSortBy string
|
||||
|
||||
const (
|
||||
LastMessageTime ThreadSortBy = "last_message_time"
|
||||
ArchiveTime ThreadSortBy = "archive_time"
|
||||
Relevance ThreadSortBy = "relevance"
|
||||
CreationTime ThreadSortBy = "creation_time"
|
||||
)
|
||||
|
||||
type ThreadSortOrder string
|
||||
|
||||
const (
|
||||
SortAscending ThreadSortOrder = "asc"
|
||||
SortDescending ThreadSortOrder = "desc"
|
||||
)
|
||||
|
||||
type (
|
||||
SearchThreadsData struct {
|
||||
Name string `schema:"name,omitempty"`
|
||||
Slop int `schema:"slop,omitempty"`
|
||||
Tag []discord.Snowflake `schema:"tag,omitempty"`
|
||||
TagSetting ThreadTagSetting `schema:"tag_setting,omitempty"`
|
||||
Archived bool `schema:"archived,omitempty"`
|
||||
SortOrder ThreadSortOrder `schema:"sort_order,omitempty"`
|
||||
SortBy ThreadSortBy `schema:"sort_by,omitempty"`
|
||||
Limit int `schema:"limit,omitempty"`
|
||||
MaxID discord.Snowflake `schema:"max_id,omitempty"`
|
||||
MinID discord.Snowflake `schema:"min_id,omitempty"`
|
||||
Offset int `schema:"offset,omitempty"`
|
||||
}
|
||||
|
||||
SearchThreadsResponse struct {
|
||||
Threads []discord.Channel `json:"threads"`
|
||||
Members []discord.ThreadMember `json:"members"`
|
||||
HasMore bool `json:"has_more"`
|
||||
TotalResults int `json:"total_results"`
|
||||
FirstMessages []discord.Message `json:"first_messages,omitempty"`
|
||||
}
|
||||
)
|
||||
|
||||
func (c *Client) SearchThreads(channelID discord.ChannelID, data SearchThreadsData) (SearchThreadsResponse, error) {
|
||||
var resp SearchThreadsResponse
|
||||
return resp, c.RequestJSON(
|
||||
&resp, "GET",
|
||||
EndpointChannels+channelID.String()+"/threads/search",
|
||||
httputil.WithSchema(c, data),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,15 +142,16 @@ func (g Guild) IconURLWithType(t ImageType) string {
|
|||
}
|
||||
|
||||
// BannerURL returns the URL to the banner, which is the image on top of the
|
||||
// channels list. This will always return a link to a PNG file.
|
||||
// channels list. Auto detects a suitable image type. An empty string is
|
||||
// returned if the guild has no banner.
|
||||
func (g Guild) BannerURL() string {
|
||||
return g.BannerURLWithType(PNGImage)
|
||||
return g.BannerURLWithType(AutoImage)
|
||||
}
|
||||
|
||||
// BannerURLWithType returns the URL to the banner, which is the image on top
|
||||
// of the channels list using the passed image type.
|
||||
//
|
||||
// Supported ImageTypes: PNG, JPEG, WebP
|
||||
// Supported ImageTypes: PNG, JPEG, WebP, GIF
|
||||
func (g Guild) BannerURLWithType(t ImageType) string {
|
||||
if g.Banner == "" {
|
||||
return ""
|
||||
|
|
|
|||
Loading…
Reference in a new issue