public async Task PollCreate([Remainder] string parameters) { string[] parameterArray = parameters.Split('|'); if (parameterArray.Length >= 4 && parameterArray.Length <= 7) { string question = parameterArray[0]; parameterArray[0] = ""; string timecode = parameterArray[1]; parameterArray[1] = ""; ulong timeSpan = 0; timecode = timecode.ToLower(); if (Regex.Match(timecode, @"\d+[dhm]").Success || timecode == "test") { if (timecode == "test") { timeSpan = 10; } else { int i = timecode.Contains('d') ? timecode.IndexOf('d') : (timecode.Contains('h') ? timecode.IndexOf('h') : timecode.IndexOf('m')); ulong multiplier = 1; switch (timecode.Substring(i, 1)) { case "d": multiplier = 24 * 60 * 60; break; case "m": multiplier = 60; break; default: multiplier = 60 * 60; break; } timeSpan = ulong.Parse(timecode.Substring(0, i)) * multiplier; } if (timeSpan > (7 * 24 * 60 * 60)) { await Context.Channel.SendMessageAsync($"Timespan too large, max amount of time: 7 days *({7 * 24} hours)*"); return; } } List <string> pollOptions = new List <string>(); foreach (string s in parameterArray) { if (s != "") { pollOptions.Add(s); } } var m = await Context.Channel.SendMessageAsync("Poll creating..."); Poll p = new Poll(m, question, Context.User, pollOptions.ToArray()); EmbedBuilder eb = new EmbedBuilder(); eb.WithAuthor($"Poll by {Context.User.Username}#{Context.User.DiscriminatorValue}", Context.User.GetAvatarUrl()); eb.WithDescription($"**{question}**"); eb.WithFooter($"PollID: {p.PollId}"); eb.WithColor(0, 255, 0); foreach (PollOption s in p.PollOptions) { float amt = p.PollReactions.Count(x => x.PollVote == s.Option); eb.AddField($"{s.React} {s.Option}", $"{Poll.GetPercentageBar(p, s.Option)} - 0/{p.PollReactions.Count} (0,00%)"); } await m.ModifyAsync(x => { x.Content = ""; x.Embed = eb.Build(); }); await p.AddAllReactions(); GlobalVars.AddPoll(p, timeSpan); } else { var m = await Context.Channel.SendMessageAsync("Too many parameters"); GlobalVars.AddRandomTracker(m); } }