/// <summary>
        /// 
        /// </summary>
        /// <param name="channel"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public DiscordMember GetMemberFromChannel(DiscordChannelBase channel, string id)
        {
            if (channel != null)
            {
                if (channel.GetType() == typeof(DiscordChannel)) //regular
                {

                    DiscordMember foundMember = ((DiscordChannel)channel).Parent.GetMemberByKey(id);
                    if (foundMember != null)
                        return foundMember;
                    else
                    {
                        DebugLogger.Log($"Error in GetMemberFromChannel: foundMember was null! ID: {id}", MessageLevel.Error);
                    }
                }
                else if(channel.GetType() == typeof(DiscordPrivateChannel))
                {
                    return ((DiscordPrivateChannel)channel).Recipient;
                }
            }
            else
            {
                DebugLogger.Log("Error in GetMemberFromChannel: channel was null!", MessageLevel.Error);
            }
            return null;
        }
        /// <summary>
        /// Returns a List of DiscordMessages. 
        /// </summary>
        /// <param name="channel">The channel to return them from.</param>
        /// <param name="count">How many to return</param>
        /// <param name="idBefore">Messages before this message ID.</param>
        /// <param name="idAfter">Messages after this message ID.</param>
        /// <returns>A List of DiscordMessages that you can iterate through.</returns>
        public List<DiscordMessage> GetMessageHistory(DiscordChannelBase channel, int count, string idBefore = "", string idAfter = "")
        {
            string request = "https://discordapp.com/api/channels/" + channel.ID + $"/messages?&limit={count}";
            if (!string.IsNullOrEmpty(idBefore))
                request += $"&before={idBefore}";
            if (string.IsNullOrEmpty(idAfter))
                request += $"&after={idAfter}";

            JArray result = null;

            try
            {
                string res = WebWrapper.Get(request, token);
                result = JArray.Parse(res);
            }
            catch (Exception ex)
            {
                DebugLogger.Log($"Error ocurred while getting message history for channel {channel.ID}: {ex.Message}", MessageLevel.Error);
            }

            if (result != null)
            {
                List<DiscordMessage> messageList = new List<DiscordMessage>();
                /// NOTE
                /// For some reason, the d object is excluded from this.
                foreach (var item in result.Children())
                {
                    messageList.Add(new DiscordMessage
                    {
                        ID = item["id"].ToString(),
                        channel = channel,
                        Attachments = item["attachments"].ToObject<DiscordAttachment[]>(),
                        TypeOfChannelObject = channel.GetType(),
                        Author = GetMemberFromChannel(channel, item["author"]["id"].ToString()),
                        Content = item["content"].ToString(),
                        RawJson = item.ToObject<JObject>(),
                        timestamp = DateTime.Parse(item["timestamp"].ToString())
                    });
                }
                return messageList;
            }

            return null;
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="channel"></param>
 /// <param name="username"></param>
 /// <param name="caseSensitive"></param>
 /// <returns></returns>
 public DiscordMember GetMemberFromChannel(DiscordChannelBase channel, string username, bool caseSensitive)
 {
     if (string.IsNullOrEmpty(username))
         throw new ArgumentException("Argument given for username was null/empty.");
     if (channel != null)
     {
         if (channel.GetType() == typeof(DiscordChannel)) //regular channel
         {
             DiscordMember foundMember = ((DiscordChannel)channel).Parent.GetMemberByUsername(username, caseSensitive);
             if (foundMember != null)
             {
                 return foundMember;
             }
             else
             {
                 DebugLogger.Log("Error in GetMemberFromChannel: foundMember was null!", MessageLevel.Error);
             }
         }
         else if(channel.GetType() == typeof(DiscordPrivateChannel))
         {
             return ((DiscordPrivateChannel)channel).Recipient;
         }
     }
     else
     {
         DebugLogger.Log("Error in GetMemberFromChannel: channel was null!", MessageLevel.Error);
     }
     return null;
 }