public async Task Run() { NadekoBot.Client.MessageReceived += PotentialAcro; var embed = GetEmbed(); //SUBMISSIONS PHASE await _channel.EmbedAsync(embed).ConfigureAwait(false); try { await Task.Delay(_time * 1000, _source.Token).ConfigureAwait(false); phase = AcroPhase.Idle; } catch (OperationCanceledException) { return; } //var i = 0; if (_submissions.Count == 0) { await _channel.SendErrorAsync(GetText("acrophobia"), GetText("acro_ended_no_sub")); return; } if (_submissions.Count == 1) { await _channel.EmbedAsync(new EmbedBuilder().WithOkColor() .WithDescription( GetText("acro_winner_only", Format.Bold(_submissions.First().Value.ToString()))) .WithFooter(efb => efb.WithText(_submissions.First().Key.ToLowerInvariant().ToTitleCase()))) .ConfigureAwait(false); return; } var submissionClosedEmbed = GetEmbed(); await _channel.EmbedAsync(submissionClosedEmbed).ConfigureAwait(false); //VOTING PHASE phase = AcroPhase.Voting; try { //30 secondds for voting await Task.Delay(30000, _source.Token).ConfigureAwait(false); phase = AcroPhase.Idle; } catch (OperationCanceledException) { return; } await End().ConfigureAwait(false); }
public async Task Run() { NadekoBot.Client.MessageReceived += PotentialAcro; var embed = GetEmbed(); //SUBMISSIONS PHASE await channel.EmbedAsync(embed).ConfigureAwait(false); try { await Task.Delay(time * 1000, source.Token).ConfigureAwait(false); phase = AcroPhase.Idle; } catch (OperationCanceledException) { return; } //var i = 0; if (submissions.Count == 0) { await channel.SendErrorAsync("Acrophobia", "Game ended with no submissions."); return; } else if (submissions.Count == 1) { await channel.EmbedAsync(new EmbedBuilder().WithOkColor() .WithDescription($"{submissions.First().Value.Mention} is the winner for being the only user who made a submission!") .WithFooter(efb => efb.WithText(submissions.First().Key.ToLowerInvariant().ToTitleCase()))) .ConfigureAwait(false); return; } var submissionClosedEmbed = GetEmbed(); await channel.EmbedAsync(submissionClosedEmbed).ConfigureAwait(false); //VOTING PHASE this.phase = AcroPhase.Voting; try { //30 secondds for voting await Task.Delay(30000, source.Token).ConfigureAwait(false); this.phase = AcroPhase.Idle; } catch (OperationCanceledException) { return; } await End().ConfigureAwait(false); }