Esempio n. 1
0
        public static List <string> ExtractRoleSubsetFromUser(ulong UserID, List <string> soughtRoles, bool byID = false)
        {
            var           userRoles = Uno_Cache.GetUser(UserID)?.Roles;
            List <string> result    = new List <string>();

            if (userRoles == null)
            {
                return(result);
            }
            foreach (SocketRole role in userRoles)
            {
                if (!byID)
                {
                    if (soughtRoles.Contains(role.Name))
                    {
                        result.Add(role.Name);
                    }
                }
                else
                {
                    if (soughtRoles.Contains(role.Id.ToString()))
                    {
                        result.Add(role.Id.ToString());
                    }
                }
            }
            return(result);
        }
Esempio n. 2
0
        public static string GetUsername(ulong id)
        {
            string username = Uno_Cache.GetUser(id)?.Username;

            if (username == null)
            {
                username = SaveFiles_Mapped.SearchCachedUsername(id);
            }
            return(username);
        }