acrophobia finalized

This commit is contained in:
Kwoth 2016-12-22 12:29:56 +01:00
parent 4d7fc8402b
commit 9b887b7688
3 changed files with 16 additions and 17 deletions

View File

@ -110,7 +110,7 @@ namespace NadekoBot.Modules.Games
--
{this.submissions.Aggregate("", (agg, cur) => agg + $"`{++i}.` **{cur.Key.ToLowerInvariant().ToTitleCase()}**\n")}
--")
.WithFooter(efb => efb.WithText("Vote by retyping one of the submissions"));
.WithFooter(efb => efb.WithText("Vote by typing a number of the submission"));
}
public async Task Run()
@ -229,24 +229,23 @@ 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;
}
//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)
if (int.TryParse(input, out num) && num > 0 && num <= submissions.Count)
{
var kvp = submissions.Skip(num).First();
var kvp = submissions.Skip(num - 1).First();
usr = kvp.Value;
if (usr.Id == guildUser.Id)
return;
if (!usersWhoVoted.Add(guildUser.Id))
//can't vote for yourself, can't vote multiple times
if (usr.Id == guildUser.Id || !usersWhoVoted.Add(guildUser.Id))
return;
votes.AddOrUpdate(kvp.Key, 1, (key, old) => ++old);
await channel.SendConfirmAsync("Acrophobia", $"{guildUser.Mention} cast their vote!").ConfigureAwait(false);

View File

@ -87,7 +87,7 @@ namespace NadekoBot.Resources {
}
/// <summary>
/// Looks up a localized string similar to acro.
/// Looks up a localized string similar to acrophobia acro.
/// </summary>
public static string acro_cmd {
get {

View File

@ -2791,7 +2791,7 @@
<value>`{0}ow us Battletag#1337` or `{0}overwatch eu Battletag#2016`</value>
</data>
<data name="acro_cmd" xml:space="preserve">
<value>acro</value>
<value>acrophobia acro</value>
</data>
<data name="acro_desc" xml:space="preserve">
<value>Starts an Acrophobia game. Second argment is optional round length in seconds. (default is 60)</value>