Lingo.Api.Member (Lingo v0.4.2)

Copy Markdown View Source

Guild members: fetching, editing, roles and kicks.

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

Adds a user to a guild with their OAuth2 token (guilds.join scope, see Lingo.OAuth2); the bot must be in the guild. Params: :nick, :roles, :mute, :deaf. Returns the member, or :ok when they were already in.

Fetches a guild member.

Removes a member from a guild.

Lists guild members, limit: at a time (needs the guild members intent).

Takes a role away from a member.

Finds guild members whose username or nickname starts with query.

Edits a guild member: nickname, roles, mute, deafen, timeout or voice channel.

Edits the bot's own profile in a guild: :nick, and :avatar, :banner (images as data URIs) and :bio, shown in that guild only.

Functions

add_role(guild_id, user_id, role_id, opts \\ [])

Gives a member a role.

create(guild_id, user_id, access_token, params \\ [])

Adds a user to a guild with their OAuth2 token (guilds.join scope, see Lingo.OAuth2); the bot must be in the guild. Params: :nick, :roles, :mute, :deaf. Returns the member, or :ok when they were already in.

get(guild_id, user_id)

Fetches a guild member.

kick(guild_id, user_id, opts \\ [])

Removes a member from a guild.

list(guild_id, opts \\ [])

Lists guild members, limit: at a time (needs the guild members intent).

remove_role(guild_id, user_id, role_id, opts \\ [])

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

Takes a role away from a member.

search(guild_id, query, opts \\ [])

Finds guild members whose username or nickname starts with query.

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

Edits a guild member: nickname, roles, mute, deafen, timeout or voice channel.

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

Edits the bot's own profile in a guild: :nick, and :avatar, :banner (images as data URIs) and :bio, shown in that guild only.