Nostrum.Struct.Guild (nostrum v0.11.0-dev)

View Source

Struct representing a Discord guild.

Summary

Types

The id of the guild's afk channel

The time someone must be afk before being moved

Application id of the guild creator if it is bot created.

A Nostrum.Struct.Guild that is fully available.

Banner hash for the guild, if prefixed with a_ an animated GIF is available.

List of channels

Default message notifications level.

User-set description of the guild

Hash of the Discovery splash screen

List of emojis

Explicit content filter level.

List of guild features

List of scheduled events

The hash of the guild's icon

The guild's id

Date the bot user joined the guild

Whether the guild is considered 'large'

Maximum members for the guild

Maximum number of presences for the guild.

The maximum amount of users in a stage video channel

The maximum amount of users in a video channel

Total number of members in the guild

Required MFA level of the guild

The name of the guild.

NSFW level for the guild, unrated guilds have :default

The id of the guild owner

Preferred locale for the guild, set by the user

Whether the guild has the boost progress bar enabled

Number of boosts received by the guild

Premium tier of the guild (0-3)

The id of the channel where admins and moderators receive notices from Discord. This is only available to guilds that contain PUBLIC in features/0.

The id of the voice region

A Nostrum.Struct.Guild that is sent on guild-specific rest endpoints.

List of roles

The id of the channel that is used for rules. This is only available to guilds that contain PUBLIC in features/0.

The id of the channel where admins and moderators of Community guilds receive safety alerts from Discord

The hash of the guild's splash

Custom stickers registered to the guild

Bitset representing the system channel flags

The id of the channel to which system messages are sent.

t()

All active threads in the guild that the current user has permission to view

Whether the guild is available

A Nostrum.Struct.Guild that is unavailable.

A Nostrum.Struct.Guild that is sent on user-specific rest endpoints.

Guild invite vanity URL

The level of verification

List of voice states as maps

The welcome screen of a Community guild, shown to new members, returned in an Invite's guild object

The channel id for the server widget.

Whether or not the server widget is enabled.

Functions

Returns the URL of the guild's banner, or nil if no guild banner has been set.

Returns the URL of the guild's discovery splash, or nil if no discovery splash.

Returns the URL of a guild's icon, or nil if there is no icon.

Returns the URL of a guild's splash, or nil if there is no splash.

Types

afk_channel_id()

@type afk_channel_id() :: Nostrum.Struct.Channel.id() | nil

The id of the guild's afk channel

afk_timeout()

@type afk_timeout() :: integer()

The time someone must be afk before being moved

application_id()

@type application_id() :: Nostrum.Snowflake.t() | nil

Application id of the guild creator if it is bot created.

available_guild()

@type available_guild() :: %Nostrum.Struct.Guild{
  afk_channel_id: afk_channel_id(),
  afk_timeout: afk_timeout(),
  application_id: application_id(),
  banner: banner(),
  channels: channels(),
  default_message_notifications: default_message_notifications(),
  description: description(),
  discovery_splash: discovery_splash(),
  emojis: emojis(),
  explicit_content_filter: explicit_content_filter(),
  features: features(),
  guild_scheduled_events: guild_scheduled_events(),
  icon: icon(),
  id: id(),
  joined_at: joined_at(),
  large: large(),
  max_members: max_members(),
  max_presences: max_presences(),
  max_stage_video_channel_users: max_stage_video_channel_users(),
  max_video_channel_users: max_video_channel_users(),
  member_count: member_count(),
  mfa_level: mfa_level(),
  name: name(),
  nsfw_level: nsfw_level(),
  owner_id: owner_id(),
  preferred_locale: preferred_locale(),
  premium_progress_bar_enabled: premium_progress_bar_enabled(),
  premium_subscription_count: premium_subscription_count(),
  premium_tier: premium_tier(),
  public_updates_channel_id: public_updates_channel_id(),
  region: region(),
  roles: roles(),
  rules_channel_id: rules_channel_id(),
  safety_alerts_channel_id: safety_alerts_channel_id(),
  splash: splash(),
  stickers: stickers(),
  system_channel_flags: system_channel_flags(),
  system_channel_id: system_channel_id(),
  threads: threads(),
  unavailable: false,
  vanity_url_code: vanity_url_code(),
  verification_level: verification_level(),
  voice_states: voice_states(),
  welcome_screen: welcome_screen(),
  widget_channel_id: widget_channel_id(),
  widget_enabled: widget_enabled()
}

