1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-08 16:04:41 +00:00
arikawa/discord/guild_const.go

152 lines
4.2 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 (
"github.com/diamondburned/arikawa/utils/json/nullable"
)
// Guild.MaxPresences is 5000 when it's 0.
2020-01-04 04:19:24 +00:00
const DefaultMaxPresences = 5000
type NitroBoost uint8
const (
NoNitroLevel NitroBoost = iota
NitroLevel1
NitroLevel2
NitroLevel3
)
type MFALevel uint8
const (
NoMFA MFALevel = iota
ElevatedMFA
)
type GuildFeature string
const (
// Guild has access to set an invite splash background
InviteSplash GuildFeature = "INVITE_SPLASH"
// Guild has access to set 384kbps bitrate in voice (previously VIP voice
// servers)
VIPRegions GuildFeature = "VIP_REGIONS"
// Guild has access to set a vanity URL
VanityURL GuildFeature = "VANITY_URL"
// Guild is verified
Verified GuildFeature = "VERIFIED"
// Guild is partnered
Partnered GuildFeature = "PARTNERED"
// Guild is public
Public GuildFeature = "PUBLIC"
// Guild has access to use commerce features (i.e. create store channels)
Commerce GuildFeature = "COMMERCE"
// Guild has access to create news channels
News GuildFeature = "NEWS"
// Guild is able to be discovered in the directory
Discoverable GuildFeature = "DISCOVERABLE"
// Guild is able to be featured in the directory
Featurable GuildFeature = "FEATURABLE"
// Guild has access to set an animated guild icon
AnimatedIcon GuildFeature = "ANIMATED_ICON"
// Guild has access to set a guild banner image
Banner GuildFeature = "BANNER"
)
// ExplicitFilter is the explicit content filter level of a guild.
2020-05-11 02:30:34 +00:00
type ExplicitFilter nullable.Enum
2020-01-04 04:19:24 +00:00
var (
// NullExplicitFilter serialized to JSON null.
// This should only be used on nullable fields.
2020-05-11 02:30:34 +00:00
NullExplicitFilter ExplicitFilter = nullable.EnumNull
// NoContentFilter disables content filtering for the guild.
NoContentFilter ExplicitFilter = 0
// MembersWithoutRoles filters only members without roles.
MembersWithoutRoles ExplicitFilter = 1
// AllMembers enables content filtering for all members.
AllMembers ExplicitFilter = 2
2020-01-04 04:19:24 +00:00
)
func (f *ExplicitFilter) UnmarshalJSON(b []byte) error {
2020-05-11 02:30:34 +00:00
i, err := nullable.EnumFromJSON(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) {
return nullable.EnumToJSON(nullable.Enum(f)), nil
}
// Notification is the default message notification level of a guild.
2020-05-11 02:30:34 +00:00
type Notification nullable.Enum
var (
// NullNotification serialized to JSON null.
// This should only be used on nullable fields.
2020-05-11 02:30:34 +00:00
NullNotification Notification = nullable.EnumNull
// AllMessages sends notifications for all messages.
AllMessages Notification = 0
// OnlyMentions sends notifications only on mention.
OnlyMentions Notification = 1
2020-01-04 04:19:24 +00:00
)
func (n *Notification) UnmarshalJSON(b []byte) error {
2020-05-11 02:30:34 +00:00
i, err := nullable.EnumFromJSON(b)
*n = Notification(i)
2020-01-04 04:19:24 +00:00
return err
}
2020-05-11 02:30:34 +00:00
func (n Notification) MarshalJSON() ([]byte, error) { return nullable.EnumToJSON(nullable.Enum(n)), nil }
// Verification is the verification level required for a guild.
2020-05-11 02:30:34 +00:00
type Verification nullable.Enum
var (
// NullVerification serialized to JSON null.
// This should only be used on nullable fields.
2020-05-11 02:30:34 +00:00
NullVerification Verification = nullable.EnumNull
// NoVerification required no verification.
NoVerification Verification = 0
2020-01-04 04:19:24 +00:00
// LowVerification requires a verified email
LowVerification Verification = 1
2020-01-04 04:19:24 +00:00
// MediumVerification requires the user be registered for at least 5
// minutes.
MediumVerification Verification = 2
2020-01-04 04:19:24 +00:00
// HighVerification requires the member be in the server for more than 10
// minutes.
HighVerification Verification = 3
2020-01-04 04:19:24 +00:00
// VeryHighVerification requires the member to have a verified phone
// number.
VeryHighVerification Verification = 4
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 02:30:34 +00:00
i, err := nullable.EnumFromJSON(b)
*v = Verification(i)
return err
}
2020-05-11 02:30:34 +00:00
func (v Verification) MarshalJSON() ([]byte, error) { return nullable.EnumToJSON(nullable.Enum(v)), nil }
// Service is used for guild integrations and user connections.
type Service string
2020-01-06 03:48:39 +00:00
const (
Twitch Service = "twitch"
YouTube Service = "youtube"
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
var (
// RemoveRole removes the role of the subscriber.
RemoveRole ExpireBehavior = 0
// Kick kicks the subscriber from the guild.
Kick ExpireBehavior = 1
)