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:
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user