A Nostrum.Struct.Guild that is fully available.

banner()

@type banner() :: String.t() | nil

Banner hash for the guild, if prefixed with a_ an animated GIF is available.

channels()

@type channels() ::
  %{required(Nostrum.Struct.Channel.id()) => Nostrum.Struct.Channel.t()} | nil

List of channels

default_message_notifications()

@type default_message_notifications() :: integer()

Default message notifications level.

description()

@type description() :: String.t() | nil

User-set description of the guild

discovery_splash()

@type discovery_splash() :: String.t() | nil

Hash of the Discovery splash screen

emojis()

@type emojis() :: [Nostrum.Struct.Emoji.t()]

List of emojis

explicit_content_filter()

@type explicit_content_filter() :: integer()

Explicit content filter level.

features()

@type features() :: [String.t()]

List of guild features

guild_scheduled_events()

@type guild_scheduled_events() :: [Nostrum.Struct.Guild.ScheduledEvent.t()] | nil

List of scheduled events

icon()

@type icon() :: String.t() | nil

The hash of the guild's icon

id()

@type id() :: Nostrum.Snowflake.t()

The guild's id

joined_at()

@type joined_at() :: String.t() | nil

Date the bot user joined the guild

large()

@type large() :: boolean() | nil

Whether the guild is considered 'large'

max_members()

@type max_members() :: pos_integer() | nil

Maximum members for the guild

max_presences()

@type max_presences() :: pos_integer() | nil

Maximum number of presences for the guild.

This will be unset for most guilds, except for in Discord's terms, the "largest of guilds", where the field will be set to the maximum number of online (gateway connected) members.

max_stage_video_channel_users()

@type max_stage_video_channel_users() :: pos_integer() | nil

The maximum amount of users in a stage video channel

max_video_channel_users()

@type max_video_channel_users() :: pos_integer() | nil

The maximum amount of users in a video channel

member_count()

@type member_count() :: integer() | nil

Total number of members in the guild

mfa_level()

@type mfa_level() :: integer()

Required MFA level of the guild

name()

@type name() :: String.t()

The name of the guild.

nsfw_level()

@type nsfw_level() :: :default | :explicit | :safe | :age_restricted

NSFW level for the guild, unrated guilds have :default

owner_id()

@type owner_id() :: Nostrum.Struct.User.id()

The id of the guild owner

preferred_locale()

@type preferred_locale() :: String.t() | nil

Preferred locale for the guild, set by the user

premium_progress_bar_enabled()

@type premium_progress_bar_enabled() :: boolean()

Whether the guild has the boost progress bar enabled

premium_subscription_count()

@type premium_subscription_count() :: pos_integer()

Number of boosts received by the guild

premium_tier()

@type premium_tier() :: 0..3

Premium tier of the guild (0-3)

public_updates_channel_id()

@type public_updates_channel_id() :: Nostrum.Struct.Channel.id() | nil

The id of the channel where admins and moderators receive notices from Discord. This is only available to guilds that contain PUBLIC in features/0.

region()

@type region() :: String.t()

The id of the voice region

rest_guild()

@type rest_guild() :: %Nostrum.Struct.Guild{
  afk_channel_id: afk_channel_id(),
  afk_timeout: afk_timeout(),
  application_id: application_id(),
  banner: nil,
  channels: nil,
  default_message_notifications: default_message_notifications(),
  description: nil,
  discovery_splash: nil,
  emojis: emojis(),
  explicit_content_filter: explicit_content_filter(),
  features: features(),
  guild_scheduled_events: nil,
  icon: icon(),
  id: id(),
  joined_at: nil,
  large: nil,
  max_members: nil,
  max_presences: nil,
  max_stage_video_channel_users: nil,
  max_video_channel_users: nil,
  member_count: nil,
  mfa_level: mfa_level(),
  name: name(),
  nsfw_level: nil,
  owner_id: owner_id(),
  preferred_locale: nil,
  premium_progress_bar_enabled: nil,
  premium_subscription_count: nil,
  premium_tier: nil,
  public_updates_channel_id: public_updates_channel_id(),
  region: region(),
  roles: roles(),
  rules_channel_id: rules_channel_id(),
  safety_alerts_channel_id: nil,
  splash: splash(),
  stickers: stickers(),
  system_channel_flags: nil,
  system_channel_id: system_channel_id(),
  threads: nil,
  unavailable: nil,
  vanity_url_code: vanity_url_code(),
  verification_level: verification_level(),
  voice_states: nil,
  welcome_screen: nil,
  widget_channel_id: widget_channel_id(),
  widget_enabled: widget_enabled()
}

