Exemple #1
0
        public static void SetNbVotesBasedOnEmotes(this Idee idee, IReadOnlyDictionary<IEmote, ReactionMetadata> reactions)
        {
            var ideeContext = new BoiteAIdee();

            var reaction = reactions.FirstOrDefault(r => r.Key.Name == ideeContext.EmoteUpVote.Name);

            idee.SetNbVote(reaction.Value.ReactionCount);
        }
Exemple #2
0
 public static void SetEtatBasedOnEmotes(this Idee idee, List<IEmote> reactionLists)
 {
     var ideeContext = new BoiteAIdee();
     if (reactionLists.Any(r => r.Name == ideeContext.EmoteEtatTermine.Name))
     {
         idee.SetEtatFaite();
     }
     else if (reactionLists.Any(r => r.Name == ideeContext.EmoteEtatRejete.Name))
     {
         idee.SetEtatRejetee();
     }
     else if (reactionLists.Any(r => r.Name == ideeContext.EmoteEtatEnCours.Name))
     {
         idee.SetEtatEnCours();
     }
 }
Exemple #3
0
        public static EmbedBuilder GetBuilder(this Idee idee)
        {
            var ideeContext = new BoiteAIdee();
            var builder = new EmbedBuilder()
            {
                Color = ideeContext.ColorIdee,
                Title = "Boîte à idées",
                Description = idee.Description,
            };

            builder.AddFieldWithValue("Nombre de votes", idee.NombreVotes.ToString());
            builder.AddFieldWithValue("État de l'idée", idee.EtatIdee.ToString());
            builder.AddFieldWithValue("Initiateur de l'idée", idee.Createur ?? "Aucun créateur");
            builder.AddFieldWithValue("Date de création de l'idée", idee.DateCreation.ToString("dd/MM/yyyy"));

            return builder;
        }