Discord.Net/docs/guides/other_libs/samples/MediatrMessageReceivedHandler.cs

18 lines
474 B
C#
Raw Permalink Normal View History

2024-06-12 22:43:59 -07:00
// 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
}
}