A Nostrum.Struct.Guild that is sent on guild-specific rest endpoints.

roles()

@type roles() :: %{
  required(Nostrum.Struct.Guild.Role.id()) => Nostrum.Struct.Guild.Role.t()
}

List of roles

rules_channel_id()

@type rules_channel_id() :: Nostrum.Struct.Channel.id() | nil

The id of the channel that is used for rules. This is only available to guilds that contain PUBLIC in features/0.

safety_alerts_channel_id()

@type safety_alerts_channel_id() :: Nostrum.Struct.Channel.id() | nil

The id of the channel where admins and moderators of Community guilds receive safety alerts from Discord

splash()

@type splash() :: String.t() | nil

The hash of the guild's splash

stickers()

(since 0.10.0)
@type stickers() :: [Nostrum.Struct.Sticker.t()]

Custom stickers registered to the guild

system_channel_flags()

@type system_channel_flags() :: pos_integer()

Bitset representing the system channel flags

See Nostrum.Struct.Guild.SystemChannelFlags for more information on the flag contents as well as methods to parse and create your own values for this field.

system_channel_id()

@type system_channel_id() :: Nostrum.Struct.Channel.id() | nil

The id of the channel to which system messages are sent.

t()

threads()

(since 0.5.1)
@type threads() ::
  %{required(Nostrum.Struct.Channel.id()) => Nostrum.Struct.Channel.t()} | nil

All active threads in the guild that the current user has permission to view

unavailable()

@type unavailable() :: boolean() | nil

Whether the guild is available

unavailable_guild()

@type unavailable_guild() :: %Nostrum.Struct.Guild{
  afk_channel_id: nil,
  afk_timeout: nil,
  application_id: nil,
  banner: nil,
  channels: nil,
  default_message_notifications: nil,
  description: nil,
  discovery_splash: nil,
  emojis: nil,
  explicit_content_filter: nil,
  features: nil,
  guild_scheduled_events: nil,
  icon: nil,
  id: id(),
  joined_at: nil,
  large: nil,
  max_members: nil,
  max_presences: nil,
  max_stage_video_channel_users: nil,
  max_video_channel_users: nil,
  member_count: nil,
  mfa_level: nil,
  name: nil,
  nsfw_level: nil,
  owner_id: nil,
  preferred_locale: nil,
  premium_progress_bar_enabled: nil,
  premium_subscription_count: nil,
  premium_tier: nil,
  public_updates_channel_id: nil,
  region: nil,
  roles: nil,
  rules_channel_id: nil,
  safety_alerts_channel_id: nil,
  splash: nil,
  stickers: nil,
  system_channel_flags: nil,
  system_channel_id: nil,
  threads: nil,
  unavailable: true,
  vanity_url_code: nil,
  verification_level: nil,
  voice_states: nil,
  welcome_screen: nil,
  widget_channel_id: nil,
  widget_enabled: nil
}

A Nostrum.Struct.Guild that is unavailable.

user_guild()

