Lingo.Helper.Channel (Lingo v0.4.2)

Copy Markdown View Source

What the bot can do in a channel.

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

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

Whether the bot can manage a channel.

Whether the bot can delete a message: its own, or anyone's with Manage Messages.

A member's permissions bitfield in a channel, with overwrites applied, or 0 when data is missing.

Whether the bot can see a channel.

Functions

fetch_permissions(channel_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.

manageable?(channel_id)

Whether the bot can manage a channel.

message_deletable?(channel_id, message_id)

Whether the bot can delete a message: its own, or anyone's with Manage Messages.

permissions(channel_id, user_id)

A member's permissions bitfield in a channel, with overwrites applied, or 0 when data is missing.

viewable?(channel_id)

Whether the bot can see a channel.