You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

MediatrMessageReceivedHandler.cs 460 B

12345678910111213141516
  1. // MessageReceivedHandler.cs
  2. using MediatR;
  3. using MediatRSample.Notifications;
  4. namespace MediatRSample;
  5. public class MessageReceivedHandler : INotificationHandler<MessageReceivedNotification>
  6. {
  7. public async Task Handle(MessageReceivedNotification notification, CancellationToken cancellationToken)
  8. {
  9. Console.WriteLine($"MediatR works! (Received a message by {notification.Message.Author.Username})");
  10. // Your implementation
  11. }
  12. }