Browse Source

Add ChannelType property

pull/1094/head
Still Hsu 7 years ago
parent
commit
38a1295250
No known key found for this signature in database GPG Key ID: 8601A145FDA95209
4 changed files with 8 additions and 7 deletions
  1. +0
    -0
      src/Discord.Net.Core/Entities/Channels/ChannelType.cs
  2. +2
    -2
      src/Discord.Net.Core/Entities/Invites/IInvite.cs
  3. +2
    -2
      src/Discord.Net.Rest/API/Common/InviteChannel.cs
  4. +4
    -3
      src/Discord.Net.Rest/Entities/Invites/RestInvite.cs

src/Discord.Net.Rest/Entities/Channels/ChannelType.cs → src/Discord.Net.Core/Entities/Channels/ChannelType.cs View File


+ 2
- 2
src/Discord.Net.Core/Entities/Invites/IInvite.cs View File

@@ -1,5 +1,3 @@
using System.Threading.Tasks;

namespace Discord
{
public interface IInvite : IEntity<string>, IDeletable
@@ -11,6 +9,8 @@ namespace Discord

/// <summary> Gets the channel this invite is linked to. </summary>
IChannel Channel { get; }
/// <summary> Gets the type of the channel this invite is linked to. </summary>
ChannelType ChannelType { get; }
/// <summary> Gets the id of the channel this invite is linked to. </summary>
ulong ChannelId { get; }
/// <summary> Gets the name of the channel this invite is linked to. </summary>


+ 2
- 2
src/Discord.Net.Rest/API/Common/InviteChannel.cs View File

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

namespace Discord.API
@@ -10,6 +10,6 @@ namespace Discord.API
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
public int Type { get; set; }
}
}

+ 4
- 3
src/Discord.Net.Rest/Entities/Invites/RestInvite.cs View File

@@ -1,7 +1,6 @@
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Discord.API.Rest;
using Model = Discord.API.Invite;

namespace Discord.Rest
@@ -9,14 +8,15 @@ namespace Discord.Rest
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class RestInvite : RestEntity<string>, IInvite, IUpdateable
{
public ChannelType ChannelType { get; private set; }
public string ChannelName { get; private set; }
public string GuildName { get; private set; }
public int? PresenceCount { get; private set; }
public int? MemberCount { get; private set; }
public ulong ChannelId { get; private set; }
public ulong? GuildId { get; private set; }
internal IChannel Channel { get; private set; }
internal IGuild Guild { get; private set; }
internal IChannel Channel { get; }
internal IGuild Guild { get; }

public string Code => Id;
public string Url => $"{DiscordConfig.InviteUrl}{Code}";
@@ -41,6 +41,7 @@ namespace Discord.Rest
ChannelName = model.Channel.Name;
MemberCount = model.MemberCount.IsSpecified ? model.MemberCount.Value : null;
PresenceCount = model.PresenceCount.IsSpecified ? model.PresenceCount.Value : null;
ChannelType = (ChannelType)model.Channel.Type;
}
public async Task UpdateAsync(RequestOptions options = null)


Loading…
Cancel
Save