Browse Source

Added Member, Server and ServerId shortcuts to Message

tags/docs-0.9
RogueException 9 years ago
parent
commit
7ca386e2e4
1 changed files with 10 additions and 2 deletions
  1. +10
    -2
      src/Discord.Net/Models/Message.cs

+ 10
- 2
src/Discord.Net/Models/Message.cs View File

@@ -91,9 +91,15 @@ namespace Discord
[JsonIgnore] [JsonIgnore]
public IEnumerable<User> Mentions => MentionIds.Select(x => _client.GetUser(x)).Where(x => x != null); public IEnumerable<User> Mentions => MentionIds.Select(x => _client.GetUser(x)).Where(x => x != null);


/// <summary> Returns the id of the channel this message was sent in. </summary>
/// <summary> Returns the id of the server containing the channel this message was sent to. </summary>
public string ServerId => Channel.ServerId;
/// <summary> Returns the server containing the channel this message was sent to. </summary>
[JsonIgnore]
public Server Server => _client.GetServer(Channel.ServerId);

/// <summary> Returns the id of the channel this message was sent to. </summary>
public string ChannelId { get; } public string ChannelId { get; }
/// <summary> Returns the the channel this message was sent in. </summary>
/// <summary> Returns the channel this message was sent to. </summary>
[JsonIgnore] [JsonIgnore]
public Channel Channel => _client.GetChannel(ChannelId); public Channel Channel => _client.GetChannel(ChannelId);


@@ -102,6 +108,8 @@ namespace Discord
/// <summary> Returns the author of this message. </summary> /// <summary> Returns the author of this message. </summary>
[JsonIgnore] [JsonIgnore]
public User User => _client.GetUser(UserId); public User User => _client.GetUser(UserId);
[JsonIgnore]
public Membership Member => _client.GetMember(ServerId, UserId);
/// <summary> Returns true if the current user created this message. </summary> /// <summary> Returns true if the current user created this message. </summary>
public bool IsAuthor => _client.User?.Id == UserId; public bool IsAuthor => _client.User?.Id == UserId;




Loading…
Cancel
Save