Added Mention function to User, GlobalUser, Channel and Role. Obsoleted old Mention static class.
This commit is contained in:
@@ -91,6 +91,9 @@ namespace Discord
|
||||
private PermissionOverwrite[] _permissionOverwrites;
|
||||
public IEnumerable<PermissionOverwrite> PermissionOverwrites { get { return _permissionOverwrites; } internal set { _permissionOverwrites = value.ToArray(); } }
|
||||
|
||||
/// <summary> Returns the string used to mention this channel. </summary>
|
||||
public string Mention => $"<#{Id}>";
|
||||
|
||||
internal Channel(DiscordClient client, long id, long? serverId, long? recipientId)
|
||||
: base(client, id)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,6 @@ namespace Discord
|
||||
{
|
||||
public sealed class GlobalUser : CachedObject<long>
|
||||
{
|
||||
|
||||
/// <summary> Returns the email for this user. Note: this field is only ever populated for the current logged in user. </summary>
|
||||
[JsonIgnore]
|
||||
public string Email { get; private set; }
|
||||
@@ -39,6 +38,9 @@ namespace Discord
|
||||
private IEnumerable<long> ServerIds => _users.Select(x => x.Key);
|
||||
private readonly ConcurrentDictionary<long, User> _users;
|
||||
|
||||
/// <summary> Returns the string used to mention this user. </summary>
|
||||
public string Mention => $"<@{Id}>";
|
||||
|
||||
internal GlobalUser(DiscordClient client, long id)
|
||||
: base(client, id)
|
||||
{
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
using Discord.API;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
public sealed class Role : CachedObject<long>
|
||||
{
|
||||
{
|
||||
/// <summary> Returns the name of this role. </summary>
|
||||
public string Name { get; private set; }
|
||||
/// <summary> If true, this role is displayed isolated from other users. </summary>
|
||||
@@ -38,6 +39,9 @@ namespace Discord
|
||||
private IEnumerable<long> MemberIds => Members.Select(x => x.Id);
|
||||
//TODO: Add local members cache
|
||||
|
||||
/// <summary> Returns the string used to mention this role. </summary>
|
||||
public string Mention { get { if (IsEveryone) return "@everyone"; else throw new InvalidOperationException("Discord currently only supports referencing the everyone role"); } }
|
||||
|
||||
internal Role(DiscordClient client, long id, long serverId)
|
||||
: base(client, id)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,6 @@ namespace Discord
|
||||
public bool IsServerMuted { get; private set; }
|
||||
public bool IsServerDeafened { get; private set; }
|
||||
public bool IsServerSuppressed { get; private set; }
|
||||
public bool IsSpeaking { get; internal set; }
|
||||
public bool IsPrivate => _server.Id == null;
|
||||
|
||||
public string SessionId { get; private set; }
|
||||
@@ -117,6 +116,9 @@ namespace Discord
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Returns the string used to mention this user. </summary>
|
||||
public string Mention => $"<@{Id}>";
|
||||
|
||||
internal User(DiscordClient client, long id, long? serverId)
|
||||
: base(client, id)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user