Skip to content

Commit c583d98

Browse files
committed
feat: Define main Guild object and various definitions around it
1 parent 33ec4a2 commit c583d98

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

guild.go

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,88 @@ type UnavailableGuild struct {
55
ID Snowflake `json:"id"`
66
Unavailable bool `json:"unavailable"`
77
}
8+
9+
// https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
10+
type MessageNotificationLevel uint8
11+
12+
const (
13+
ALL_MESSAGES_NOTIFICATION_LEVEL MessageNotificationLevel = iota
14+
ONLY_MENTIONS_NOTIFICATION_LEVEL
15+
)
16+
17+
// https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level
18+
type ExplicitContentFilter uint8
19+
20+
const (
21+
DISABLED_CONTENT_FILTER ExplicitContentFilter = iota
22+
MEMBERS_WITHOUT_ROLES_CONTENT_FILTER
23+
ALL_MEMBERS_CONTENT_FILTER
24+
)
25+
26+
// https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
27+
type MFALevel uint8
28+
29+
const (
30+
NONE_MFA_LEVEL MFALevel = iota
31+
ELEVATED_MFA_LEVEL
32+
)
33+
34+
// https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags
35+
type SystemChannelFlags BitSet
36+
37+
const (
38+
SUPPRESS_JOIN_NOTIFICATIONS_SYSTEM_FLAG = 1 << iota
39+
SUPPRESS_PREMIUM_SUBSCRIPTIONS_SYSTEM_FLAG
40+
SUPPRESS_GUILD_REMINDER_NOTIFICATIONS_SYSTEM_FLAG
41+
SUPPRESS_JOIN_NOTIFICATION_REPLIES_SYSTEM_FLAG
42+
SUPPRESS_ROLE_SUBSCRIPTION_PURCHASE_NOTIFICATIONS_SYSTEM_FLAG
43+
SUPPRESS_ROLE_SUBSCRIPTION_PURCHASE_NOTIFICATION_REPLIES_SYSTEM_FLAG
44+
)
45+
46+
// https://discord.com/developers/docs/resources/guild#guild-object-premium-tier
47+
type PremiumTier uint8
48+
49+
const (
50+
NONE_PREMIUM_TIER PremiumTier = iota
51+
BOOST_1_PREMIUM_TIER
52+
BOOST_2_PREMIUM_TIER
53+
BOOST_3_PREMIUM_TIER
54+
)
55+
56+
// https://discord.com/developers/docs/resources/guild#guild-object-guild-structure
57+
type Guild struct {
58+
ID Snowflake `json:"id"`
59+
Name string `json:"name"`
60+
AvatarHash string `json:"icon,omitempty"` // Hash code used to access guild's icon. Call Guild.IconURL to get direct url.
61+
SplashHash string `json:"splash,omitempty"` // Hash code used to access guild's splash background. Call Guild.SplashURL to get direct url.
62+
DiscoverySplashHash string `json:"discovery_splash,omitempty"` // Hash code used to access guild's special discovery splash background (only available for "DISCOVERABLE" guilds). Call Guild.DiscoverySplashURL to get direct url.
63+
OwnerID Snowflake `json:"owner_id"`
64+
AFKChannelID Snowflake `json:"afk_channel_id,omitempty"`
65+
AFKChannelTimeout uint32 `json:"afk_timeout"` // AFK timeout value in seconds.
66+
WidgetEnabled bool `json:"widget_enabled"` // Whether server uses widget.
67+
WidgetChannelID Snowflake `json:"widget_channel_id,omitempty"` // The channel ID that the widget will generate an invite to, or null if set to no invite.
68+
DefaultMessageNotifications MessageNotificationLevel `json:"default_message_notifications"`
69+
ExplicitContentFilter ExplicitContentFilter `json:"explicit_content_filter"`
70+
Roles []Role `json:"roles,omitzero"`
71+
Emojis []Emoji `json:"emojis,omitzero"`
72+
Features []string `json:"features,omitzero"` // // https://discord.com/developers/docs/resources/guild#guild-object-guild-features
73+
MFALevel MFALevel `json:"mfa_level"`
74+
ApplicationID Snowflake `json:"application_id,omitempty"` // Application id of the guild creator if it is bot-created (never seen it in use).
75+
SystemChannelID Snowflake `json:"system_channel_id,omitempty"`
76+
SystemChannelFlags SystemChannelFlags `json:"system_channel_flags"`
77+
RulesChannelID Snowflake `json:"rules_channel_id,omitempty"`
78+
MaxPresences uint32 `json:"max_presences,omitempty"` // The maximum number of presences for the guild (null is always returned, apart from the largest of guilds).
79+
MaxMembers uint32 `json:"max_members,omitempty"`
80+
VanityURL string `json:"vanity_url_code,omitempty"`
81+
Description string `json:"description,omitempty"`
82+
BannerHash string `json:"banner,omitempty"` // Hash code used to access guild's icon. Call Guild.BannerURL to get direct url.
83+
PremiumTier PremiumTier `json:"premium_tier"`
84+
PremiumSubscriptionCount uint32 `json:"premium_subscription_count,omitempty"` // The number of boosts this guild currently has.
85+
PrefferedLocale string `json:"preferred_locale,omitempty"`
86+
87+
// Some fields were ignored on purpose as they are random junk...
88+
89+
ApproximateMemberCount uint32 `json:"approximate_member_count,omitempty"`
90+
ApproximatePresenceCount uint32 `json:"approximate_presence_count,omitempty"`
91+
PremiumProgressBarEnabled bool `json:"premium_progress_bar_enabled"`
92+
}

0 commit comments

Comments
 (0)