Exemple #1
0
 /// <summary>
 /// Gets the color object derived from the status of a Discord user.
 /// </summary>
 public static System.Drawing.Color GetColorByStatus(UserStatus status)
 {
     return(status.EqualsAny(UserStatus.Offline, UserStatus.Invisible) ? new ImmutableColor(0x747F8D)
         : status == UserStatus.DoNotDisturb ? new ImmutableColor(0xF04747)
         : status.EqualsAny(UserStatus.AFK, UserStatus.Idle) ? new ImmutableColor(0xFAA61A)
         : status == UserStatus.Online ? new ImmutableColor(0x43B581)
         : throw new Exception("The UserStatus given is unspecified."));
 }
        public static string GetName(this UserStatus status)
        {
            if (status.EqualsAny(UserStatus.AFK, UserStatus.Idle))
            {
                return("Away");
            }
            if (status == UserStatus.DoNotDisturb)
            {
                return("Busy");
            }
            if (status.EqualsAny(UserStatus.Offline, UserStatus.Invisible))
            {
                return("Offline");
            }

            return("Online");
        }
Exemple #3
0
        public void Set(UserStatus status)
        {
            string s = "online";
            int    y = 0;

            if (status.EqualsAny(UserStatus.Idle, UserStatus.AFK))
            {
                s = "idling";
                y = 2;
            }
            else if (status.Equals(UserStatus.DoNotDisturb))
            {
                s = "busy";
                y = 4;
            }
            else if (status.EqualsAny(UserStatus.Offline, UserStatus.Invisible))
            {
                s = "offline";
                y = 6;
            }

            State = s;
            Y     = y;
        }