diff --git a/src/NadekoBot/Modules/Games/Commands/Hangman/HangmanGame.cs b/src/NadekoBot/Modules/Games/Commands/Hangman/HangmanGame.cs index 048f51f3..d8bf3e7c 100644 --- a/src/NadekoBot/Modules/Games/Commands/Hangman/HangmanGame.cs +++ b/src/NadekoBot/Modules/Games/Commands/Hangman/HangmanGame.cs @@ -116,7 +116,8 @@ namespace NadekoBot.Modules.Games.Commands.Hangman var embed = new EmbedBuilder().WithTitle("Hangman Game") .WithDescription(toSend) .AddField(efb => efb.WithName("It was").WithValue(Term.Word)) - .WithImage(eib => eib.WithUrl(Term.ImageUrl)); + .WithImage(eib => eib.WithUrl(Term.ImageUrl)) + .WithFooter(efb => efb.WithText(string.Join(" ", Guesses))); if (Errors >= MaxErrors) await GameChannel.EmbedAsync(embed.WithErrorColor().Build()).ConfigureAwait(false); else @@ -134,7 +135,13 @@ namespace NadekoBot.Modules.Games.Commands.Hangman MessagesSinceLastPost = 0; Task.Run(async () => { - try { await GameChannel.SendConfirmAsync("Hangman Game", ScrambledWord + "\n" + GetHangman()).ConfigureAwait(false); } catch { } + try + { + await GameChannel.SendConfirmAsync("Hangman Game", + ScrambledWord + "\n" + GetHangman(), + footer: string.Join(" ", Guesses)).ConfigureAwait(false); + } + catch { } }); } return Task.CompletedTask; @@ -151,9 +158,11 @@ namespace NadekoBot.Modules.Games.Commands.Hangman { if (Guesses.Contains(guess)) { + MessagesSinceLastPost = 0; ++Errors; if (Errors < MaxErrors) - await GameChannel.SendErrorAsync("Hangman Game", $"{msg.Author.Mention} Letter `{guess}` has already been used.\n" + ScrambledWord + "\n" + GetHangman()).ConfigureAwait(false); + await GameChannel.SendErrorAsync("Hangman Game", $"{msg.Author.Mention} Letter `{guess}` has already been used.\n" + ScrambledWord + "\n" + GetHangman(), + footer: string.Join(" ", Guesses)).ConfigureAwait(false); else await End().ConfigureAwait(false); return; @@ -170,14 +179,18 @@ namespace NadekoBot.Modules.Games.Commands.Hangman await End().ConfigureAwait(false); return; } - try { await GameChannel.SendConfirmAsync("Hangman Game", $"{msg.Author.Mention} guessed a letter `{guess}`!\n" + ScrambledWord + "\n" + GetHangman()).ConfigureAwait(false); } catch { } + MessagesSinceLastPost = 0; + try { await GameChannel.SendConfirmAsync("Hangman Game", $"{msg.Author.Mention} guessed a letter `{guess}`!\n" + ScrambledWord + "\n" + GetHangman(), + footer: string.Join(" ", Guesses)).ConfigureAwait(false); } catch { } } else { + MessagesSinceLastPost = 0; ++Errors; if (Errors < MaxErrors) - await GameChannel.SendErrorAsync("Hangman Game", $"{msg.Author.Mention} Letter `{guess}` does not exist.\n" + ScrambledWord + "\n" + GetHangman()).ConfigureAwait(false); + await GameChannel.SendErrorAsync("Hangman Game", $"{msg.Author.Mention} Letter `{guess}` does not exist.\n" + ScrambledWord + "\n" + GetHangman(), + footer: string.Join(" ", Guesses)).ConfigureAwait(false); else await End().ConfigureAwait(false); } diff --git a/src/NadekoBot/_Extensions/Extensions.cs b/src/NadekoBot/_Extensions/Extensions.cs index 4c98b5dd..168fb87a 100644 --- a/src/NadekoBot/_Extensions/Extensions.cs +++ b/src/NadekoBot/_Extensions/Extensions.cs @@ -114,14 +114,34 @@ namespace NadekoBot.Extensions public static Task EmbedAsync(this IMessageChannel ch, Discord.API.Embed embed, string msg = "") => ch.SendMessageAsync(msg, embed: embed); - public static Task SendErrorAsync(this IMessageChannel ch, string title, string error, string url = null) - => ch.SendMessageAsync("", embed: new Embed() { Description = error, Title = title, Url = url, Color = NadekoBot.ErrorColor }); + public static Task SendErrorAsync(this IMessageChannel ch, string title, string error, string url = null, string footer = null) + => ch.SendMessageAsync("", embed: new Embed() + { + Description = error, + Title = title, + Url = url, + Color = NadekoBot.ErrorColor, + Footer = new Discord.API.EmbedFooter() + { + Text = footer + } + }); public static Task SendErrorAsync(this IMessageChannel ch, string error) => ch.SendMessageAsync("", embed: new Embed() { Description = error, Color = NadekoBot.ErrorColor }); - public static Task SendConfirmAsync(this IMessageChannel ch, string title, string text, string url = null) - => ch.SendMessageAsync("", embed: new Embed() { Description = text, Title = title, Url = url, Color = NadekoBot.OkColor }); + public static Task SendConfirmAsync(this IMessageChannel ch, string title, string text, string url = null, string footer = null) + => ch.SendMessageAsync("", embed: new Embed() + { + Description = text, + Title = title, + Url = url, + Color = NadekoBot.OkColor, + Footer = new Discord.API.EmbedFooter() + { + Text = footer + } + }); public static Task SendConfirmAsync(this IMessageChannel ch, string text) => ch.SendMessageAsync("", embed: new Embed() { Description = text, Color = NadekoBot.OkColor });