MediatR Guide + sample (#2218)

* Add guide for MediatR

* Add sample for MediatR

* Fix exposed token in program.cs

* Fix review points

* Remove newline in MediatrDiscordEventListener.cs
This commit is contained in:
Duke
2022-04-05 19:18:25 +02:00
committed by GitHub
parent d8757a5afa
commit 53ab9f3b16
15 changed files with 354 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
// MessageReceivedHandler.cs
using System;
using MediatR;
using MediatRSample.Notifications;
namespace MediatRSample;
public class MessageReceivedHandler : INotificationHandler<MessageReceivedNotification>
{
public async Task Handle(MessageReceivedNotification notification, CancellationToken cancellationToken)
{
Console.WriteLine($"MediatR works! (Received a message by {notification.Message.Author.Username})");
// Your implementation
}
}