Browse Source

Update VoiceRegion model (#1030)

tags/2.0
Still Hsu Christopher F 7 years ago
parent
commit
510f4745ea
3 changed files with 21 additions and 16 deletions
  1. +6
    -6
      src/Discord.Net.Core/Entities/Guilds/IVoiceRegion.cs
  2. +5
    -5
      src/Discord.Net.Rest/API/Common/VoiceRegion.cs
  3. +10
    -5
      src/Discord.Net.Rest/Entities/Guilds/RestVoiceRegion.cs

+ 6
- 6
src/Discord.Net.Core/Entities/Guilds/IVoiceRegion.cs View File

@@ -1,4 +1,4 @@
namespace Discord
namespace Discord
{
public interface IVoiceRegion
{
@@ -10,9 +10,9 @@
bool IsVip { get; }
/// <summary> Returns true if this voice region is the closest to your machine. </summary>
bool IsOptimal { get; }
/// <summary> Gets an example hostname for this voice region. </summary>
string SampleHostname { get; }
/// <summary> Gets an example port for this voice region. </summary>
int SamplePort { get; }
/// <summary> Returns true if this is a deprecated voice region (avoid switching to these). </summary>
bool IsDeprecated { get; }
/// <summary> Returns true if this is a custom voice region (used for events/etc) </summary>
bool IsCustom { get; }
}
}
}

+ 5
- 5
src/Discord.Net.Rest/API/Common/VoiceRegion.cs View File

@@ -1,4 +1,4 @@
#pragma warning disable CS1591
#pragma warning disable CS1591
using Newtonsoft.Json;

namespace Discord.API
@@ -13,9 +13,9 @@ namespace Discord.API
public bool IsVip { get; set; }
[JsonProperty("optimal")]
public bool IsOptimal { get; set; }
[JsonProperty("sample_hostname")]
public string SampleHostname { get; set; }
[JsonProperty("sample_port")]
public int SamplePort { get; set; }
[JsonProperty("deprecated")]
public bool IsDeprecated { get; set; }
[JsonProperty("custom")]
public bool IsCustom { get; set; }
}
}

+ 10
- 5
src/Discord.Net.Rest/Entities/Guilds/RestVoiceRegion.cs View File

@@ -1,4 +1,4 @@
using Discord.Rest;
using Discord.Rest;
using System.Diagnostics;
using Model = Discord.API.VoiceRegion;

@@ -7,11 +7,16 @@ namespace Discord
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class RestVoiceRegion : RestEntity<string>, IVoiceRegion
{
/// <inheritdoc />
public string Name { get; private set; }
/// <inheritdoc />
public bool IsVip { get; private set; }
/// <inheritdoc />
public bool IsOptimal { get; private set; }
public string SampleHostname { get; private set; }
public int SamplePort { get; private set; }
/// <inheritdoc />
public bool IsDeprecated { get; private set; }
/// <inheritdoc />
public bool IsCustom { get; private set; }

internal RestVoiceRegion(BaseDiscordClient client, string id)
: base(client, id)
@@ -28,8 +33,8 @@ namespace Discord
Name = model.Name;
IsVip = model.IsVip;
IsOptimal = model.IsOptimal;
SampleHostname = model.SampleHostname;
SamplePort = model.SamplePort;
IsDeprecated = model.IsDeprecated;
IsCustom = model.IsCustom;
}

public override string ToString() => Name;


Loading…
Cancel
Save