Ref project update

This commit is contained in:
RogueException
2016-03-12 20:20:30 -04:00
parent 5a38129c18
commit 30ac95280e
31 changed files with 389 additions and 286 deletions

View File

@@ -7,16 +7,12 @@ namespace Discord
{
/// <summary> Gets the type flags for this channel. </summary>
ChannelType Type { get; }
/// <summary> Gets whether this is a text channel. </summary>
bool IsText { get; }
/// <summary> Gets whether this is a voice channel. </summary>
bool IsVoice { get; }
/// <summary> Gets whether this is a private channel. </summary>
bool IsPrivate { get; }
/// <summary> Gets whether this is a public channel. </summary>
bool IsPublic { get; }
/// <summary> Gets the name of this channel. </summary>
string Name { get; }
/// <summary> Gets a user in this channel with the given id. </summary>
Task<IUser> GetUser(ulong id);
/// <summary> Gets a collection of all users in this channel. </summary>
Task<IEnumerable<User>> GetUsers();
Task<IEnumerable<IUser>> GetUsers();
}
}

View File

@@ -1,8 +0,0 @@
namespace Discord
{
public interface IPrivateChannel : IChannel
{
/// <summary> Gets the recipient of the messages in this private channel. </summary>
User Recipient { get; }
}
}

View File

