Lingo.Api.Guild (Lingo v0.4.2)

Copy Markdown View Source

Guilds: settings, channels, integrations, widgets, onboarding and pruning.

Every function returns {:ok, result}, :ok when Discord sends no body, or {:error, %Lingo.Error{}}. Calls go to the current bot (see Lingo.with_bot/2).

Summary

Types

Whether a guild's widget is enabled, and the channel its invite leads to.

Functions

Removes inactive members from a guild, returning how many. Params: :days, :include_roles, and compute_prune_count: false for large guilds, which returns nil instead.

Removes an integration from a guild.

Fetches a guild. Pass with_counts: true for approximate member and presence counts.

Fetches a guild's onboarding settings.

Fetches the public preview of a discoverable guild.

Counts the members a prune would remove. Options: :days (1 to 30) and :include_roles (role ids whose members may be pruned too).

Fetches a guild's vanity invite: its code (nil when none is set) and uses.

Fetches a guild's welcome screen.

Fetches a guild's public widget.

Fetches a guild's widget as a PNG image. Pass style: to pick the banner style.

Fetches a guild's widget settings.

Lists a guild's integrations.

Lists the voice regions available to a guild, with VIP ones when it has them.

Edits a guild's settings.

Pauses invites or DMs in a guild, e.g. during a raid: :invites_disabled_until and :dms_disabled_until, up to 24 hours ahead, or nil to lift a pause.

Edits a guild's onboarding settings: :prompts, :default_channel_ids, :enabled and :mode, with Discord's fields and numbers.

Edits a guild's welcome screen: :enabled, :welcome_channels and :description.

Edits a guild's widget settings: :enabled and :channel_id.

Types

widget_settings()

@type widget_settings() :: %{enabled: boolean(), channel_id: Lingo.Api.id() | nil}

Whether a guild's widget is enabled, and the channel its invite leads to.

Functions

begin_prune(guild_id, params \\ %{}, opts \\ [])

@spec begin_prune(Lingo.Api.id(), Lingo.Api.params(), keyword()) ::
  Lingo.Api.result(non_neg_integer() | nil)

Removes inactive members from a guild, returning how many. Params: :days, :include_roles, and compute_prune_count: false for large guilds, which returns nil instead.

delete_integration(guild_id, integration_id, opts \\ [])

@spec delete_integration(Lingo.Api.id(), Lingo.Api.id(), keyword()) ::
  Lingo.Api.result()

Removes an integration from a guild.

get(guild_id, opts \\ [])

Fetches a guild. Pass with_counts: true for approximate member and presence counts.

get_onboarding(guild_id)

@spec get_onboarding(Lingo.Api.id()) :: Lingo.Api.result(Lingo.Type.Onboarding.t())

Fetches a guild's onboarding settings.

get_preview(guild_id)

@spec get_preview(Lingo.Api.id()) :: Lingo.Api.result(Lingo.Type.Guild.t())

Fetches the public preview of a discoverable guild.

get_prune_count(guild_id, opts \\ [])

@spec get_prune_count(
  Lingo.Api.id(),
  keyword()
) :: Lingo.Api.result(non_neg_integer())

Counts the members a prune would remove. Options: :days (1 to 30) and :include_roles (role ids whose members may be pruned too).

get_vanity_url(guild_id)

@spec get_vanity_url(Lingo.Api.id()) :: Lingo.Api.result(Lingo.Type.Invite.t())

Fetches a guild's vanity invite: its code (nil when none is set) and uses.

get_welcome_screen(guild_id)

@spec get_welcome_screen(Lingo.Api.id()) ::
  Lingo.Api.result(Lingo.Type.WelcomeScreen.t())

Fetches a guild's welcome screen.

get_widget(guild_id)

Fetches a guild's public widget.

get_widget_image(guild_id, opts \\ [])

@spec get_widget_image(
  Lingo.Api.id(),
  keyword()
) :: Lingo.Api.result(binary())

Fetches a guild's widget as a PNG image. Pass style: to pick the banner style.

get_widget_settings(guild_id)

@spec get_widget_settings(Lingo.Api.id()) :: Lingo.Api.result(widget_settings())

Fetches a guild's widget settings.

list_integrations(guild_id)

@spec list_integrations(Lingo.Api.id()) ::
  Lingo.Api.result([Lingo.Type.Integration.t()])

Lists a guild's integrations.

list_voice_regions(guild_id)

@spec list_voice_regions(Lingo.Api.id()) ::
  Lingo.Api.result([Lingo.Type.VoiceRegion.t()])

Lists the voice regions available to a guild, with VIP ones when it has them.

update(guild_id, params, opts \\ [])

Edits a guild's settings.

update_incident_actions(guild_id, params)

@spec update_incident_actions(Lingo.Api.id(), Lingo.Api.params()) ::
  Lingo.Api.result(Lingo.Type.IncidentsData.t())

Pauses invites or DMs in a guild, e.g. during a raid: :invites_disabled_until and :dms_disabled_until, up to 24 hours ahead, or nil to lift a pause.

update_onboarding(guild_id, params, opts \\ [])

Edits a guild's onboarding settings: :prompts, :default_channel_ids, :enabled and :mode, with Discord's fields and numbers.

update_welcome_screen(guild_id, params, opts \\ [])

Edits a guild's welcome screen: :enabled, :welcome_channels and :description.

update_widget(guild_id, params, opts \\ [])

Edits a guild's widget settings: :enabled and :channel_id.