From 566cdfd0ce30d05390f88acabace49004bd7ddf3 Mon Sep 17 00:00:00 2001 From: FiniteReality Date: Sat, 25 Apr 2020 13:57:36 +0100 Subject: [PATCH] Add base IChannel abstraction --- src/Core/ChannelType.cs | 37 +++++++++++ src/Core/Entities/IChannel.cs | 114 ++++++++++++++++++++++++++++++++++ 2 files changed, 151 insertions(+) create mode 100644 src/Core/ChannelType.cs create mode 100644 src/Core/Entities/IChannel.cs diff --git a/src/Core/ChannelType.cs b/src/Core/ChannelType.cs new file mode 100644 index 000000000..60ffac6c6 --- /dev/null +++ b/src/Core/ChannelType.cs @@ -0,0 +1,37 @@ +namespace Discord.Core +{ + /// + /// The type of channel a is. + /// + public enum ChannelType + { + /// + /// A guild text channel. + /// + GuildText = 0, + /// + /// A direct message channel. + /// + DirectMessage = 1, + /// + /// A guild voice channel. + /// + GuildVoice = 2, + /// + /// A group direct message channel. + /// + GroupDirectMessage = 3, + /// + /// A guild category channel. + /// + GuildCategory = 4, + /// + /// A guild news channel. + /// + GuildNews = 5, + /// + /// A guild store channel. + /// + GuildStore = 6, + } +} diff --git a/src/Core/Entities/IChannel.cs b/src/Core/Entities/IChannel.cs new file mode 100644 index 000000000..f110d09ab --- /dev/null +++ b/src/Core/Entities/IChannel.cs @@ -0,0 +1,114 @@ +using System; + +namespace Discord.Core +{ + /// + /// An interface representing the collection of operations which can be + /// performed on a channel. + /// + public interface IChannel + { + /// + /// Gets a value indicating the unique identifier for this channel. + /// + ulong Id { get; } + + /// + /// Gets a value indicating the type of the current channel. + /// + ChannelType Type { get; } + + /// + /// Gets a value indicating the unique identifier of the guild this + /// channel belongs to. + /// + ulong? GuildId { get; } + + /// + /// Gets a value indicating the sorting position of the channel, or + /// null if one is not present. + /// + int? Position { get; } + + // TODO: permission overwrites + + /// + /// Gets a value indicating the name of this channel, or + /// null if one is not present. + /// + string? Name { get; } + + /// + /// Gets a value indicating the topic of this channel, or + /// null if one is not present. + /// + string? Topic { get; } + + /// + /// Gets a value indicating the last message sent in this channel, or + /// null if one is not present. + /// + /// + /// This identifier may point to a non-existent or invalid message. + /// + ulong? LastMessageId { get; } + + /// + /// Gets a value indicating the bitrate, in bits per second, of the + /// voice channel, or null if one is not present. + /// + int? Bitrate { get; } + + /// + /// Gets a value indicating the user limit of the voice channel, or + /// null if one is not present. + /// + int? UserLimit { get; } + + /// + /// Gets a value indicating the rate limit per user of the text + /// channel, or null if one is not present. + /// + /// + /// If the current user has the Manage Messages permission or + /// Manage Channel permission, this rate limit takes no effect. + /// + int? RateLimit { get; } + + // TODO: recipients + + /// + /// Gets a value indicating the icon of the text channel, or + /// null if one is not present. + /// + string? Icon { get; } + + /// + /// Gets a value indicating the unique identifier of the owner this + /// DM channel belongs to, or null if one is not present. + /// + ulong? OwnerId { get; } + + /// + /// Gets a value indicating the unique identifier of the owner this + /// DM channel belongs to, or null if one is not present. + /// + ulong? ApplicationId { get; } + + /// + /// Gets a value indicating the unique identifier of the parent + /// category this channel belongs to, or null if one is + /// not present. + /// + /// + /// Each category channel can contain 50 child channels. + /// + ulong? ParentId { get; } + + /// + /// Gets a value indicating the time when the last pinned message was + /// pinned, or null if one is not present. + /// + DateTimeOffset? LastPinTimestamp { get; } + } +}