Beispiel #1
0
        public Embed GetEmbed(DiscordMessageContext context)
        {
            var builer = new EmbedBuilder
            {
                Title       = "Poll",
                Color       = new Color(76, 175, 80),
                Description = $"Vote using `{CommandTools.GetCommandPrefix(context, context.Channel)}{(Anonymous ? $"anonvote {Id}" : "vote")} <option number|option text>`{(Anonymous ? $"\n**__ONLY VOTES FROM A DIRECT MESSAGE TO ME WILL BE COUNTED!__**\nThis is **anonymous poll number #{Id}.**" : "")}",
                Footer      = new EmbedFooterBuilder
                {
                    Text = $"The poll will end in {TimeSpan.FromMinutes(MinutesLeft).ToLongString()} unless stopped earlier with '{CommandTools.GetCommandPrefix(context, context.Channel)}endpoll'"
                },
                Author = new EmbedAuthorBuilder
                {
                    Name    = Creator.NicknameOrUsername(),
                    IconUrl = Creator.AvatarUrlOrDefaultAvatar()
                }
            };

            for (int i = 0; i < Options.Count; i++)
            {
                builer.AddField((i + 1).ToString(), Options[i].Text, true);
            }

            if (TotalVotes > 0)
            {
                builer.AddField("Already Voted", string.Join(", ", Voters.Select(voter => voter.Key.NicknameOrUsername())));
            }

            return(builer.Build());
        }