Lingo.Api.Channel (Lingo v0.4.2)

Copy Markdown View Source

Channels: settings, permission overwrites, pins, invites and typing.

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

Functions

Creates a channel in a guild.

Deletes a channel, or closes a DM.

Removes a permission overwrite from a channel.

Follows an announcement channel into another channel. Returns the followed channel's id and the id of the webhook posting its messages.

Fetches a channel or thread.

Lists a guild's channels, without threads.

Lists a channel's pinned messages, up to 50 at a time. Options: :limit, and :before to page on from the last pin's pinned_at.

Sets the status text of a voice channel.

Shows the bot as typing in a channel for a few seconds.

Edits a channel or thread.

Sets a permission overwrite for a role or member in a channel.

Moves channels in a guild, from a list of %{id:, position:} maps.

Functions

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

Creates a channel in a guild.

delete(channel_id, opts \\ [])

Deletes a channel, or closes a DM.

delete_permission(channel_id, overwrite_id, opts \\ [])

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

Removes a permission overwrite from a channel.

follow_announcement(channel_id, webhook_channel_id, opts \\ [])

@spec follow_announcement(Lingo.Api.id(), Lingo.Api.id(), keyword()) ::
  Lingo.Api.result(%{channel_id: Lingo.Api.id(), webhook_id: Lingo.Api.id()})

Follows an announcement channel into another channel. Returns the followed channel's id and the id of the webhook posting its messages.

get(channel_id)

Fetches a channel or thread.

list(guild_id)

Lists a guild's channels, without threads.

list_pins(channel_id, opts \\ [])

@spec list_pins(
  Lingo.Api.id(),
  keyword()
) ::
  Lingo.Api.result(%{
    items: [%{pinned_at: DateTime.t(), message: Lingo.Type.Message.t()}],
    has_more: boolean()
  })

Lists a channel's pinned messages, up to 50 at a time. Options: :limit, and :before to page on from the last pin's pinned_at.

pin_message(channel_id, message_id, opts \\ [])

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

Pins a message.

set_voice_status(channel_id, params, opts \\ [])

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

Sets the status text of a voice channel.

trigger_typing(channel_id)

@spec trigger_typing(Lingo.Api.id()) :: Lingo.Api.result()

Shows the bot as typing in a channel for a few seconds.

unpin_message(channel_id, message_id, opts \\ [])

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

Unpins a message.

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

Edits a channel or thread.

update_permission(channel_id, overwrite_id, params, opts \\ [])

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

Sets a permission overwrite for a role or member in a channel.

update_positions(guild_id, positions)

@spec update_positions(Lingo.Api.id(), [map()]) :: Lingo.Api.result()

Moves channels in a guild, from a list of %{id:, position:} maps.