Crux v2020-03-17 17:55:51Z Crux.Structs.Guild View Source

Represents a Discord Guild Object.

Differences opposed to the Discord API Object:

  • :channels is a MapSet of channel ids
  • :emojis is a MapSet of emoji ids
  • :presences does not exists at all

Link to this section Summary

Types

All available types that can be resolved into a guild id.

t()

Functions

Creates a t:Crux.Structs.Guild/0 struct from raw data.

Link to this section Types

All available types that can be resolved into a guild id.

Link to this type

t() View Source (since 0.1.0)
t() :: %Crux.Structs.Guild{
  afk_channel_id: Crux.Structs.Snowflake.t() | nil,
  afk_timeout: integer(),
  application_id: Crux.Structs.Snowflake.t() | nil,
  banner: String.t() | nil,
  channels: MapSet.t(Crux.Structs.Snowflake.t()),
  default_message_notifications: non_neg_integer(),
  description: String.t() | nil,
  embed_enabled: boolean(),
  emojis: MapSet.t(Crux.Structs.Snowflake.t()),
  explicit_content_filter: non_neg_integer(),
  features: MapSet.t(String.t()),
  icon: String.t() | nil,
  id: Crux.Structs.Snowflake.t(),
  joined_at: String.t(),
  large: boolean(),
  max_members: pos_integer(),
  max_presences: pos_integer() | nil,
  member_count: pos_integer(),
  members: %{required(Crux.Structs.Snowflake.t()) => Crux.Structs.Member.t()},
  mfa_level: integer(),
  name: String.t(),
  owner_id: String.t(),
  preferred_locale: String.t(),
  premium_subscription_count: non_neg_integer(),
  premium_tier: non_neg_integer(),
  region: String.t(),
  roles: %{optional(Crux.Structs.Snowflake.t()) => Crux.Structs.Role.t()},
  splash: String.t() | nil,
  system_channel_flags: non_neg_integer(),
  system_channel_id: Crux.Structs.Snowflake.t() | nil,
  unavailable: boolean(),
  vanity_url_code: String.t() | nil,
  verification_level: integer(),
  voice_states: %{
    optional(Crux.Structs.Snowflake.t()) => Crux.Structs.VoiceState.t()
  },
  widget_enabled: boolean()
}

Link to this section Functions

Link to this function

create(data) View Source (since 0.1.0)
create(data :: map()) :: t()

Creates a t:Crux.Structs.Guild/0 struct from raw data.

Automatically invoked by Crux.Structs.create/2.

Link to this function

resolve_id(resolvable) View Source (since 0.2.1)
resolve_id(id_resolvable()) :: Crux.Structs.Snowflake.t() | nil

Resolves the id of a Crux.Structs.Guild.t/0.

Automatically invoked by Crux.Structs.resolve_id/2.

  iex> %Crux.Structs.Guild{id: 516569101267894284}
  ...> |> Crux.Structs.Guild.resolve_id()
  516569101267894284

  iex> %Crux.Structs.Channel{guild_id: 516569101267894284}
  ...> |> Crux.Structs.Guild.resolve_id()
  516569101267894284

  iex> %Crux.Structs.Message{guild_id: 516569101267894284}
  ...> |> Crux.Structs.Guild.resolve_id()
  516569101267894284

  iex> 516569101267894284
  ...> |> Crux.Structs.Guild.resolve_id()
  516569101267894284

  iex> "516569101267894284"
  ...> |> Crux.Structs.Guild.resolve_id()
  516569101267894284

  # DMs
  iex> %Crux.Structs.Channel{guild_id: nil}
  ...> |> Crux.Structs.Guild.resolve_id()
  nil

  iex> %Crux.Structs.Message{guild_id: nil}
  ...> |> Crux.Structs.Guild.resolve_id()
  nil