Exemple #1
0
        public async Task Poll(params string[] args)
        {
            Utilities.CheckAvailability(Context.Guild, Program.Module.Communication);
            await p.DoAction(Context.User, Program.Module.Communication);

            if (args.Length < 2)
            {
                await ReplyAsync(Sentences.PollHelp(Context.Guild));

                return;
            }
            if (args.Length > 10)
            {
                await ReplyAsync(Sentences.PollTooManyChoices(Context.Guild));

                return;
            }
            var    emotes = new[] { new Emoji("1️⃣"), new Emoji("2️⃣"), new Emoji("3️⃣"), new Emoji("4️⃣"), new Emoji("5️⃣"), new Emoji("6️⃣"), new Emoji("7️⃣"), new Emoji("8️⃣"), new Emoji("9️⃣") };
            string str    = "";
            int    i      = 0;

            foreach (string s in args.Skip(1))
            {
                str += emotes[i] + ": " + s + Environment.NewLine;
                i++;
            }
            var msg = await ReplyAsync("", false, new EmbedBuilder
            {
                Title       = args[0],
                Description = str,
                Color       = Color.Blue
            }.Build());

            await msg.AddReactionsAsync(emotes.Take(i).ToArray());
        }