Ejemplo n.º 1
0
        public async Task StartVote(Vote vote, IEnumerable <string> arguments = null)
        {
            var activeVote = new ActiveVote(vote, arguments);

            _activeVotes.Add(activeVote);
            _taskScheduler.ScheduleTaskDelayed(_callVotePlugin, async() => await FinishVote(activeVote),
                                               "FinishVote" + activeVote.Name,
                                               TimeSpan.FromSeconds(activeVote.Timer));
            await _callVotePlugin.AnnounceMessage("Start", activeVote.Name, activeVote.Alias, activeVote.Timer);
        }
Ejemplo n.º 2
0
        private async Task FinishVote(ActiveVote activeVote)
        {
            if (activeVote.Success())
            {
                activeVote.Execute();
                await _callVotePlugin.AnnounceMessage("Success", activeVote.Name);
            }
            else
            {
                await _callVotePlugin.AnnounceMessage("Failure", activeVote.Name);
            }

            activeVote.StartCooldown(this, _callVotePlugin, _taskScheduler);
            await _callVotePlugin.AnnounceMessage("Cooldown", activeVote.Name, activeVote.Cooldown);
        }
Ejemplo n.º 3
0
 public async Task ReleaseVote(ActiveVote activeVote)
 {
     _activeVotes.Remove(GetActiveVote(activeVote.Name));
     await _callVotePlugin.AnnounceMessage("Release", activeVote.Name);
 }