You've already forked tribes-plugin-aether
forked from tribes/tribes-plugin-template
c1f4339dde
Use TribeOne.TribesPlugin.Aether modules throughout the plugin and expose chat@1 from the entry module for capability-based consumers.
36 lines
1011 B
Elixir
36 lines
1011 B
Elixir
defmodule TribeOne.TribesPlugin.Aether.Chat.Backends.PublicSync do
|
|
@moduledoc """
|
|
Plaintext Ash-backed chat backend for public and local DM-style conversations.
|
|
"""
|
|
|
|
@behaviour TribeOne.TribesPlugin.Aether.Chat.Backend
|
|
|
|
alias TribeOne.TribesPlugin.Aether.Chat
|
|
alias TribeOne.TribesPlugin.Aether.Chat.Channel
|
|
|
|
@impl true
|
|
def capabilities do
|
|
%{
|
|
canonical_store: :ash,
|
|
nostr_compatible?: false,
|
|
non_custodial_signing?: false,
|
|
conversation_kinds: [:group, :context_group, :dm],
|
|
read_only?: false
|
|
}
|
|
end
|
|
|
|
@impl true
|
|
def ensure_conversation(attrs, opts) when is_map(attrs), do: Chat.ensure_channel(attrs, opts)
|
|
|
|
@impl true
|
|
def list_messages(%Channel{} = channel, opts), do: Chat.list_messages(channel, opts)
|
|
|
|
@impl true
|
|
def send_message(%Channel{} = channel, attrs, opts) when is_map(attrs) do
|
|
Chat.post_message(channel, attrs, opts)
|
|
end
|
|
|
|
@impl true
|
|
def subscribe(%Channel{} = channel, _pid, _opts), do: Chat.subscribe_channel(channel)
|
|
end
|