From e0935825b99a7b7456f3d5254cf3c96d3f93ebb5 Mon Sep 17 00:00:00 2001 From: Chris Johnston Date: Fri, 8 Mar 2019 22:34:18 -0800 Subject: [PATCH] add [Socket/Rest]NewsChannel types --- .../Entities/Channels/RestNewsChannel.cs | 28 +++++++++++++++++++ .../Entities/Channels/SocketNewsChannel.cs | 23 +++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/Discord.Net.Rest/Entities/Channels/RestNewsChannel.cs create mode 100644 src/Discord.Net.WebSocket/Entities/Channels/SocketNewsChannel.cs diff --git a/src/Discord.Net.Rest/Entities/Channels/RestNewsChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestNewsChannel.cs new file mode 100644 index 000000000..82f96e923 --- /dev/null +++ b/src/Discord.Net.Rest/Entities/Channels/RestNewsChannel.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Model = Discord.API.Channel; + +namespace Discord.Rest +{ + /// + /// Represents a REST-based news channel in a guild that has the same properties as a . + /// + [DebuggerDisplay(@"{DebuggerDisplay,nq}")] + public class RestNewsChannel : RestTextChannel + { + internal RestNewsChannel(BaseDiscordClient discord, IGuild guild, ulong id) + :base(discord, guild, id) + { + } + internal new static RestNewsChannel Create(BaseDiscordClient discord, IGuild guild, Model model) + { + var entity = new RestNewsChannel(discord, guild, model.Id); + entity.Update(model); + return entity; + } + } +} diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketNewsChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketNewsChannel.cs new file mode 100644 index 000000000..9918608c3 --- /dev/null +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketNewsChannel.cs @@ -0,0 +1,23 @@ +using System.Diagnostics; +using Model = Discord.API.Channel; + +namespace Discord.WebSocket +{ + /// + /// Represents a WebSocket-based news channel in a guild that has the same properties as a . + /// + [DebuggerDisplay(@"{DebuggerDisplay,nq}")] + public class SocketNewsChannel : SocketTextChannel + { + internal SocketNewsChannel(DiscordSocketClient discord, ulong id, SocketGuild guild) + :base(discord, id, guild) + { + } + internal new static SocketTextChannel Create(SocketGuild guild, ClientState state, Model model) + { + var entity = new SocketNewsChannel(guild.Discord, model.Id, guild); + entity.Update(state, model); + return entity; + } + } +}