Table of Contents

Interface IChannel

Namespace
JD.AI.Core.Channels
Assembly
JD.AI.Core.dll

Unified abstraction for a messaging channel (Discord, Slack, Signal, Web, etc.).

public interface IChannel : IAsyncDisposable
Inherited Members

Properties

ChannelType

Unique channel type identifier (e.g., "discord", "signal", "web").

string ChannelType { get; }

Property Value

string

DisplayName

Display name for this channel instance.

string DisplayName { get; }

Property Value

string

IsConnected

Whether the channel is currently connected and healthy.

bool IsConnected { get; }

Property Value

bool

Methods

ConnectAsync(CancellationToken)

Connects to the messaging platform.

Task ConnectAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

Task

DisconnectAsync(CancellationToken)

Gracefully disconnects.

Task DisconnectAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

Task

ReactAsync(string, string, string, CancellationToken)

Adds a reaction emoji to a message. Not all channels support this — default is no-op.

Task ReactAsync(string conversationId, string messageId, string emoji, CancellationToken ct = default)

Parameters

conversationId string
messageId string
emoji string
ct CancellationToken

Returns

Task

SendMessageAsync(string, string, CancellationToken)

Sends a message to the specified conversation/thread.

Task SendMessageAsync(string conversationId, string content, CancellationToken ct = default)

Parameters

conversationId string
content string
ct CancellationToken

Returns

Task

SendMessageWithAttachmentsAsync(string, string?, IReadOnlyList<OutboundAttachment>, CancellationToken)

Sends a message with file attachments. Channels that don't support attachments fall back to sending the text content only.

Task SendMessageWithAttachmentsAsync(string conversationId, string? content, IReadOnlyList<OutboundAttachment> attachments, CancellationToken ct = default)

Parameters

conversationId string
content string
attachments IReadOnlyList<OutboundAttachment>
ct CancellationToken

Returns

Task

Events

MessageReceived

Raised when a new inbound message arrives.

event Func<ChannelMessage, Task>? MessageReceived

Event Type

Func<ChannelMessage, Task>

Remarks

Uses Func<ChannelMessage, Task> instead of EventHandler to support async handlers.