Lingo.Helper.Member (Lingo v0.4.2)

Copy Markdown View Source

What the bot can do to a member, and how members are shown.

Answered from the cache, which needs guilds, channels, roles and the bot's own user and member enabled (see Lingo.Cache). Anything missing gives false, 0 or nil.

Summary

Functions

Whether the bot can ban a member.

The color a member's name is shown in, from their highest colored role, or 0.

The name a member is shown with: nickname, then global name, then username.

Like permissions/2, but {:ok, bitfield}, or {:error, {:missing_cache, resource}} naming what isn't cached.

Whether the bot can kick a member.

Whether the bot outranks a member, so it can change their nickname or roles. Nobody outranks the owner.

A member's guild-wide permissions bitfield, or 0 when required data is missing.

Functions

bannable?(guild_id, user_id)

Whether the bot can ban a member.

display_color(guild_id, user_id)

The color a member's name is shown in, from their highest colored role, or 0.

display_name(guild_id, user_id)

The name a member is shown with: nickname, then global name, then username.

fetch_permissions(guild_id, user_id)

@spec fetch_permissions(String.t(), String.t()) ::
  {:ok, non_neg_integer()} | {:error, {:missing_cache, atom()}}

Like permissions/2, but {:ok, bitfield}, or {:error, {:missing_cache, resource}} naming what isn't cached.

kickable?(guild_id, user_id)

Whether the bot can kick a member.

manageable?(guild_id, user_id)

Whether the bot outranks a member, so it can change their nickname or roles. Nobody outranks the owner.

permissions(guild_id, user_id)

A member's guild-wide permissions bitfield, or 0 when required data is missing.