Show / Hide Table of Contents

Class DiscordConnector

Implements the IMessageConnector for Discord, allowing the agent to send and receive messages through a Discord channel. Messages longer than Discord's 2000-character limit are automatically split into multiple messages.

Inheritance
object
DiscordConnector
Implements
IMessageConnector
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: VulcanAI.Connectors
Assembly: VulcanAI.dll
Syntax
public class DiscordConnector : IMessageConnector

Constructors

| Edit this page View Source

DiscordConnector(DiscordSocketClient, ILogger<DiscordConnector>, string, ulong)

Initializes a new instance of the DiscordConnector class.

Declaration
public DiscordConnector(DiscordSocketClient client, ILogger<DiscordConnector> logger, string token, ulong channelId)
Parameters
Type Name Description
DiscordSocketClient client

The Discord socket client.

ILogger<DiscordConnector> logger

The logger instance.

string token

The Discord bot token.

ulong channelId

The ID of the channel to monitor and send messages to.

Properties

| Edit this page View Source

IsReady

Gets whether the Discord client is ready to send and receive messages.

Declaration
public bool IsReady { get; }
Property Value
Type Description
bool
| Edit this page View Source

ReadyTask

Gets a task that completes when the Discord client is ready.

Declaration
public Task<bool> ReadyTask { get; }
Property Value
Type Description
Task<bool>

Methods

| Edit this page View Source

SendMessageAsync(Message)

Sends a message to the configured Discord channel.

Declaration
public Task SendMessageAsync(Message message)
Parameters
Type Name Description
Message message

The message to send.

Returns
Type Description
Task
| Edit this page View Source

StartAsync()

Starts the Discord client and begins listening for messages.

Declaration
public Task StartAsync()
Returns
Type Description
Task
| Edit this page View Source

StopAsync()

Stops the Discord client and stops listening for messages.

Declaration
public Task StopAsync()
Returns
Type Description
Task

Events

| Edit this page View Source

OnMessageReceived

Occurs when a message is received from Discord.

Declaration
public event EventHandler<Message>? OnMessageReceived
Event Type
Type Description
EventHandler<Message>

Implements

IMessageConnector
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX