Browse Source

Refactor GameParty to use dedicated current/capacity values

Per feedback from @khionu
pull/877/head
Christopher F 7 years ago
parent
commit
cb768f55b0
2 changed files with 11 additions and 2 deletions
  1. +2
    -1
      src/Discord.Net.Core/Entities/Activities/GameParty.cs
  2. +9
    -1
      src/Discord.Net.WebSocket/Extensions/EntityExtensions.cs

+ 2
- 1
src/Discord.Net.Core/Entities/Activities/GameParty.cs View File

@@ -5,6 +5,7 @@
internal GameParty() { } internal GameParty() { }


public string Id { get; internal set; } public string Id { get; internal set; }
public int[] Size { get; internal set; }
public int Members { get; internal set; }
public int Capacity { get; internal set; }
} }
} }

+ 9
- 1
src/Discord.Net.WebSocket/Extensions/EntityExtensions.cs View File

@@ -56,10 +56,18 @@


public static GameParty ToEntity(this API.GameParty model) public static GameParty ToEntity(this API.GameParty model)
{ {
// Discord will probably send bad data since they don't validate anything
int current = 0, cap = 0;
if (model.Size.Length == 2)
{
current = model.Size[0];
cap = model.Size[1];
}
return new GameParty return new GameParty
{ {
Id = model.Id, Id = model.Id,
Size = model.Size
Members = current,
Capacity = cap,
}; };
} }




Loading…
Cancel
Save