Changed GameId from string to nullable int
This commit is contained in:
@@ -82,9 +82,6 @@
|
||||
<Compile Include="..\Discord.Net\API\Converters\LongStringConverter.cs">
|
||||
<Link>API\Converters\LongStringConverter.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Discord.Net\API\Converters\ShortStringConverter.cs">
|
||||
<Link>API\Converters\ShortStringConverter.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Discord.Net\API\Endpoints.cs">
|
||||
<Link>API\Endpoints.cs</Link>
|
||||
</Compile>
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
namespace Discord.API.Converters
|
||||
{
|
||||
/*internal class ShortStringConverter : JsonConverter
|
||||
{
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return objectType == typeof(short);
|
||||
}
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
return IdConvert.ToShort((string)reader.Value);
|
||||
}
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
{
|
||||
writer.WriteValue(IdConvert.ToString((short)value));
|
||||
}
|
||||
}
|
||||
|
||||
internal class NullableShortStringConverter : JsonConverter
|
||||
{
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return objectType == typeof(short?);
|
||||
}
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
return IdConvert.ToNullableShort((string)reader.Value);
|
||||
}
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
{
|
||||
writer.WriteValue(IdConvert.ToString((short?)value));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -49,7 +49,7 @@ namespace Discord.API
|
||||
public class PresenceInfo : MemberReference
|
||||
{
|
||||
[JsonProperty("game_id")]
|
||||
public string GameId;
|
||||
public int? GameId;
|
||||
[JsonProperty("status")]
|
||||
public string Status;
|
||||
[JsonProperty("roles")] //TODO: Might be temporary
|
||||
|
||||
@@ -6,20 +6,12 @@ namespace Discord
|
||||
internal static class IdConvert
|
||||
{
|
||||
internal static readonly IFormatProvider _format = CultureInfo.InvariantCulture;
|
||||
|
||||
public static short ToShort(string value)
|
||||
=> short.Parse(value, NumberStyles.None, _format);
|
||||
public static short? ToNullableShort(string value)
|
||||
=> value == null ? (short?)null : short.Parse(value, NumberStyles.None, _format);
|
||||
|
||||
public static long ToLong(string value)
|
||||
=> long.Parse(value, NumberStyles.None, _format);
|
||||
public static long? ToNullableLong(string value)
|
||||
=> value == null ? (long?)null : long.Parse(value, NumberStyles.None, _format);
|
||||
|
||||
public static string ToString(short value)
|
||||
=> value.ToString(_format);
|
||||
public static string ToString(short? value)
|
||||
=> value?.ToString(_format);
|
||||
|
||||
public static string ToString(long value)
|
||||
=> value.ToString(_format);
|
||||
public static string ToString(long? value)
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Discord
|
||||
public string Token { get; private set; }
|
||||
|
||||
/// <summary> Returns the id for the game this user is currently playing. </summary>
|
||||
public string GameId { get; private set; }
|
||||
public int? GameId { get; private set; }
|
||||
/// <summary> Returns the current status for this user. </summary>
|
||||
public UserStatus Status { get; private set; }
|
||||
/// <summary> Returns the time this user last sent/edited a message, started typing or sent voice data in this server. </summary>
|
||||
|
||||
Reference in New Issue
Block a user