Cleaned up Reactions PR

This commit is contained in:
RogueException
2016-11-27 00:55:01 -04:00
parent 2e1ec5803b
commit f56a1b653d
8 changed files with 41 additions and 51 deletions

View File

@@ -1,22 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Model = Discord.API.Reaction;
using Model = Discord.API.Reaction;
namespace Discord
{
public class RestReaction : IReaction
{
internal RestReaction(Model model)
{
Emoji = Emoji.FromApi(model.Emoji);
Count = model.Count;
Me = model.Me;
}
public Emoji Emoji { get; }
public int Count { get; }
public bool Me { get; }
public Emoji Emoji { get; private set; }
public int Count { get; private set; }
public bool Me { get; private set; }
internal RestReaction(Emoji emoji, int count, bool me)
{
Emoji = emoji;
Count = count;
Me = me;
}
internal static RestReaction Create(Model model)
{
return new RestReaction(Emoji.Create(model.Emoji), model.Count, model.Me);
}
}
}

View File

@@ -109,7 +109,7 @@ namespace Discord.Rest
{
var reactions = ImmutableArray.CreateBuilder<RestReaction>(value.Length);
for (int i = 0; i < value.Length; i++)
reactions.Add(new RestReaction(value[i]));
reactions.Add(RestReaction.Create(value[i]));
_reactions = reactions.ToImmutable();
}
else