Added path property to all models for logging

This commit is contained in:
RogueException
2016-02-15 19:14:18 -04:00
parent d48d658e3a
commit bc7edbf3c7
7 changed files with 18 additions and 6 deletions

View File

@@ -41,11 +41,11 @@ namespace Discord
Permissions = new ChannelPermissionOverrides(allow, deny);
}
}
private readonly ConcurrentDictionary<ulong, Member> _users;
private readonly ConcurrentDictionary<ulong, Message> _messages;
private Dictionary<ulong, PermissionOverwrite> _permissionOverwrites;
public DiscordClient Client { get; }
/// <summary> Gets the unique identifier for this channel. </summary>
@@ -64,6 +64,8 @@ namespace Discord
/// <summary> Gets the type of this channel). </summary>
public ChannelType Type { get; private set; }
/// <summary> Gets the path to this object. </summary>
internal string Path => $"{Server?.Name ?? "[Private]"}/{Name}";
/// <summary> Gets true if this is a private chat with another user. </summary>
public bool IsPrivate => Recipient != null;
/// <summary> Gets the string used to mention this channel. </summary>
@@ -345,7 +347,7 @@ namespace Discord
public async Task<Message> SendFile(string filePath)
{
using (var stream = File.OpenRead(filePath))
return await SendFile(Path.GetFileName(filePath), stream).ConfigureAwait(false);
return await SendFile(System.IO.Path.GetFileName(filePath), stream).ConfigureAwait(false);
}
public async Task<Message> SendFile(string filename, Stream stream)
{

View File

@@ -85,8 +85,10 @@ namespace Discord
/// <summary> Gets when this invite was created. </summary>
public DateTime CreatedAt { get; private set; }
/// <summary> Returns a URL for this invite using XkcdCode if available or Id if not. </summary>
public string Url => $"{DiscordConfig.InviteUrl}/{Code}";
/// <summary> Gets the path to this object. </summary>
internal string Path => $"{Server?.Name ?? "[Private]"}/{Code}";
/// <summary> Returns a URL for this invite using XkcdCode if available or Id if not. </summary>
public string Url => $"{DiscordConfig.InviteUrl}/{Code}";
internal Invite(DiscordClient client, string code, string xkcdPass)
{

View File

@@ -201,6 +201,8 @@ namespace Discord
internal int Nonce { get; set; }
/// <summary> Gets the path to this object. </summary>
internal string Path => $"{Server?.Name ?? "[Private]"}/{Id}";
/// <summary> Returns the server containing the channel this message was sent to. </summary>
public Server Server => Channel.Server;
/// <summary> Returns if this message was sent from the logged-in accounts. </summary>

View File

@@ -28,7 +28,7 @@ namespace Discord
public UserStatus Status => Client.PrivateUser.Status;
/// <summary> Returns the string used to mention this user. </summary>
public string Mention => $"<@{Id}>";
/// <summary> Gets the email for this user. </summary>
public string Email { get; private set; }
/// <summary> Gets if the email for this user has been verified. </summary>

View File

@@ -33,6 +33,8 @@ namespace Discord
/// <summary> Gets the color of this role. </summary>
public Color Color { get; private set; }
/// <summary> Gets the path to this object. </summary>
internal string Path => $"{Server?.Name ?? "[Private]"}/{Name}";
/// <summary> Gets true if this is the role representing all users in a server. </summary>
public bool IsEveryone => Id == Server.Id;
/// <summary> Gets a list of all members in this role. </summary>

View File

@@ -79,6 +79,8 @@ namespace Discord
/// <summary> Gets all custom emojis on this server. </summary>
public IEnumerable<Emoji> CustomEmojis { get; private set; }
/// <summary> Gets the path to this object. </summary>
internal string Path => Name;
/// <summary> Gets the user that created this server. </summary>
public User Owner => GetUser(_ownerId);
/// <summary> Returns true if the current user owns this server. </summary>

View File

@@ -73,6 +73,8 @@ namespace Discord
// /// <summary> Gets this user's voice token. </summary>
// public string Token { get; private set; }
/// <summary> Gets the path to this object. </summary>
internal string Path => $"{Server?.Name ?? "[Private]"}/{Name}";
/// <summary> Gets the current private channel for this user if one exists. </summary>
public Channel PrivateChannel => Client.GetPrivateChannel(Id);
/// <summary> Returns the string used to mention this user. </summary>