Beispiel #1
0
        private Task DiscordClient_MessageDeleted(ulong msgId, Optional <SocketMessage> msg)
        {
            var found = ChatLogList.FirstOrDefault(x => x.Id == msgId);

            if (found.Id == 0)
            {
                return(Task.CompletedTask);
            }
            DispatcherHelper.CheckBeginInvokeOnUI(() => {
                ChatLogList.Remove(found);
            });
            return(Task.CompletedTask);
        }
Beispiel #2
0
        private Task DiscordClient_MessageUpdated(Optional <SocketMessage> before, SocketMessage after)
        {
            if (after.Channel.Id != selectedChannel.ChannelId)
            {
                return(Task.CompletedTask);
            }

            var found = ChatLogList.FirstOrDefault(x => x.Id == after.Id);

            // didnt find
            if (found.Id == 0)
            {
                return(Task.CompletedTask);
            }

            DispatcherHelper.CheckBeginInvokeOnUI(() => {
                found.ChatText    = GetReplacedMessageText(after);
                found.TimeEdited  = after.EditedTimestamp?.ToLocalTime().ToString("g");
                found.Embeds      = after.Embeds;
                found.Attachments = after.Attachments;
                chatLogList.Refresh();
            });
            return(Task.CompletedTask);
        }