mirror of
https://github.com/Myxelium/Lunaris2.0.git
synced 2026-04-11 15:19:53 +00:00
Add chat functionality (#1)
* Working chatbot * Clean * Working LLM chatbot --------- Co-authored-by: Myx <info@azaaxin.com>
This commit is contained in:
@@ -19,13 +19,19 @@ public class DiscordEventListener(DiscordSocketClient client, IServiceScopeFacto
|
||||
|
||||
public async Task StartAsync()
|
||||
{
|
||||
client.SlashCommandExecuted += OnMessageReceivedAsync;
|
||||
client.SlashCommandExecuted += OnSlashCommandRecievedAsync;
|
||||
client.MessageReceived += OnMessageReceivedAsync;
|
||||
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task OnMessageReceivedAsync(SocketSlashCommand arg)
|
||||
private async Task OnMessageReceivedAsync(SocketMessage arg)
|
||||
{
|
||||
await Mediator.Publish(new MessageReceivedNotification(arg), _cancellationToken);
|
||||
}
|
||||
|
||||
private async Task OnSlashCommandRecievedAsync(SocketSlashCommand arg)
|
||||
{
|
||||
await Mediator.Publish(new SlashCommandReceivedNotification(arg), _cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ using MediatR;
|
||||
|
||||
namespace Lunaris2.Notification;
|
||||
|
||||
public class MessageReceivedNotification(SocketSlashCommand message) : INotification
|
||||
public class MessageReceivedNotification(SocketMessage message) : INotification
|
||||
{
|
||||
public SocketSlashCommand Message { get; } = message ?? throw new ArgumentNullException(nameof(message));
|
||||
public SocketMessage Message { get; } = message ?? throw new ArgumentNullException(nameof(message));
|
||||
}
|
||||
9
Bot/Notification/SlashCommandReceivedNotification.cs
Normal file
9
Bot/Notification/SlashCommandReceivedNotification.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Discord.WebSocket;
|
||||
using MediatR;
|
||||
|
||||
namespace Lunaris2.Notification;
|
||||
|
||||
public class SlashCommandReceivedNotification(SocketSlashCommand message) : INotification
|
||||
{
|
||||
public SocketSlashCommand Message { get; } = message ?? throw new ArgumentNullException(nameof(message));
|
||||
}
|
||||
Reference in New Issue
Block a user