1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-16 03:44:26 +00:00
arikawa/discord/guild_consts.go

181 lines
5.6 KiB
Go
Raw Normal View History

2020-01-04 04:19:24 +00:00
package discord
2020-05-11 02:30:34 +00:00
import (
2021-06-02 02:53:19 +00:00
"github.com/diamondburned/arikawa/v3/utils/json/enum"
2020-05-11 02:30:34 +00:00
)
2020-05-22 12:02:18 +00:00
// Guild.MaxPresences is this value when it's 0.
// This happens because the Discord API sends JSON null, if the MaxPresences
// reach DefaultMaxPresences, which in turn will be serialized into 0.
const DefaultMaxPresences = 25000
2020-01-04 04:19:24 +00:00
2020-05-22 12:02:18 +00:00
// NitroBoost is the premium tier (Server Boost level).
2020-01-04 04:19:24 +00:00
type NitroBoost uint8
2020-05-22 12:02:18 +00:00
// https://discord.com/developers/docs/resources/guild#guild-object-premium-tier
2020-01-04 04:19:24 +00:00
const (
NoNitroLevel NitroBoost = iota
NitroLevel1
NitroLevel2
NitroLevel3
)
2020-05-22 12:02:18 +00:00
// MFALevel is the required MFA level for a guild.
2020-01-04 04:19:24 +00:00
type MFALevel uint8
2020-05-22 12:02:18 +00:00
// https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
2020-01-04 04:19:24 +00:00
const (
NoMFA MFALevel = iota
ElevatedMFA
)
2020-05-22 12:02:18 +00:00
type SystemChannelFlags uint8
// https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags
const (
// SuppressJoinNotifications suppresses member join notifications.
SuppressJoinNotifications SystemChannelFlags = 1 << iota
// SuppressPremiumSubscriptions suppresses server boost notifications.
SuppressPremiumSubscriptions
)
2020-01-04 04:19:24 +00:00
type GuildFeature string
2020-05-22 12:02:18 +00:00
// https://discord.com/developers/docs/resources/guild#guild-object-guild-features
2020-01-04 04:19:24 +00:00
const (
2020-05-22 12:02:18 +00:00
// InviteSplash is set, if the guild has access to set an invite splash
// background.
2020-01-04 04:19:24 +00:00
InviteSplash GuildFeature = "INVITE_SPLASH"
2020-05-22 12:02:18 +00:00
// VIPRegions is set, if the guild has access to set 384kbps bitrate in
// voice (previously VIP voice servers).
2020-01-04 04:19:24 +00:00
VIPRegions GuildFeature = "VIP_REGIONS"
2020-05-22 12:02:18 +00:00
// VanityURL is set, if the guild has access to set a vanity URL.
2020-01-04 04:19:24 +00:00
VanityURL GuildFeature = "VANITY_URL"
2020-05-22 12:02:18 +00:00
// Verified is set, if the guild is verified.
2020-01-04 04:19:24 +00:00
Verified GuildFeature = "VERIFIED"
2020-05-22 12:02:18 +00:00
// Partnered is set, if the guild is partnered.
2020-01-04 04:19:24 +00:00
Partnered GuildFeature = "PARTNERED"
2020-05-22 12:02:18 +00:00
// Public is set, if the guild is public.
2020-01-04 04:19:24 +00:00
Public GuildFeature = "PUBLIC"
2020-05-22 12:02:18 +00:00
// Commerce is set, if the guild has access to use commerce features
// (i.e. create store channels).
2020-01-04 04:19:24 +00:00
Commerce GuildFeature = "COMMERCE"
2020-05-22 12:02:18 +00:00
// News is set, if the guild has access to create news channels.
2020-01-04 04:19:24 +00:00
News GuildFeature = "NEWS"
2020-05-22 12:02:18 +00:00
// Discoverable is set, if the guild is able to be discovered in the
// directory.
2020-01-04 04:19:24 +00:00
Discoverable GuildFeature = "DISCOVERABLE"
2020-05-22 12:02:18 +00:00
// Featurable is set, if the guild is able to be featured in the directory.
2020-01-04 04:19:24 +00:00
Featurable GuildFeature = "FEATURABLE"
2020-05-22 12:02:18 +00:00
// AnimatedIcon is set, if the guild has access to set an animated guild
// icon.
2020-01-04 04:19:24 +00:00
AnimatedIcon GuildFeature = "ANIMATED_ICON"
2020-05-22 12:02:18 +00:00
// Banner is set, if the guild has access to set a guild banner image.
2020-01-04 04:19:24 +00:00
Banner GuildFeature = "BANNER"
)
// ExplicitFilter is the explicit content filter level of a guild.
2020-05-11 20:43:52 +00:00
type ExplicitFilter enum.Enum
2020-01-04 04:19:24 +00:00
// NullExplicitFilter serialized to JSON null.
// This should only be used on nullable fields.
const NullExplicitFilter ExplicitFilter = enum.Null
2020-05-22 12:02:18 +00:00
// https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level
const (
// NoContentFilter disables content filtering for the guild.
NoContentFilter ExplicitFilter = iota
// MembersWithoutRoles filters only members without roles.
MembersWithoutRoles
// AllMembers enables content filtering for all members.
AllMembers
2020-01-04 04:19:24 +00:00
)
func (f *ExplicitFilter) UnmarshalJSON(b []byte) error {
2020-05-11 20:43:52 +00:00
i, err := enum.FromJSON(b)
*f = ExplicitFilter(i)
2020-01-04 04:19:24 +00:00
return err
}
2020-05-11 02:30:34 +00:00
func (f ExplicitFilter) MarshalJSON() ([]byte, error) {
2020-05-11 20:43:52 +00:00
return enum.ToJSON(enum.Enum(f)), nil
2020-05-11 02:30:34 +00:00
}
// Notification is the default message notification level of a guild.
2020-05-11 20:43:52 +00:00
type Notification enum.Enum
// NullNotification serialized to JSON null.
// This should only be used on nullable fields.
const NullNotification Notification = enum.Null
2020-05-22 12:02:18 +00:00
// https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
const (
// AllMessages sends notifications for all messages.
AllMessages Notification = iota
// OnlyMentions sends notifications only on mention.
OnlyMentions
2020-01-04 04:19:24 +00:00
)
func (n *Notification) UnmarshalJSON(b []byte) error {
2020-05-11 20:43:52 +00:00
i, err := enum.FromJSON(b)
*n = Notification(i)
2020-01-04 04:19:24 +00:00
return err
}
2020-05-11 20:43:52 +00:00
func (n Notification) MarshalJSON() ([]byte, error) { return enum.ToJSON(enum.Enum(n)), nil }
// Verification is the verification level required for a guild.
2020-05-11 20:43:52 +00:00
type Verification enum.Enum
// NullVerification serialized to JSON null.
// This should only be used on nullable fields.
const NullVerification Verification = enum.Null
2020-05-22 12:02:18 +00:00
// https://discord.com/developers/docs/resources/guild#guild-object-verification-level
const (
// NoVerification required no verification.
NoVerification Verification = iota
2020-01-04 04:19:24 +00:00
// LowVerification requires a verified email
LowVerification
2020-01-04 04:19:24 +00:00
// MediumVerification requires the user be registered for at least 5
// minutes.
MediumVerification
2020-01-04 04:19:24 +00:00
// HighVerification requires the member be in the server for more than 10
// minutes.
HighVerification
2020-01-04 04:19:24 +00:00
// VeryHighVerification requires the member to have a verified phone
// number.
VeryHighVerification
2020-01-04 04:19:24 +00:00
)
2020-01-06 03:48:39 +00:00
func (v *Verification) UnmarshalJSON(b []byte) error {
2020-05-11 20:43:52 +00:00
i, err := enum.FromJSON(b)
*v = Verification(i)
return err
}
2020-05-11 20:43:52 +00:00
func (v Verification) MarshalJSON() ([]byte, error) { return enum.ToJSON(enum.Enum(v)), nil }
// Service is used for guild integrations and user connections.
type Service string
2020-01-06 03:48:39 +00:00
const (
TwitchService Service = "twitch"
YouTubeService Service = "youtube"
DiscordService Service = "discord"
2020-01-06 03:48:39 +00:00
)
// ExpireBehavior is the integration expire behavior that regulates what happens, if a subscriber expires.
type ExpireBehavior uint8
2020-05-22 12:02:18 +00:00
// https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors
const (
// RemoveRole removes the role of the subscriber.
RemoveRole ExpireBehavior = iota
// Kick kicks the subscriber from the guild.
Kick
)