Fix role comparison

This commit is contained in:
james7132
2016-10-29 08:03:58 +00:00
parent 08c7b49aae
commit 2e9bca5b85
3 changed files with 21 additions and 2 deletions

View File

@@ -0,0 +1,19 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Discord
{
public static class RoleExtensions
{
internal static int Compare(this IRole r1, IRole r2) {
if(r2 == null)
return 1;
var result = r1.Position.CompareTo(r2.Position);
// As per Discord's documentation, a tie is broken by ID
if(result != 0)
return result;
return r1.Id.CompareTo(r2.Id);
}
}
}