Coxir
A modern Elixir wrapper for Discord.
Install / Use
/learn @satom99/CoxirREADME
coxir
A modern high-level Elixir wrapper for Discord.
Refer to the documentation for more information.
Features
- Support for running multiple bots in a same application
- Configurable adapters that change how the library behaves:
- Limiter: handles how rate limit buckets are stored
- Storage: handles how entities are cached
- Sharder: handles how shards are started
- Player: handles the audio sent through voice
- Easy-to-use syntax for interacting with Discord entities
Installation
Add coxir as a dependency to your mix.exs file:
defp deps do
[{:coxir, git: "https://github.com/satom99/coxir.git"}]
end
Quickstart
Before consuming events, coxir must be configured:
config :coxir,
token: "",
intents: :non_privileged # optional
Then a simple consumer can be set up as follows:
defmodule Example.Bot do
use Coxir.Gateway
alias Coxir.{User, Message}
def handle_event({:MESSAGE_CREATE, %Message{content: "!hello"} = message}) do
%Message{author: author} = Message.preload(message, :author)
%User{username: username, discriminator: discriminator} = author
Message.reply(message, content: "Hello #{username}##{discriminator}!")
end
def handle_event(_event) do
:noop
end
end
Which can then be added to a Supervisor, or started directly:
iex(1)> Example.Bot.start_link()
{:ok, #PID<0.301.0>}
For a complete and working example check out the example app.
More
For more information check out the documentation guides.
Related Skills
imsg
343.1kiMessage/SMS CLI for listing chats, history, and sending messages via Messages.app.
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
discord
343.1kDiscord ops via the message tool (channel=discord).