@type user_guild() :: %Nostrum.Struct.Guild{
  afk_channel_id: nil,
  afk_timeout: nil,
  application_id: nil,
  banner: nil,
  channels: nil,
  default_message_notifications: nil,
  description: nil,
  discovery_splash: nil,
  emojis: nil,
  explicit_content_filter: nil,
  features: nil,
  guild_scheduled_events: term(),
  icon: icon(),
  id: id(),
  joined_at: nil,
  large: nil,
  max_members: nil,
  max_presences: nil,
  max_stage_video_channel_users: nil,
  max_video_channel_users: nil,
  member_count: nil,
  mfa_level: nil,
  name: name(),
  nsfw_level: nil,
  owner_id: nil,
  preferred_locale: nil,
  premium_progress_bar_enabled: nil,
  premium_subscription_count: nil,
  premium_tier: nil,
  public_updates_channel_id: nil,
  region: nil,
  roles: nil,
  rules_channel_id: nil,
  safety_alerts_channel_id: nil,
  splash: nil,
  stickers: nil,
  system_channel_flags: nil,
  system_channel_id: nil,
  threads: nil,
  unavailable: nil,
  vanity_url_code: nil,
  verification_level: nil,
  voice_states: nil,
  welcome_screen: nil,
  widget_channel_id: nil,
  widget_enabled: nil
}

A Nostrum.Struct.Guild that is sent on user-specific rest endpoints.

vanity_url_code()

@type vanity_url_code() :: String.t() | nil

Guild invite vanity URL

verification_level()

@type verification_level() :: integer()

The level of verification

voice_states()

@type voice_states() :: [map()] | nil

List of voice states as maps

welcome_screen()

@type welcome_screen() :: map() | nil

The welcome screen of a Community guild, shown to new members, returned in an Invite's guild object

widget_channel_id()

@type widget_channel_id() :: Nostrum.Struct.Channel.id()

The channel id for the server widget.

widget_enabled()

@type widget_enabled() :: boolean() | nil

Whether or not the server widget is enabled.

Functions

discovery_splash_url(guild, image_format \\ "webp")

@spec discovery_splash_url(t(), String.t()) :: String.t() | nil

Returns the URL of the guild's discovery splash, or nil if no discovery splash.

Supported image formats are PNG, JPEG and WebP.

Examples

iex> guild = %Nostrum.Struct.Guild{discovery_splash: "656477617264736e6f7764656e",
...>                               id: 112233445566778899}
iex> Nostrum.Struct.Guild.discovery_splash_url(guild)
"https://cdn.discordapp.com/discovery-splashes/112233445566778899/656477617264736e6f7764656e.webp"
iex> Nostrum.Struct.Guild.discovery_splash_url(guild, "png")
"https://cdn.discordapp.com/discovery-splashes/112233445566778899/656477617264736e6f7764656e.png"

icon_url(guild, image_format \\ "webp")

@spec icon_url(t(), String.t()) :: String.t() | nil

Returns the URL of a guild's icon, or nil if there is no icon.

Supported image formats are PNG, JPEG, and WebP.

Examples

iex> guild = %Nostrum.Struct.Guild{icon: "86e39f7ae3307e811784e2ffd11a7310",
...>                               id: 41771983423143937}
iex> Nostrum.Struct.Guild.icon_url(guild)
"https://cdn.discordapp.com/icons/41771983423143937/86e39f7ae3307e811784e2ffd11a7310.webp"
iex> Nostrum.Struct.Guild.icon_url(guild, "png")
"https://cdn.discordapp.com/icons/41771983423143937/86e39f7ae3307e811784e2ffd11a7310.png"

iex> guild = %Nostrum.Struct.Guild{icon: nil}
iex> Nostrum.Struct.Guild.icon_url(guild)
nil

splash_url(guild, image_format \\ "webp")

@spec splash_url(t(), String.t()) :: String.t() | nil

Returns the URL of a guild's splash, or nil if there is no splash.

Supported image formats are PNG, JPEG, and WebP.

Examples

iex> guild = %Nostrum.Struct.Guild{splash: "86e39f7ae3307e811784e2ffd11a7310",
...>                               id: 41771983423143937}
iex> Nostrum.Struct.Guild.splash_url(guild)
"https://cdn.discordapp.com/splashes/41771983423143937/86e39f7ae3307e811784e2ffd11a7310.webp"
iex> Nostrum.Struct.Guild.splash_url(guild, "png")
"https://cdn.discordapp.com/splashes/41771983423143937/86e39f7ae3307e811784e2ffd11a7310.png"

iex> guild = %Nostrum.Struct.Guild{splash: nil}
iex> Nostrum.Struct.Guild.splash_url(guild)
nil