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

@@ -0,0 +1,19 @@
using System.Threading.Tasks;
namespace Discord
{
public interface IUser : IEntity<ulong>, IMentionable
{
bool IsPrivate { get; }
string Name { get; }
ushort Discriminator { get; }
bool IsBot { get; }
string AvatarId { get; }
string AvatarUrl { get; }
string CurrentGame { get; }
UserStatus Status { get; }
Task<PrivateChannel> GetPrivateChannel();
}
}

View File

@@ -0,0 +1,43 @@
using System.Threading.Tasks;
namespace Discord
{
//TODO: Should this be linked directly to the Profile when it represents us, instead of maintaining a cache of values?
public class PrivateUser : IUser
{
/// <inheritdoc />
public EntityState State { get; internal set; }
/// <inheritdoc />
public ulong Id { get; }
/// <summary> Returns the private channel for this user. </summary>
public PrivateChannel Channel { get; }
/// <inheritdoc />
bool IUser.IsPrivate => true;
/// <inheritdoc />
public string Name { get; }
/// <inheritdoc />
public ushort Discriminator { get; }
/// <inheritdoc />
public bool IsBot { get; }
/// <inheritdoc />
public string AvatarId { get; }
/// <inheritdoc />
public string CurrentGame { get; }
/// <inheritdoc />
public UserStatus Status { get; }
/// <inheritdoc />
public DiscordClient Discord => Channel.Discord;
/// <inheritdoc />
public string AvatarUrl { get; }
/// <inheritdoc />
public string Mention { get; }
/// <inheritdoc />
Task<PrivateChannel> IUser.GetPrivateChannel() => Task.FromResult(Channel);
public Task Update() => null;
}
}

View File

@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Discord
{
public class ServerUser : IUser
{
/// <inheritdoc />
public EntityState State { get; }
/// <inheritdoc />
public ulong Id { get; }
/// <summary> Returns the private channel for this user. </summary>
public Server Server { get; }
/// <inheritdoc />
bool IUser.IsPrivate => false;
/// <inheritdoc />
public string Name { get; }
/// <inheritdoc />
public ushort Discriminator { get; }
/// <inheritdoc />
public bool IsBot { get; }
/// <inheritdoc />
public string AvatarId { get; }
/// <inheritdoc />
public string CurrentGame { get; }
/// <inheritdoc />
public UserStatus Status { get; }
/// <inheritdoc />
public DateTime JoinedAt { get; }
/// <inheritdoc />
public IReadOnlyList<Role> Roles { get; }
/// <summary> Returns true if this user has marked themselves as muted. </summary>
public bool IsSelfMuted { get; }
/// <summary> Returns true if this user has marked themselves as deafened. </summary>
public bool IsSelfDeafened { get; }
/// <summary> Returns true if the server is blocking audio from this user. </summary>
public bool IsServerMuted { get; }
/// <summary> Returns true if the server is blocking audio to this user. </summary>
public bool IsServerDeafened { get; }
/// <summary> Returns true if the server is temporarily blocking audio to/from this user. </summary>
public bool IsServerSuppressed { get; }
/// <summary> Gets this user's current voice channel. </summary>
public VoiceChannel VoiceChannel { get; }
/// <inheritdoc />
public DiscordClient Discord { get; }
/// <inheritdoc />
public string AvatarUrl { get; }
/// <inheritdoc />
public string Mention { get; }
public ServerPermissions ServerPermissions { get; }
public ChannelPermissions GetPermissions(IPublicChannel channel) => default(ChannelPermissions);
/// <inheritdoc />
public Task<PrivateChannel> GetPrivateChannel() => null;
public Task<IEnumerable<IPublicChannel>> GetChannels() => null;
public bool HasRole(Role role) => false;
public Task AddRoles(params Role[] roles) => null;
public Task RemoveRoles(params Role[] roles) => null;
public Task Update() => null;
public Task Kick() => null;
public Task Ban(int pruneDays = 0) => null;
public Task Unban() => null;
}
}