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.
Implements
Inherited Members
Namespace: VulcanAI.Connectors
Assembly: VulcanAI.dll
Syntax
public class DiscordConnector : IMessageConnector
Constructors
| Edit this page View SourceDiscordConnector(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 SourceIsReady
Gets whether the Discord client is ready to send and receive messages.
Declaration
public bool IsReady { get; }
Property Value
Type | Description |
---|---|
bool |
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 SourceSendMessageAsync(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 |
StartAsync()
Starts the Discord client and begins listening for messages.
Declaration
public Task StartAsync()
Returns
Type | Description |
---|---|
Task |
StopAsync()
Stops the Discord client and stops listening for messages.
Declaration
public Task StopAsync()
Returns
Type | Description |
---|---|
Task |
Events
| Edit this page View SourceOnMessageReceived
Occurs when a message is received from Discord.
Declaration
public event EventHandler<Message>? OnMessageReceived
Event Type
Type | Description |
---|---|
EventHandler<Message> |