mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-12-10 22:16:33 +00:00
Compare commits
5 commits
0da6616ae8
...
5287f0c177
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5287f0c177 | ||
|
|
374d28cbf6 | ||
|
|
c3dc0bc002 | ||
|
|
3a8d18dcb7 | ||
|
|
29f0a1ac5b |
|
|
@ -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
|
// 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 {
|
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
|
// BannerURLWithType returns the URL to the banner, which is the image on top
|
||||||
// of the channels list using the passed image type.
|
// 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 {
|
func (g Guild) BannerURLWithType(t ImageType) string {
|
||||||
if g.Banner == "" {
|
if g.Banner == "" {
|
||||||
return ""
|
return ""
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,31 @@ type (
|
||||||
IdentifyProperties map[IdentifyPropertyKey]any
|
IdentifyProperties map[IdentifyPropertyKey]any
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// https://docs.discord.food/topics/gateway#gateway-capabilities
|
||||||
|
type Capabilities uint
|
||||||
|
|
||||||
|
const (
|
||||||
|
LazyUserNotes Capabilities = 1 << iota
|
||||||
|
NoAffineUserIDs
|
||||||
|
VersionedReadStates
|
||||||
|
VersionedUserGuildSetttings
|
||||||
|
DedupeUserObjects
|
||||||
|
// Requires DedupeUserObjects
|
||||||
|
PrioritizedReadyPayload
|
||||||
|
MultipleGuildExperimentPopulations
|
||||||
|
NonChannelReadStates
|
||||||
|
AuthTokenRefresh
|
||||||
|
UserSettingsProto
|
||||||
|
ClientStateV2
|
||||||
|
PassiveGuildUpdate
|
||||||
|
AutoCallConnect
|
||||||
|
DebounceMessageReactions
|
||||||
|
// Supersedes PassiveGuildUpdate
|
||||||
|
PassiveGuildUpdateV2
|
||||||
|
_
|
||||||
|
AutoLobbyConnect
|
||||||
|
)
|
||||||
|
|
||||||
// IdentifyCommand is a command for Op 2. It is the struct for a data that's
|
// IdentifyCommand is a command for Op 2. It is the struct for a data that's
|
||||||
// sent over in an Identify command.
|
// sent over in an Identify command.
|
||||||
type IdentifyCommand struct {
|
type IdentifyCommand struct {
|
||||||
|
|
@ -132,8 +157,7 @@ type IdentifyCommand struct {
|
||||||
|
|
||||||
// Capabilities defines the client's capabilities when connecting to the
|
// Capabilities defines the client's capabilities when connecting to the
|
||||||
// gateway with a user account. Bot accounts should NOT touch this field.
|
// gateway with a user account. Bot accounts should NOT touch this field.
|
||||||
// The official client sets this at 125 at the time of this commit.
|
Capabilities Capabilities `json:"capabilities,omitempty"`
|
||||||
Capabilities int `json:"capabilities,omitempty"`
|
|
||||||
// Intents specifies which groups of events the gateway
|
// Intents specifies which groups of events the gateway
|
||||||
// connection will receive.
|
// connection will receive.
|
||||||
//
|
//
|
||||||
|
|
@ -142,7 +166,7 @@ type IdentifyCommand struct {
|
||||||
// For bot accounts, it must not be nil, and
|
// For bot accounts, it must not be nil, and
|
||||||
// Gateway.AddIntents(0) can be used if you want to
|
// Gateway.AddIntents(0) can be used if you want to
|
||||||
// specify no intents.
|
// specify no intents.
|
||||||
Intents option.Uint `json:"intents"`
|
Intents option.Uint `json:"intents,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultIdentifyCommand creates a default IdentifyCommand with the given token.
|
// DefaultIdentifyCommand creates a default IdentifyCommand with the given token.
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,12 @@ type Client struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewClient() *Client {
|
func NewClient() *Client {
|
||||||
|
return NewClientWithDriver(httpdriver.NewClient())
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewClientWithDriver(driver httpdriver.Client) *Client {
|
||||||
return &Client{
|
return &Client{
|
||||||
Client: httpdriver.NewClient(),
|
Client: driver,
|
||||||
SchemaEncoder: &DefaultSchema{},
|
SchemaEncoder: &DefaultSchema{},
|
||||||
Retries: Retries,
|
Retries: Retries,
|
||||||
context: context.Background(),
|
context: context.Background(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue