jido_chat_discord is the Discord adapter package for jido_chat.
Release Status
This package is being prepared for the Jido 1.x chat package release line. It is part of the Elixir implementation aligned to the Vercel Chat SDK (chat-sdk.dev/docs).
Jido.Chat.Discord.Adapter is the canonical adapter module and uses Nostrum as the Discord client.
Installation
def deps do
[
{:jido_chat_discord, "~> 1.0"}
]
endUsage
alias Jido.Chat.Discord.Adapter
{:ok, incoming} =
Adapter.transform_incoming(%{
channel_id: 123,
id: 456,
content: "hello",
guild_id: 999,
author: %{id: 321, username: "alice", global_name: "Alice"}
})
{:ok, sent} = Adapter.send_message(123, "hi")Live Integration Test
There is a live test module at:
test/jido/chat/discord/live_integration_test.exs
It is skipped by default. To run it:
- Copy and fill local env file:
cp .env.example .env
- Run:
mix test test/jido/chat/discord/live_integration_test.exs --include live
Current live coverage includes:
- send, edit, fetch, and delete
- typing and metadata
- stream fallback through core
Jido.Chat.Adapter.stream/4 - reply continuity through Discord
message_reference - reaction add/remove
- canonical single-file upload through
send_file/3 - canonical single-file post through core
post_message/4 - optional DM open when
DISCORD_TEST_USER_IDis set
Ingress Modes (listener_child_specs/2)
The Discord adapter ingress callback supports:
ingress.mode = "webhook": no listener workers ({:ok, []}), host HTTP handles ingress.ingress.mode = "gateway":- default
ingress.source = "nostrum": startsNostrumGatewayBufferNostrumGatewayListener(subscribes toNostrum.ConsumerGroup)GatewayWorker(consumes buffered events and emits viasink_mfa)
- optional
ingress.source = "mfa"withingress.event_source_mfa.
- default
Example:
{:ok, specs} =
Jido.Chat.Discord.Adapter.listener_child_specs("bridge_dc",
ingress: %{mode: "gateway", source: "nostrum"},
sink_mfa: {Jido.Messaging.IngressSink, :emit, [MyApp.Messaging, "bridge_dc"]}
)