1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2025-12-08 12:58:17 +00:00

Compare commits

...

4 commits

Author SHA1 Message Date
Scott 0da6616ae8
Merge 29f0a1ac5b into eabc1be595 2025-09-08 08:38:21 -07:00
Ayyan eabc1be595
discord: Fix SystemChannelFlags type
* fix(discord): modify internal type of SystemChannelFlags to uint16
* feat(discord): add new consts to SystemChannelFlags type
2025-09-03 23:44:07 -07:00
Ayyan e93079e2de
gateway!: Add ability to set custom identify properties (#483)
* feat(gateway): add {Bot,User}IdentifyProperties
* refactor(gateway): rename BotIdentifyProperties to BasicIdentifyProperties
* feat(gateway): use hash map for IdentifyProperties

this is a breaking change.
2025-09-03 18:59:50 -07:00
twoscott 29f0a1ac5b discord: Support GIF banner URLs 2025-03-26 21:37:18 +00:00
3 changed files with 27 additions and 27 deletions

View file

@ -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 ""

View file

@ -29,7 +29,7 @@ const (
ElevatedMFA
)
type SystemChannelFlags uint8
type SystemChannelFlags uint16
// https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags
const (
@ -37,6 +37,14 @@ const (
SuppressJoinNotifications SystemChannelFlags = 1 << iota
// SuppressPremiumSubscriptions suppresses server boost notifications.
SuppressPremiumSubscriptions
// SuppressGuildReminderNotifications suppresses server setup tips.
SuppressGuildReminderNotifications
// SuppressJoinNotificationReplies hides member join sticker reply buttons.
SuppressJoinNotificationReplies
// SuppressRoleSubscriptionPurchaseNotifications suppresses role subscription purchase and renewal notifications.
SuppressRoleSubscriptionPurchaseNotifications
// SuppressRoleSubscriptionPurchaseNotificationReplies hides role subscription sticker reply buttons.
SuppressRoleSubscriptionPurchaseNotificationReplies
)
type GuildFeature string

View file

@ -94,14 +94,25 @@ func (id *Identifier) QueryGateway(ctx context.Context) (gatewayURL string, err
return
}
const (
IdentifyOS IdentifyPropertyKey = "os"
IdentifyBrowser IdentifyPropertyKey = "browser"
IdentifyDevice IdentifyPropertyKey = "device"
)
// DefaultIdentity is used as the default identity when initializing a new
// Gateway.
var DefaultIdentity = IdentifyProperties{
OS: runtime.GOOS,
Browser: "Arikawa",
Device: "Arikawa",
IdentifyOS: runtime.GOOS,
IdentifyBrowser: "Arikawa",
IdentifyDevice: "Arikawa",
}
type (
IdentifyPropertyKey string
IdentifyProperties map[IdentifyPropertyKey]any
)
// IdentifyCommand is a command for Op 2. It is the struct for a data that's
// sent over in an Identify command.
type IdentifyCommand struct {
@ -176,26 +187,6 @@ func (i *IdentifyCommand) HasIntents(intents Intents) bool {
return Intents(*i.Intents).Has(intents)
}
type IdentifyProperties struct {
// Required
OS string `json:"os"` // GOOS
Browser string `json:"browser"` // Arikawa
Device string `json:"device"` // Arikawa
// Optional (not applicable to bots)
ClientBuildNumber int `json:"client_build_number,omitempty"`
BrowserUserAgent string `json:"browser_user_agent,omitempty"`
BrowserVersion string `json:"browser_version,omitempty"`
OSVersion string `json:"os_version,omitempty"`
Referrer string `json:"referrer,omitempty"`
ReferrerCurrent string `json:"referrer_current,omitempty"`
ReferrerDomainCurrent string `json:"referrer_domain_current,omitempty"`
ReferringDomain string `json:"referring_domain,omitempty"`
ReleaseChannel string `json:"release_channel,omitempty"`
SystemLocale discord.Language `json:"system_locale,omitempty"`
HasClientMods bool `json:"has_client_mods,omitempty"`
}
// Shard is a type for two numbers that represent the Bot's shard configuration.
// The first number is the shard's ID, which could be obtained through the
// ShardID method. The second number is the total number of shards, which could