Jido Chat Discord

Hex.pmHex DocsCILicenseWebsiteEcosystemDiscord

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"}
  ]
end

Usage

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:

It is skipped by default. To run it:

  1. Copy and fill local env file:
cp .env.example .env
  1. Run:
mix test test/jido/chat/discord/live_integration_test.exs --include live

Current live coverage includes:

Ingress Modes (listener_child_specs/2)

The Discord adapter ingress callback supports:

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"]}
  )