public void AddMessage(DiscordMessage message)
        {
            DiscordChannel channel = Convert.ChangeType(message.Channel(), typeof(DiscordChannel));

            messageHistoryCache.Add(message);
            if (currentChannel == message.Channel())
            {
                Dispatcher.Invoke(() => AppendMessage(message));
            }
        }
        public void GetLastMessageReceived(Action <object> callback)
        {
            object callbackObject = new
            {
                Content      = LastMessageReceived.content,
                AuthorID     = LastMessageReceived.author.ID,
                AuthorName   = LastMessageReceived.author.Username,
                AuthorAvatar = LastMessageReceived.author.Avatar,
                ChannelID    = LastMessageReceived.Channel().ID,
                ChannelName  = LastMessageReceived.Channel().Name,
                ServerID     = LastMessageReceived.Channel().parent.id,
                ServerName   = LastMessageReceived.Channel().parent.name
            };

            callback.Invoke(callbackObject);
        }
        public void SendMessage(Action <object> callback, string serverID, string channelID, string message)
        {
            DiscordServer server = client.GetServersList().Find(x => x.id == serverID);

            if (server != null)
            {
                DiscordChannel channel = server.channels.Find(x => x.ID == channelID);
                if (channel != null)
                {
                    DiscordMessage messageSent     = channel.SendMessage(message);
                    object         messageCallback = new
                    {
                        MessageID        = messageSent.id,
                        MessageContent   = messageSent.content,
                        MessageChannelID = messageSent.Channel().ID,
                        MessageServerID  = messageSent.Channel().parent.id,
                        MessageAuthorID  = messageSent.author.ID
                    };
                    callback.Invoke(messageCallback);
                }
            }
            callback.Invoke(null);
        }
        public void AppendMessage(DiscordMessage message)
        {
            if (message.Author != null && App.ClientConfiguration.Settings.IgnoredUserIDs.Contains(message.Author.ID))
            {
                return;
            }
            DiscordChannel channel        = message.Channel() as DiscordChannel;
            var            markdownParser = new Markdown(channel.Parent, null);
            var            blocks         = markdownParser.Transform(message, $"{message.ID};{channel.ID}");

            richTextBox.Document.Blocks.AddRange(blocks);
            ToolTip = $"Sent at {message.timestamp}";
            MessageIDs.Add(message.ID);
            Messages.Add(message);
        }
 public void RemoveMessage(DiscordMessage m)
 {
     RemoveMessage(m.ID, (m.Channel() as DiscordChannel).ID);
 }