Example #1
0
 /// <summary>
 /// Returns a XanBotMember created from the data in a <seealso cref="ShallowXanBotMember"/>.
 /// </summary>
 /// <param name="shallow">The <seealso cref="ShallowXanBotMember"/> reference to create the member from.</param>
 /// <returns></returns>
 // This might be removed.
 public static XanBotMember GetMemberFromShallow(ShallowXanBotMember shallow)
 {
     try
     {
         DiscordUser  user   = XanBotCoreSystem.Client.GetUserAsync(shallow.UserId).GetAwaiter().GetResult();
         DiscordGuild server = XanBotCoreSystem.Client.GetGuildAsync(shallow.ServerId).GetAwaiter().GetResult();
         return(GetMemberFromUser(server, user));
     }
     catch (Exception)
     {
         return(null);
     }
 }
Example #2
0
        public static ShallowXanBotMember GetShallowFromRaw(ulong userId, ulong serverId)
        {
            foreach (ShallowXanBotMember shallow in ShallowMembers)
            {
                if (shallow.CompareShallowMember(userId, serverId))
                {
                    return(shallow);
                }
            }
            ShallowXanBotMember member = new ShallowXanBotMember(userId, serverId);

            ShallowMembers.Add(member);
            return(member);
        }
Example #3
0
        public static ShallowXanBotMember GetShallowFromDeep(XanBotMember fullMemberObject)
        {
            foreach (ShallowXanBotMember shallow in ShallowMembers)
            {
                if (shallow.DoesShallowRepresentDeep(fullMemberObject))
                {
                    return(shallow);
                }
            }
            ShallowXanBotMember member = new ShallowXanBotMember(fullMemberObject.BaseUser.Id, fullMemberObject.Context.ServerId);

            ShallowMembers.Add(member);
            return(member);
        }