Modules
A Discord library: the gateway, the REST API, interactions and voice.
Discord's REST API, one module per resource: Lingo.Api.Message,
Lingo.Api.Guild, Lingo.Api.Member...
The bot's application, its Activity instances and its role connection metadata.
Guild audit logs.
Auto moderation rules.
Guild bans.
Channels: settings, permission overwrites, pins, invites and typing.
Application commands, global and per guild. Bots usually declare commands with Lingo.Bot.Commands and register them with Lingo.register_commands/1 instead.
Guild emojis and the application's own emojis.
Entitlements: who has access to the application's SKUs.
Guilds: settings, channels, integrations, widgets, onboarding and pruning.
Interaction responses and follow-ups.
Invites, including restricting them to target users.
Lobbies: groups of players for Discord's Social SDK, which a bot can create and manage, and link to a guild text channel.
Guild members: fetching, editing, roles and kicks.
Messages: sending, forwarding, editing, deleting, bulk deletion and search.
Polls.
Message reactions. Emojis are unicode characters or name:id for custom ones.
Guild roles.
SKUs and their subscriptions.
Guild scheduled events.
Soundboard sounds.
Stage instances: live stages in stage channels.
Stickers and sticker packs.
Guild templates.
Threads and forum posts.
Users, the bot's own user, its guilds and DMs.
Voice regions and voice states. To join voice channels, see Lingo.Voice.
Webhooks and the messages they send.
The behaviour for your bot module.
Declaring application commands, imported by use Lingo.Bot. Each declared
command is handled in Lingo.Bot.handle_command/2.
Builders for application command options, imported by use Lingo.Bot.
URLs for images on Discord's CDN.
What the gateway and REST API have told the bot, read from ETS: cheap, and
never contacting Discord. Each resource has a module, mirroring Lingo.Api
Cached channels, threads and DMs. See Lingo.Cache for enabling and configuring the cache.
Cached guilds. See Lingo.Cache for enabling and configuring the cache.
Cached guild members. See Lingo.Cache for enabling and configuring the cache.
Recent messages. See Lingo.Cache for enabling and configuring the cache.
Cached presences. See Lingo.Cache for enabling and configuring the cache.
Cached roles. See Lingo.Cache for enabling and configuring the cache.
Cached users. See Lingo.Cache for enabling and configuring the cache.
Cached voice states: who is in which voice channel. See Lingo.Cache for enabling and configuring the cache.
A command that didn't pass one of its :checks, or is on cooldown (see
Lingo.Bot.Commands.command/3).
Waiting for button clicks and reactions inline, instead of in a separate callback.
Builders for message components: buttons and select menus. They return the maps Discord expects.
Builders for components v2: text, images, files and containers laid out
in the message itself. Messages using them need the Lingo.Component.v2_flag/0
flag and can't have :content or :embeds.
Builders for modals and their inputs. Open one with
Lingo.Context.show_modal/2; the submission reaches
Lingo.Bot.handle_modal/2, with field values keyed by custom id.
An interaction your bot is handling: a slash or context menu command, a component click, a modal submission or an autocomplete request.
Builds message embeds.
Receiving interactions and webhook events over HTTP, instead of (or next to) the gateway.
A failed Discord API call.
The events Lingo.Bot.handle_event/2 receives: every one Discord sends,
named as Discord names it, lowercased.
The payload of the :application_authorized webhook event: a user added
the application to a guild (integration_type: :guild, with guild) or
to their account (:user).
The payload of the :application_deauthorized webhook event: a user
removed the application from their account.
The payload of :auto_moderation_action_execution: an auto moderation
rule acted on a message or member.
The payload of :channel_info, the answer to
Lingo.Gateway.request_channel_info/2: the requested fields of a guild's
channels, such as voice channel statuses.
The payload of :channel_pins_update: a message was pinned or unpinned.
It's not sent when a pinned message is deleted.
The payload of :guild_ban_add and :guild_ban_remove.
The payload of :guild_delete. unavailable is true when the guild is
down in an outage (it comes back with a :guild_create), and false when
the bot left or was removed. old is the guild as cached, or nil.
The payload of :guild_emojis_update: a guild's full emoji list after a
change. old is the list as cached, or nil when the guild isn't cached.
The payload of :guild_integrations_update: a guild's integrations changed.
The payload of :guild_member_remove: a user left, or was kicked or
banned. old is the member as cached, or nil.
The payload of :guild_members_chunk: one part of the answer to
Lingo.Gateway.request_guild_members/2, numbered by chunk_index out of
chunk_count. not_found lists the requested user ids that aren't
members; nonce is the request's.
The payload of :guild_role_delete. old is the role as cached, or nil.
The payload of :guild_stickers_update: a guild's full sticker list after
a change. old is the list as cached, or nil when the guild isn't cached.
The payload of :integration_delete. application_id is set when the
integration was a bot or OAuth2 application.
The payload of :invite_delete.
The payload of the :lobby_message_delete webhook event.
The payload of :message_delete. old is the message as cached, or nil.
The payload of :message_delete_bulk: several messages deleted at once.
old holds those of them that were cached.
The payload of :message_poll_vote_add and :message_poll_vote_remove.
The payload of :rate_limited: Discord refused a gateway request, such as
Lingo.Gateway.request_guild_members/2, for retry_after ms.
The payload of :message_reaction_add, :message_reaction_remove and
:message_reaction_remove_emoji (which has no user_id or member).
burst marks super reactions.
The payload of :message_reaction_remove_all: every reaction on a message was removed.
The payload of :ready: a shard started a new session.
The payload of :resumed: a shard reconnected and resumed its session,
replaying the events it missed.
The payload of :guild_scheduled_event_user_add and
:guild_scheduled_event_user_remove: a user subscribed to a scheduled
event, or stopped.
The payload of :guild_soundboard_sound_delete.
The payload of :guild_soundboard_sounds_update (several of a guild's
sounds changed at once) and :soundboard_sounds (the answer to
Lingo.Gateway.request_soundboard_sounds/1).
The payload of :thread_delete. Discord sends only the thread's ids and
type; old is the thread as cached, or nil.
The payload of :thread_list_sync: the active threads of a guild, or of
some of its channels (channel_ids, nil for the whole guild), sent when
the bot gains access to them. members are the bot's own memberships.
The payload of :thread_members_update: users were added to or removed
from a thread. id is the thread's; member_count stops at 50.
The payload of :typing_start. member is set in guilds.
The payload of :unknown: an event Lingo doesn't know yet. type is
Discord's name for it, such as "GUILD_SOMETHING_NEW", and data its
payload as Discord sent it, with string keys.
The payload of :voice_channel_effect_send: someone sent an emoji
reaction or a soundboard sound in a voice channel the bot is in.
animation_type is :premium or :basic; sound_id is a snowflake for
guild sounds and an integer for Discord's default ones.
The payload of :voice_channel_start_time_update: when a voice channel's
current call started, or nil once it's empty. id is the channel's.
The payload of :voice_channel_status_update. id is the channel's.
The payload of :webhooks_update: a channel's webhooks changed.
An event Lingo couldn't build a payload for, such as one whose shape
Discord changed. It never reaches Lingo.Bot.handle_event/2, whose
clauses expect the parsed payload; Lingo.Bot.handle_error/2 gets this
error with {event, data}, Discord's raw data with string keys.
Flag bitfields other than permissions (see Lingo.Permissions).
Markdown for mentions, emojis and timestamps (rendered in each reader's locale), escaping, and message links.
The bot's gateway connection: presence, requests sent over the gateway, and its shards.
Keeps gateway sessions across restarts of the whole bot, so a redeployed bot resumes its shards instead of identifying them again.
A Lingo.Gateway.SessionStore that keeps sessions in a local file, for a
bot that restarts on the same machine.
What the bot can do in a channel.
What the bot can do to a member, and how members are shown.
Whether the bot can manage a role, and how roles rank.
OAuth2: sending users to authorize the app, trading the code for their token, and calling the API as them (their profile, guilds and guild memberships, connections and linked role data).
Permission bitfields.
Builds message polls.
Discord ids ("snowflakes"). Lingo keeps them as strings, as Discord sends them; they encode their creation time.
Telemetry events Lingo emits, for metrics and alerts: what happens inside
Lingo, as opposed to the Discord events a bot handles (see Lingo.Event).
Testing a bot without Discord: interactions and events go through the bot's real callbacks, checks and collectors, and every API call it makes is recorded instead of sent.
An OAuth2 token, from Lingo.OAuth2. expires_at is when it stops
working, counted from when Discord answered; refresh it with
Lingo.OAuth2.refresh/2 before then. The client credentials grant gives
no refresh_token.
What a user is doing: playing, streaming, listening, watching, a custom status or competing.
A running instance of the app's Activity, from
Lingo.Api.Application.get_activity_instance/1. users are the ids of
the users in it; location says where it runs, with kind
:guild_channel or :private_channel (a DM or group DM).
An application: the bot's own, from Lingo.Api.Application.get_current/0,
or a partial one inside messages, attachments and invites.
An application command, as declared with Lingo.Bot.Commands.command/3 or returned by Discord.
A file attached to a message.
A guild's audit log, from Lingo.Api.AuditLog.get/2: its entries and the
commands, rules, events, integrations, threads, users and webhooks they
refer to. Integrations are partial.
One audit log entry. Also the payload of :guild_audit_log_entry_create events.
An auto moderation rule.
A guild ban: the banned user and the reason.
A guild channel, thread, DM or group DM.
An application command option, built with Lingo.Bot.Options.
The permissions of one command in a guild: which roles, users and channels may use it.
An account a user connected to Discord (connections OAuth2 scope):
type is the service, such as "github" or "steam", and name the
account's name there. integrations are partial guild integrations.
A message embed. Build one with Lingo.Embed.build/1.
A custom or unicode emoji.
An entitlement: a user's or guild's access to a SKU.
A guild (server).
A guild template.
A guild's public widget, from Lingo.Api.Guild.get_widget/1: the voice
and stage channels open to @everyone, and up to 100 online members.
A guild's incident actions and detections: until when invites and DMs are
paused (see Lingo.Api.Guild.update_incident_actions/2), and when Discord
last detected DM spam or a raid.
A guild integration: a bot, or a Twitch, YouTube or other connection.
A raw interaction. Bot callbacks get a Lingo.Context instead, which wraps it.
An invite to a guild or group DM.
A Social SDK lobby: a group of players. metadata is the string map the
lobby was given; linked_channel is the guild text channel it's linked to,
if any.
A member of a Lingo.Type.Lobby. id is the user's id and
additional_name an extra display name, such as an in-game character's;
can_link_lobby?/1 says whether they may link the lobby to a channel.
A message sent in a Social SDK lobby. metadata is the string map the
sender attached and moderation_metadata the one set with
Lingo.Api.Lobby.update_moderation_metadata/3; lobby_member holds the
author's additional_name when they had one. timestamp and
edited_timestamp come with updates.
A guild member: the user plus their nickname, roles and guild-specific state.
A message.
A guild's onboarding: the questions (prompts) new members answer and the
channels they get by default.
A permission overwrite on a channel, for a :role or a :member.
A message's poll. Build one to send with Lingo.Poll.build/3.
A member's status and activities.
The reactions with one emoji on a message.
A guild role.
One of the application's role connection metadata records: a value users
carry (see Lingo.OAuth2.update_role_connection/3) that guilds compare
against to grant linked roles.
Something the application sells. type is :durable, :consumable,
:subscription or :subscription_group (the group Discord makes for a
subscription; list its subscriptions with the :subscription one).
A guild scheduled event.
A soundboard sound. Discord's default sounds have no guild_id; a sound
that isn't available belongs to a guild that lost the boosts it needs.
A live stage in a stage channel.
A sticker.
A pack of Discord's standard stickers.
A user's subscription to one of the application's SKUs. status is
:active, :ending (canceled, active until current_period_end) or
:inactive.
A user's membership in a thread.
A Discord user.
A voice region, whose id can be a voice or stage channel's rtc_region.
optimal marks the closest one; avoid deprecated ones.
A user's voice connection state in a guild.
A webhook.
The screen a community guild shows new members: its description and up
to 5 welcome_channels, maps with atom keys.
Voice: joining channels, playing audio and receiving it.
A connection to a Discord voice server (voice gateway v8): one per guild.
Plays anything ffmpeg can read: it transcodes the input to Ogg Opus in an
external ffmpeg process and streams the Opus packets out of its output.
Reads Opus packets out of Ogg Opus audio (RFC 3533, RFC 7845).
Reads Opus packets out of WebM and Matroska audio, the container YouTube and most streaming sites serve Opus in.