public async Task HandleNotificationAsync(ReactionRemovedNotification notification, CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { return; } var channel = notification.Channel as ITextChannel; if (channel is null) { return; } var message = await notification.Message.GetOrDownloadAsync(); if (message is null) { return; } var reaction = notification.Reaction; if (reaction is null) { return; } var emote = reaction.Emote as IEmoteEntity; await UnlogReactionAsync(channel, message, reaction, emote); }
public void Constructor_Always_PropertiesAreGiven() { var mockMessage = new Mock <ICacheable <IUserMessage, ulong> >(); var mockChannel = new Mock <IISocketMessageChannel>(); var mockReaction = new Mock <ISocketReaction>(); var uut = new ReactionRemovedNotification(mockMessage.Object, mockChannel.Object, mockReaction.Object); uut.Message.ShouldBeSameAs(mockMessage.Object); uut.Channel.ShouldBeSameAs(mockChannel.Object); uut.Reaction.ShouldBeSameAs(mockReaction.Object); }
public Task HandleNotificationAsync(ReactionRemovedNotification notification, CancellationToken cancellationToken) => ModifyRatings(notification.Message, notification.Reaction, ReactionState.Removed);
public Task HandleNotificationAsync(ReactionRemovedNotification notification, CancellationToken cancellationToken) => HandleReactionAsync(notification.Message, notification.Reaction);