コード例 #1
0
ファイル: EmojiUsageHandler.cs プロジェクト: calledude/MODiX
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public Task HandleNotificationAsync(ReactionRemovedNotification notification, CancellationToken cancellationToken)
 => ModifyRatings(notification.Message, notification.Reaction, ReactionState.Removed);
コード例 #4
0
ファイル: StarboardHandler.cs プロジェクト: Foxtrek64/MODiX
 public Task HandleNotificationAsync(ReactionRemovedNotification notification, CancellationToken cancellationToken)
 => HandleReactionAsync(notification.Message, notification.Reaction);