mirror of
https://github.com/Myxelium/Lunaris2.0.git
synced 2026-04-09 06:09:39 +00:00
24 lines
814 B
C#
24 lines
814 B
C#
using Lunaris2.Handler.GoodByeCommand;
|
|
using Lunaris2.Notification;
|
|
using Lunaris2.SlashCommand;
|
|
using MediatR;
|
|
|
|
namespace Lunaris2.Handler;
|
|
|
|
public class MessageReceivedHandler(ISender mediator) : INotificationHandler<MessageReceivedNotification>
|
|
{
|
|
public async Task Handle(MessageReceivedNotification notification, CancellationToken cancellationToken)
|
|
{
|
|
switch (notification.Message.CommandName)
|
|
{
|
|
case Command.Hello.Name:
|
|
await mediator.Send(new HelloCommand.HelloCommand(notification.Message), cancellationToken);
|
|
break;
|
|
case Command.Goodbye.Name:
|
|
await mediator.Send(new GoodbyeCommand(notification.Message), cancellationToken);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
} |