@@ -3,36 +3,33 @@ using System.Threading.Tasks;
namespace Discord
{
public struct PermissionOverwriteEntry
{
public PermissionTarget TargetType { get; }
public ulong TargetId { get; }
public OverwritePermissions Permissions { get; }
}
public interface IPublicChannel : IChannel
{
/// <summary> Gets the server this channel is a member of. </summary>
Server Server { get; }
/// <summary> Gets a collection of permission overwrites for this channel. </summary>
IEnumerable<PermissionOverwriteEntry> PermissionOverwrites { get; }
/// <summary> Gets the name of this public channel. </summary>
string Name { get; }
/// <summary> Gets the position of this public channel relative to others of the same type. </summary>
int Position { get; }
/// <summary> Gets a user in this channel with the given id. </summary>
new Task<ServerUser> GetUser(ulong id);
/// <summary> Gets a collection of all users in this channel. </summary>
new Task<IEnumerable<ServerUser>> GetUsers();
/// <summary> Gets the permission overwrite for a specific user, or null if one does not exist. </summary>
OverwritePermissions? GetPermissionOverwrite(User user);
OverwritePermissions? GetPermissionOverwrite(ServerUser user);
/// <summary> Gets the permission overwrite for a specific role, or null if one does not exist. </summary>
OverwritePermissions? GetPermissionOverwrite(Role role);
/// <summary> Downloads a collection of all invites to this server. </summary>
Task<IEnumerable<Invite>> GetInvites();
/// <summary> Adds or updates the permission overwrite for the given user. </summary>
Task UpdatePermissionOverwrite(User user, OverwritePermissions permissions);
Task UpdatePermissionOverwrite(ServerUser user, OverwritePermissions permissions);
/// <summary> Adds or updates the permission overwrite for the given role. </summary>
Task UpdatePermissionOverwrite(Role role, OverwritePermissions permissions);
/// <summary> Removes the permission overwrite for the given user, if one exists. </summary>
Task RemovePermissionOverwrite(User user);
Task RemovePermissionOverwrite(ServerUser user);
/// <summary> Removes the permission overwrite for the given role, if one exists. </summary>
Task RemovePermissionOverwrite(Role role);

View File

@@ -10,12 +10,12 @@ namespace Discord
Task<Message> GetMessage(ulong id);
/// <summary> Gets the last N messages from this text channel. </summary>
/// <param name="limit"> The maximum number of messages to retrieve. </param>
Task<IEnumerable<Message>> GetMessages(int limit = 100);
Task<IEnumerable<Message>> GetMessages(int limit = DiscordConfig.MaxMessagesPerBatch);
/// <summary> Gets a collection of messages in this channel. </summary>
/// <param name="limit"> The maximum number of messages to retrieve. </param>
/// <param name="relativeMessageId"> The message to start downloading relative to. </param>
/// <param name="relativeDir"> The direction, from relativeMessageId, to download messages in. </param>
Task<IEnumerable<Message>> GetMessages(int limit = 100, ulong? relativeMessageId = null, Relative relativeDir = Relative.Before);
Task<IEnumerable<Message>> GetMessages(int limit = DiscordConfig.MaxMessagesPerBatch, ulong? relativeMessageId = null, Relative relativeDir = Relative.Before);
/// <summary> Sends a message to this text channel. </summary>
Task<Message> SendMessage(string text, bool isTTS = false);

View File

@@ -1,8 +0,0 @@
namespace Discord
{
public interface IVoiceChannel : IChannel
{
/// <summary> Gets the requested bitrate, in bits per second, of this voice channel. </summary>
int Bitrate { get; }
}
}

View File

@@ -4,30 +4,32 @@ using System.Threading.Tasks;
namespace Discord
{
public class PrivateChannel : ITextChannel, IPrivateChannel
public class PrivateChannel : ITextChannel, IChannel
{
/// <inheritdoc />
public ulong Id { get; }
/// <inheritdoc />
public DiscordClient Discord { get; }
/// <inheritdoc />
public EntityState State { get; }
/// <inheritdoc />
public ChannelType Type { get; }
public ulong Id { get; }
/// <inheritdoc />
public bool IsPrivate => true;
public PrivateUser Recipient { get; }
/// <inheritdoc />
public bool IsPublic => false;
/// <inheritdoc />
public bool IsText => true;
/// <inheritdoc />
public bool IsVoice => false;
/// <inheritdoc />
public User Recipient { get; }
public PrivateUser CurrentUser { get; }
/// <inheritdoc />
public Task<IEnumerable<User>> GetUsers() => null;
ChannelType IChannel.Type => ChannelType.Private | ChannelType.Text;
/// <inheritdoc />
public string Name { get; }
/// <inheritdoc />
public Task<PrivateUser> GetUser(ulong id) => null;
/// <inheritdoc />
Task<IUser> IChannel.GetUser(ulong id) => null;
/// <inheritdoc />
public Task<IEnumerable<PrivateUser>> GetUsers() => null;
/// <inheritdoc />
Task<IEnumerable<IUser>> IChannel.GetUsers() => null;
/// <inheritdoc />
public Task<Message> GetMessage(ulong id) => null;
/// <inheritdoc />

View File

@@ -5,7 +5,7 @@ using System.Threading.Tasks;
namespace Discord
{
public class TextChannel : ITextChannel, IPublicChannel, IMentionable, IModifiable<TextChannel.Properties>
public class TextChannel : ITextChannel, IMentionable, IModifiable<TextChannel.Properties>
{
public sealed class Properties
{
@@ -14,22 +14,17 @@ namespace Discord
public int Position { get; }
}
/// <inheritdoc />
public EntityState State { get; }
/// <inheritdoc />
public ulong Id { get; }
/// <inheritdoc />
public Server Server { get; }
/// <inheritdoc />
public DiscordClient Discord { get; }
/// <inheritdoc />
public EntityState State { get; }
/// <inheritdoc />
public ChannelType Type => ChannelType.Public | ChannelType.Text;
/// <inheritdoc />
public bool IsPrivate => false;
/// <inheritdoc />
public bool IsPublic => true;
/// <inheritdoc />
public bool IsText => true;
/// <inheritdoc />
public bool IsVoice => false;
/// <inheritdoc />
public string Name { get; }
@@ -37,21 +32,24 @@ namespace Discord
public string Topic { get; }
/// <inheritdoc />
public int Position { get; }
/// <inheritdoc />
public string Mention { get; }
/// <inheritdoc />
public Server Server { get; }
/// <inheritdoc />
public IEnumerable<PermissionOverwriteEntry> PermissionOverwrites { get; }
/// <inheritdoc />
public IEnumerable<User> Users { get; }
/// <inheritdoc />
public OverwritePermissions? GetPermissionOverwrite(User user) => null;
public OverwritePermissions? GetPermissionOverwrite(ServerUser user) => null;
/// <inheritdoc />
public OverwritePermissions? GetPermissionOverwrite(Role role) => null;
/// <inheritdoc />
public Task<IEnumerable<User>> GetUsers() => null;
public Task<ServerUser> GetUser(ulong id) => null;
/// <inheritdoc />
Task<IUser> IChannel.GetUser(ulong id) => null;
/// <inheritdoc />
public Task<IEnumerable<ServerUser>> GetUsers() => null;
/// <inheritdoc />
Task<IEnumerable<IUser>> IChannel.GetUsers() => null;
/// <inheritdoc />
public Task<Message> GetMessage(ulong id) => null;
/// <inheritdoc />
@@ -62,11 +60,11 @@ namespace Discord
public Task<IEnumerable<Invite>> GetInvites() => null;
/// <inheritdoc />
public Task UpdatePermissionOverwrite(User user, OverwritePermissions permissions) => null;
public Task UpdatePermissionOverwrite(ServerUser user, OverwritePermissions permissions) => null;
/// <inheritdoc />
public Task UpdatePermissionOverwrite(Role role, OverwritePermissions permissions) => null;
/// <inheritdoc />
public Task RemovePermissionOverwrite(User user) => null;
public Task RemovePermissionOverwrite(ServerUser user) => null;
/// <inheritdoc />
public Task RemovePermissionOverwrite(Role role) => null;

View File

@@ -4,7 +4,7 @@ using System.Threading.Tasks;
namespace Discord
{
public class VoiceChannel : IPublicChannel, IVoiceChannel, IModifiable<VoiceChannel.Properties>
public class VoiceChannel : IPublicChannel, IModifiable<VoiceChannel.Properties>
{
public sealed class Properties
{
@@ -16,19 +16,14 @@ namespace Discord
/// <inheritdoc />
public ulong Id { get; }
/// <inheritdoc />
public DiscordClient Discord { get; }
/// <inheritdoc />
public EntityState State { get; }
/// <inheritdoc />
public ChannelType Type { get; }
public Server Server { get; }
/// <inheritdoc />
public bool IsPrivate => false;
public DiscordClient Discord { get; }
/// <inheritdoc />
public bool IsPublic => true;
/// <inheritdoc />
public bool IsText => false;
/// <inheritdoc />
public bool IsVoice => true;
ChannelType IChannel.Type => ChannelType.Public | ChannelType.Voice;
/// <inheritdoc />
public string Name { get; }
@@ -36,26 +31,33 @@ namespace Discord
public int Position { get; }
/// <inheritdoc />
public int Bitrate { get; }
/// <inheritdoc />
public Server Server { get; }
public string Mention { get; }
/// <inheritdoc />
public IEnumerable<PermissionOverwriteEntry> PermissionOverwrites { get; }
/// <inheritdoc />
public OverwritePermissions? GetPermissionOverwrite(User user) => null;
public OverwritePermissions? GetPermissionOverwrite(ServerUser user) => null;
/// <inheritdoc />
public OverwritePermissions? GetPermissionOverwrite(Role role) => null;
/// <inheritdoc />
public Task<IEnumerable<User>> GetUsers() => null;
public Task<ServerUser> GetUser(ulong id) => null;
/// <inheritdoc />
Task<IUser> IChannel.GetUser(ulong id) => null;
/// <inheritdoc />
public Task<IEnumerable<ServerUser>> GetUsers() => null;
/// <inheritdoc />
Task<IEnumerable<IUser>> IChannel.GetUsers() => null;
/// <inheritdoc />
public Task<IEnumerable<Invite>> GetInvites() => null;
/// <inheritdoc />
public Task UpdatePermissionOverwrite(User user, OverwritePermissions permissions) => null;
public Task UpdatePermissionOverwrite(ServerUser user, OverwritePermissions permissions) => null;
/// <inheritdoc />
public Task UpdatePermissionOverwrite(Role role, OverwritePermissions permissions) => null;
/// <inheritdoc />
public Task RemovePermissionOverwrite(User user) => null;
public Task RemovePermissionOverwrite(ServerUser user) => null;
/// <inheritdoc />
public Task RemovePermissionOverwrite(Role role) => null;