Lingo.Api.Thread (Lingo v0.4.2)

Copy Markdown View Source

Threads and forum posts.

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

A guild's active threads, with the bot's membership in those it has joined.

A page of archived threads, with the bot's membership in those it has joined.

Functions

Adds a member to a thread.

Fetches a thread member. with_member: true includes the guild member.

Adds the bot to a thread.

Removes the bot from a thread.

Lists a guild's active threads, with the bot's membership in those it has joined.

Lists archived private threads the bot has joined. Options: :before and :limit.

Lists a thread's members. Options: :with_member (include the guild members), :after and :limit.

Lists a channel's archived private threads. Options: :before and :limit.

Lists a channel's archived public threads. Options: :before and :limit.

Removes a member from a thread.

Starts a thread without a message, or a forum post.

Types

active()

@type active() :: %{
  threads: [Lingo.Type.Channel.t()],
  members: [Lingo.Type.ThreadMember.t()]
}

A guild's active threads, with the bot's membership in those it has joined.

archived()

@type archived() :: %{
  threads: [Lingo.Type.Channel.t()],
  members: [Lingo.Type.ThreadMember.t()],
  has_more: boolean()
}

A page of archived threads, with the bot's membership in those it has joined.

Functions

add_member(channel_id, user_id)

@spec add_member(Lingo.Api.id(), Lingo.Api.id()) :: Lingo.Api.result()

Adds a member to a thread.

get_member(channel_id, user_id, opts \\ [])

Fetches a thread member. with_member: true includes the guild member.

join(channel_id)

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

Adds the bot to a thread.

leave(channel_id)

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

Removes the bot from a thread.

list_active(guild_id)

@spec list_active(Lingo.Api.id()) :: Lingo.Api.result(active())

Lists a guild's active threads, with the bot's membership in those it has joined.

list_joined_private_archived(channel_id, opts \\ [])

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

Lists archived private threads the bot has joined. Options: :before and :limit.

list_members(channel_id, opts \\ [])

@spec list_members(
  Lingo.Api.id(),
  keyword()
) :: Lingo.Api.result([Lingo.Type.ThreadMember.t()])

Lists a thread's members. Options: :with_member (include the guild members), :after and :limit.

list_private_archived(channel_id, opts \\ [])

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

Lists a channel's archived private threads. Options: :before and :limit.

list_public_archived(channel_id, opts \\ [])

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

Lists a channel's archived public threads. Options: :before and :limit.

remove_member(channel_id, user_id)

@spec remove_member(Lingo.Api.id(), Lingo.Api.id()) :: Lingo.Api.result()

Removes a member from a thread.

start_from_message(channel_id, message_id, params, opts \\ [])

Starts a thread from a message.

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

@spec start_without_message(Lingo.Api.id(), Lingo.Api.params(), keyword()) ::
  Lingo.Api.result(Lingo.Type.Channel.t())

Starts a thread without a message, or a forum post.