Implemented IComparable<T> on IRole and IGuildUUser

This commit is contained in:
james7132
2016-10-25 21:37:18 +00:00
parent 9fcf88b7ac
commit f3cd96d2fe
7 changed files with 23 additions and 6 deletions

View File

@@ -4,9 +4,7 @@ using System.Diagnostics;
using System.Threading.Tasks;
using Model = Discord.API.Role;
namespace Discord.Rest
{
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
namespace Discord.Rest { [DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class RestRole : RestEntity<ulong>, IRole
{
public RestGuild Guild { get; }
@@ -51,10 +49,12 @@ namespace Discord.Rest
public Task DeleteAsync(RequestOptions options = null)
=> RoleHelper.DeleteAsync(this, Discord, options);
public override string ToString() => Name;
private string DebuggerDisplay => $"{Name} ({Id})";
//IRole
IGuild IRole.Guild => Guild;
public int CompareTo(IRole role) => Position.CompareTo(role.Position);
}
}

View File

@@ -96,6 +96,8 @@ namespace Discord.Rest
throw new InvalidOperationException("Unable to return this entity's parent unless it was fetched through that object.");
}
}
public int CompareTo(IGuildUser user) => this.Compare(user);
//IVoiceState
bool IVoiceState.IsSelfDeafened => false;
@@ -103,5 +105,6 @@ namespace Discord.Rest
bool IVoiceState.IsSuppressed => false;
IVoiceChannel IVoiceState.VoiceChannel => null;
string IVoiceState.VoiceSessionId => null;
}
}