diff --git a/src/NadekoBot/Modules/Games/Commands/Acropobia.cs b/src/NadekoBot/Modules/Games/Commands/Acropobia.cs index 728845b4..2a16fdc7 100644 --- a/src/NadekoBot/Modules/Games/Commands/Acropobia.cs +++ b/src/NadekoBot/Modules/Games/Commands/Acropobia.cs @@ -24,7 +24,7 @@ namespace NadekoBot.Modules.Games [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] - public async Task Acro(IUserMessage imsg, int time = 45) + public async Task Acro(IUserMessage imsg, int time = 60) { var channel = (ITextChannel)imsg.Channel; @@ -67,6 +67,8 @@ namespace NadekoBot.Modules.Games private readonly ConcurrentDictionary submissions = new ConcurrentDictionary(); public IReadOnlyDictionary Submissions => submissions; + private readonly ConcurrentHashSet usersWhoVoted = new ConcurrentHashSet(); + private int spamCount = 0; //text, votes @@ -136,7 +138,10 @@ namespace NadekoBot.Modules.Games } else if (submissions.Count == 1) { - await channel.SendConfirmAsync("Acrophobia", $"{submissions.First().Value.Mention} is the winner for being the only user who made a submission!").ConfigureAwait(false); + 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())) + .Build()).ConfigureAwait(false); return; } var submissionClosedEmbed = GetEmbed(); @@ -226,9 +231,27 @@ namespace NadekoBot.Modules.Games IGuildUser usr; if (submissions.TryGetValue(input, out usr) && usr.Id != guildUser.Id) { + if (!usersWhoVoted.Add(guildUser.Id)) + return; votes.AddOrUpdate(input, 1, (key, old) => ++old); await channel.SendConfirmAsync("Acrophobia", $"{guildUser.Mention} cast their vote!").ConfigureAwait(false); await msg.DeleteAsync().ConfigureAwait(false); + return; + } + + int num; + if (int.TryParse(input, out num) && num >= 0 && num < submissions.Count) + { + var kvp = submissions.Skip(num).First(); + usr = kvp.Value; + if (usr.Id == guildUser.Id) + return; + if (!usersWhoVoted.Add(guildUser.Id)) + return; + votes.AddOrUpdate(kvp.Key, 1, (key, old) => ++old); + await channel.SendConfirmAsync("Acrophobia", $"{guildUser.Mention} cast their vote!").ConfigureAwait(false); + await msg.DeleteAsync().ConfigureAwait(false); + return; } } diff --git a/src/NadekoBot/Modules/Searches/Commands/Models/WeatherModels.cs b/src/NadekoBot/Modules/Searches/Commands/Models/WeatherModels.cs index 417b4d46..d3c5742f 100644 --- a/src/NadekoBot/Modules/Searches/Commands/Models/WeatherModels.cs +++ b/src/NadekoBot/Modules/Searches/Commands/Models/WeatherModels.cs @@ -32,7 +32,7 @@ namespace NadekoBot.Modules.Searches.Commands.Models public class Wind { public double speed { get; set; } - public int deg { get; set; } + public double deg { get; set; } } public class Clouds diff --git a/src/NadekoBot/Resources/CommandStrings.Designer.cs b/src/NadekoBot/Resources/CommandStrings.Designer.cs index dc386816..e7f12432 100644 --- a/src/NadekoBot/Resources/CommandStrings.Designer.cs +++ b/src/NadekoBot/Resources/CommandStrings.Designer.cs @@ -96,7 +96,7 @@ namespace NadekoBot.Resources { } /// - /// Looks up a localized string similar to Starts an Acrophobia game. Second argment is optional round length in seconds. (default is 45). + /// Looks up a localized string similar to Starts an Acrophobia game. Second argment is optional round length in seconds. (default is 60). /// public static string acro_desc { get { diff --git a/src/NadekoBot/Resources/CommandStrings.resx b/src/NadekoBot/Resources/CommandStrings.resx index 410ccbf5..ec4a51f0 100644 --- a/src/NadekoBot/Resources/CommandStrings.resx +++ b/src/NadekoBot/Resources/CommandStrings.resx @@ -2794,7 +2794,7 @@ acro - Starts an Acrophobia game. Second argment is optional round length in seconds. (default is 45) + Starts an Acrophobia game. Second argment is optional round length in seconds. (default is 60) `{0}acro` or `{0}acro 30`