Skip to content

Commit

Permalink
Add new field to LocalActivity for custom statuses: state
Browse files Browse the repository at this point in the history
  • Loading branch information
AnotherZane committed Dec 18, 2023
1 parent 5b98542 commit 27672f3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Disqord.Gateway/Entities/Local/LocalActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ public static LocalActivity Watching(string name)
return new(name, ActivityType.Watching);
}

public static LocalActivity Custom(string state)
{
return new("Custom Status", ActivityType.Custom, state: state);
}

public static LocalActivity Competing(string name)
{
return new(name, ActivityType.Competing);
Expand All @@ -37,6 +42,8 @@ public static LocalActivity Competing(string name)

public Optional<ActivityType> Type { get; set; }

public Optional<string> State { get; set; }

public LocalActivity()
{ }

Expand All @@ -45,13 +52,15 @@ protected LocalActivity(LocalActivity other)
Name = other.Name;
Url = other.Url;
Type = other.Type;
State = other.State;
}

public LocalActivity(string name, ActivityType type, string? url = null)
public LocalActivity(string name, ActivityType type, string? url = null, string? state = null)
{
Name = name;
Url = Optional.FromNullable(url);
Type = type;
State = Optional.FromNullable(state);
}

public LocalActivity(string name, string url)
Expand All @@ -76,7 +85,8 @@ public virtual ActivityJsonModel ToModel()
{
Name = Name.Value,
Type = Type.Value,
Url = Url
Url = Url,
State = State
};
}
}

0 comments on commit 27672f3

Please sign in to comment.