2020-01-04 04:19:24 +00:00
|
|
|
package discord
|
|
|
|
|
2020-05-11 02:30:34 +00:00
|
|
|
import (
|
2020-05-11 20:43:52 +00:00
|
|
|
"github.com/diamondburned/arikawa/utils/json/enum"
|
2020-05-11 02:30:34 +00:00
|
|
|
)
|
2020-05-11 01:26:46 +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"
|
|
|
|
)
|
|
|
|
|
2020-05-11 01:26:46 +00:00
|
|
|
// 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
|
|
|
|
2020-05-22 12:02:18 +00:00
|
|
|
// https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level
|
2020-05-11 01:26:46 +00:00
|
|
|
var (
|
|
|
|
// NullExplicitFilter serialized to JSON null.
|
|
|
|
// This should only be used on nullable fields.
|
2020-05-11 20:43:52 +00:00
|
|
|
NullExplicitFilter ExplicitFilter = enum.Null
|
2020-05-11 01:26:46 +00:00
|
|
|
// 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
|
|
|
)
|
|
|
|
|
2020-05-11 01:26:46 +00:00
|
|
|
func (f *ExplicitFilter) UnmarshalJSON(b []byte) error {
|
2020-05-11 20:43:52 +00:00
|
|
|
i, err := enum.FromJSON(b)
|
2020-05-11 01:26:46 +00:00
|
|
|
*f = ExplicitFilter(i)
|
2020-01-04 04:19:24 +00:00
|
|
|
|
2020-05-11 01:26:46 +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
|
|
|
}
|
2020-05-11 01:26:46 +00:00
|
|
|
|
|
|
|
// Notification is the default message notification level of a guild.
|
2020-05-11 20:43:52 +00:00
|
|
|
type Notification enum.Enum
|
2020-05-11 01:26:46 +00:00
|
|
|
|
2020-05-22 12:02:18 +00:00
|
|
|
// https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
|
2020-05-11 01:26:46 +00:00
|
|
|
var (
|
|
|
|
// NullNotification serialized to JSON null.
|
|
|
|
// This should only be used on nullable fields.
|
2020-05-11 20:43:52 +00:00
|
|
|
NullNotification Notification = enum.Null
|
2020-05-11 01:26:46 +00:00
|
|
|
// 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
|
|
|
)
|
|
|
|
|
2020-05-11 01:26:46 +00:00
|
|
|
func (n *Notification) UnmarshalJSON(b []byte) error {
|
2020-05-11 20:43:52 +00:00
|
|
|
i, err := enum.FromJSON(b)
|
2020-05-11 01:26:46 +00:00
|
|
|
*n = Notification(i)
|
2020-01-04 04:19:24 +00:00
|
|
|
|
2020-05-11 01:26:46 +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 }
|
2020-05-11 01:26:46 +00:00
|
|
|
|
|
|
|
// Verification is the verification level required for a guild.
|
2020-05-11 20:43:52 +00:00
|
|
|
type Verification enum.Enum
|
2020-05-11 01:26:46 +00:00
|
|
|
|
2020-05-22 12:02:18 +00:00
|
|
|
// https://discord.com/developers/docs/resources/guild#guild-object-verification-level
|
2020-05-11 01:26:46 +00:00
|
|
|
var (
|
|
|
|
// NullVerification serialized to JSON null.
|
|
|
|
// This should only be used on nullable fields.
|
2020-05-11 20:43:52 +00:00
|
|
|
NullVerification Verification = enum.Null
|
2020-05-11 01:26:46 +00:00
|
|
|
// NoVerification required no verification.
|
|
|
|
NoVerification Verification = 0
|
2020-01-04 04:19:24 +00:00
|
|
|
// LowVerification requires a verified email
|
2020-05-11 01:26:46 +00:00
|
|
|
LowVerification Verification = 1
|
2020-01-04 04:19:24 +00:00
|
|
|
// MediumVerification requires the user be registered for at least 5
|
|
|
|
// minutes.
|
2020-05-11 01:26:46 +00:00
|
|
|
MediumVerification Verification = 2
|
2020-01-04 04:19:24 +00:00
|
|
|
// HighVerification requires the member be in the server for more than 10
|
|
|
|
// minutes.
|
2020-05-11 01:26:46 +00:00
|
|
|
HighVerification Verification = 3
|
2020-01-04 04:19:24 +00:00
|
|
|
// VeryHighVerification requires the member to have a verified phone
|
|
|
|
// number.
|
2020-05-11 01:26:46 +00:00
|
|
|
VeryHighVerification Verification = 4
|
2020-01-04 04:19:24 +00:00
|
|
|
)
|
2020-01-06 03:48:39 +00:00
|
|
|
|
2020-05-11 01:26:46 +00:00
|
|
|
func (v *Verification) UnmarshalJSON(b []byte) error {
|
2020-05-11 20:43:52 +00:00
|
|
|
i, err := enum.FromJSON(b)
|
2020-05-11 01:26:46 +00:00
|
|
|
*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 }
|
2020-05-11 01:26:46 +00:00
|
|
|
|
2020-01-07 06:45:29 +00:00
|
|
|
// Service is used for guild integrations and user connections.
|
|
|
|
type Service string
|
2020-01-06 03:48:39 +00:00
|
|
|
|
|
|
|
const (
|
2020-01-07 06:45:29 +00:00
|
|
|
Twitch Service = "twitch"
|
|
|
|
YouTube Service = "youtube"
|
2020-01-06 03:48:39 +00:00
|
|
|
)
|
2020-05-10 23:45:44 +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
|
2020-05-10 23:45:44 +00:00
|
|
|
var (
|
|
|
|
// RemoveRole removes the role of the subscriber.
|
|
|
|
RemoveRole ExpireBehavior = 0
|
|
|
|
// Kick kicks the subscriber from the guild.
|
|
|
|
Kick ExpireBehavior = 1
|
|
|
|
)
|