@@ -324,8 +324,8 @@ namespace Discord | |||||
public void SetStatus(UserStatus status) | public void SetStatus(UserStatus status) | ||||
{ | { | ||||
if (status == null) throw new ArgumentNullException(nameof(status)); | if (status == null) throw new ArgumentNullException(nameof(status)); | ||||
if (status != UserStatus.Online && status != UserStatus.Idle && status != UserStatus.DoNotDisturb) | |||||
throw new ArgumentException($"Invalid status, must be {UserStatus.Online}, {UserStatus.Idle} or {UserStatus.DoNotDisturb}", nameof(status)); | |||||
if (status != UserStatus.Online && status != UserStatus.Idle && status != UserStatus.DoNotDisturb && status != UserStatus.Invisible) | |||||
throw new ArgumentException($"Invalid status, must be {UserStatus.Online}, {UserStatus.Idle}, {UserStatus.DoNotDisturb} or {UserStatus.Invisible}", nameof(status)); | |||||
Status = status; | Status = status; | ||||
SendStatus(); | SendStatus(); | ||||
@@ -10,6 +10,8 @@ | |||||
public static UserStatus Offline { get; } = new UserStatus("offline"); | public static UserStatus Offline { get; } = new UserStatus("offline"); | ||||
/// <summary> User is busy. </summary> | /// <summary> User is busy. </summary> | ||||
public static UserStatus DoNotDisturb { get; } = new UserStatus("dnd"); | public static UserStatus DoNotDisturb { get; } = new UserStatus("dnd"); | ||||
/// <summary> User is invisible. </summary> | |||||
public static UserStatus Invisible { get; } = new UserStatus("invisible"); | |||||
private UserStatus(string value) | private UserStatus(string value) | ||||
: base(value) { } | : base(value) { } | ||||
@@ -28,6 +30,8 @@ | |||||
return Offline; | return Offline; | ||||
case "dnd": | case "dnd": | ||||
return DoNotDisturb; | return DoNotDisturb; | ||||
case "invisible": | |||||
return Invisible; | |||||
default: | default: | ||||
return new UserStatus(value); | return new UserStatus(value); | ||||
} | } | ||||