示例#1
0
        public async Task Vote([Remainder] string text)
        {
            Context.Message.DeleteAsync();

            VoteController vc = VoteControllerManager.GetVoteController(Context.Channel);

            vc.SetOptions(text);

            if (vc.GetOptions().Count == 0)
            {
                vc.ResetOptions();
            }

            Poll vote = vc.NewPoll();

            foreach (string option in vc.GetOptions())
            {
                RestUserMessage message = Context.Channel.SendMessageAsync(option).Result;
                vote.AddOptionMessage(message);
                message.AddReactionAsync(new Emoji("👌"));
            }

            await Task.Delay(1000 *ResourceController.GetVoteDelay());

            if (!vc.CurrentPoll.IsClosed)
            {
                await vc.ClosePoll(Context);
            }
        }