github.com/diamondburned/arikawa/v2@v2.1.0/discord/guild_consts.go (about)

     1  package discord
     2  
     3  import (
     4  	"github.com/diamondburned/arikawa/v2/utils/json/enum"
     5  )
     6  
     7  // Guild.MaxPresences is this value when it's 0.
     8  // This happens because the Discord API sends JSON null, if the MaxPresences
     9  // reach DefaultMaxPresences, which in turn will be serialized into 0.
    10  const DefaultMaxPresences = 25000
    11  
    12  // NitroBoost is the premium tier (Server Boost level).
    13  type NitroBoost uint8
    14  
    15  // https://discord.com/developers/docs/resources/guild#guild-object-premium-tier
    16  const (
    17  	NoNitroLevel NitroBoost = iota
    18  	NitroLevel1
    19  	NitroLevel2
    20  	NitroLevel3
    21  )
    22  
    23  // MFALevel is the required MFA level for a guild.
    24  type MFALevel uint8
    25  
    26  // https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
    27  const (
    28  	NoMFA MFALevel = iota
    29  	ElevatedMFA
    30  )
    31  
    32  type SystemChannelFlags uint8
    33  
    34  // https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags
    35  const (
    36  	// SuppressJoinNotifications suppresses member join notifications.
    37  	SuppressJoinNotifications SystemChannelFlags = 1 << iota
    38  	// SuppressPremiumSubscriptions suppresses server boost notifications.
    39  	SuppressPremiumSubscriptions
    40  )
    41  
    42  type GuildFeature string
    43  
    44  // https://discord.com/developers/docs/resources/guild#guild-object-guild-features
    45  const (
    46  	// InviteSplash is set, if the guild has access to set an invite splash
    47  	// background.
    48  	InviteSplash GuildFeature = "INVITE_SPLASH"
    49  	// VIPRegions is set, if the guild has access to set 384kbps bitrate in
    50  	// voice (previously VIP voice servers).
    51  	VIPRegions GuildFeature = "VIP_REGIONS"
    52  	// VanityURL is set, if the guild has access to set a vanity URL.
    53  	VanityURL GuildFeature = "VANITY_URL"
    54  	// Verified is set, if the guild is verified.
    55  	Verified GuildFeature = "VERIFIED"
    56  	// Partnered is set, if the guild is partnered.
    57  	Partnered GuildFeature = "PARTNERED"
    58  	// Public is set, if the guild is public.
    59  	Public GuildFeature = "PUBLIC"
    60  	// Commerce is set, if the guild has access to use commerce features
    61  	// (i.e. create store channels).
    62  	Commerce GuildFeature = "COMMERCE"
    63  	// News is set, if the guild has access to create news channels.
    64  	News GuildFeature = "NEWS"
    65  	// Discoverable is set, if the guild is able to be discovered in the
    66  	// directory.
    67  	Discoverable GuildFeature = "DISCOVERABLE"
    68  	// Featurable is set, if the guild is able to be featured in the directory.
    69  	Featurable GuildFeature = "FEATURABLE"
    70  	// AnimatedIcon is set, if the guild has access to set an animated guild
    71  	// icon.
    72  	AnimatedIcon GuildFeature = "ANIMATED_ICON"
    73  	// Banner is set, if the guild has access to set a guild banner image.
    74  	Banner GuildFeature = "BANNER"
    75  )
    76  
    77  // ExplicitFilter is the explicit content filter level of a guild.
    78  type ExplicitFilter enum.Enum
    79  
    80  // https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level
    81  var (
    82  	// NullExplicitFilter serialized to JSON null.
    83  	// This should only be used on nullable fields.
    84  	NullExplicitFilter ExplicitFilter = enum.Null
    85  	// NoContentFilter disables content filtering for the guild.
    86  	NoContentFilter ExplicitFilter = 0
    87  	// MembersWithoutRoles filters only members without roles.
    88  	MembersWithoutRoles ExplicitFilter = 1
    89  	// AllMembers enables content filtering for all members.
    90  	AllMembers ExplicitFilter = 2
    91  )
    92  
    93  func (f *ExplicitFilter) UnmarshalJSON(b []byte) error {
    94  	i, err := enum.FromJSON(b)
    95  	*f = ExplicitFilter(i)
    96  
    97  	return err
    98  }
    99  
   100  func (f ExplicitFilter) MarshalJSON() ([]byte, error) {
   101  	return enum.ToJSON(enum.Enum(f)), nil
   102  }
   103  
   104  // Notification is the default message notification level of a guild.
   105  type Notification enum.Enum
   106  
   107  // https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
   108  var (
   109  	// NullNotification serialized to JSON null.
   110  	// This should only be used on nullable fields.
   111  	NullNotification Notification = enum.Null
   112  	// AllMessages sends notifications for all messages.
   113  	AllMessages Notification = 0
   114  	// OnlyMentions sends notifications only on mention.
   115  	OnlyMentions Notification = 1
   116  )
   117  
   118  func (n *Notification) UnmarshalJSON(b []byte) error {
   119  	i, err := enum.FromJSON(b)
   120  	*n = Notification(i)
   121  
   122  	return err
   123  }
   124  
   125  func (n Notification) MarshalJSON() ([]byte, error) { return enum.ToJSON(enum.Enum(n)), nil }
   126  
   127  // Verification is the verification level required for a guild.
   128  type Verification enum.Enum
   129  
   130  // https://discord.com/developers/docs/resources/guild#guild-object-verification-level
   131  var (
   132  	// NullVerification serialized to JSON null.
   133  	// This should only be used on nullable fields.
   134  	NullVerification Verification = enum.Null
   135  	// NoVerification required no verification.
   136  	NoVerification Verification = 0
   137  	// LowVerification requires a verified email
   138  	LowVerification Verification = 1
   139  	// MediumVerification requires the user be registered for at least 5
   140  	// minutes.
   141  	MediumVerification Verification = 2
   142  	// HighVerification requires the member be in the server for more than 10
   143  	// minutes.
   144  	HighVerification Verification = 3
   145  	// VeryHighVerification requires the member to have a verified phone
   146  	// number.
   147  	VeryHighVerification Verification = 4
   148  )
   149  
   150  func (v *Verification) UnmarshalJSON(b []byte) error {
   151  	i, err := enum.FromJSON(b)
   152  	*v = Verification(i)
   153  
   154  	return err
   155  }
   156  
   157  func (v Verification) MarshalJSON() ([]byte, error) { return enum.ToJSON(enum.Enum(v)), nil }
   158  
   159  // Service is used for guild integrations and user connections.
   160  type Service string
   161  
   162  const (
   163  	TwitchService  Service = "twitch"
   164  	YouTubeService Service = "youtube"
   165  	DiscordService Service = "discord"
   166  )
   167  
   168  // ExpireBehavior is the integration expire behavior that regulates what happens, if a subscriber expires.
   169  type ExpireBehavior uint8
   170  
   171  // https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors
   172  var (
   173  	// RemoveRole removes the role of the subscriber.
   174  	RemoveRole ExpireBehavior = 0
   175  	// Kick kicks the subscriber from the guild.
   176  	Kick ExpireBehavior = 1
   177  )