Hangman now shows all guessed letters
This commit is contained in:
parent
ae10c92455
commit
129fa9f827
@ -116,7 +116,8 @@ namespace NadekoBot.Modules.Games.Commands.Hangman
|
|||||||
var embed = new EmbedBuilder().WithTitle("Hangman Game")
|
var embed = new EmbedBuilder().WithTitle("Hangman Game")
|
||||||
.WithDescription(toSend)
|
.WithDescription(toSend)
|
||||||
.AddField(efb => efb.WithName("It was").WithValue(Term.Word))
|
.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)
|
if (Errors >= MaxErrors)
|
||||||
await GameChannel.EmbedAsync(embed.WithErrorColor().Build()).ConfigureAwait(false);
|
await GameChannel.EmbedAsync(embed.WithErrorColor().Build()).ConfigureAwait(false);
|
||||||
else
|
else
|
||||||
@ -134,7 +135,13 @@ namespace NadekoBot.Modules.Games.Commands.Hangman
|
|||||||
MessagesSinceLastPost = 0;
|
MessagesSinceLastPost = 0;
|
||||||
Task.Run(async () =>
|
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;
|
return Task.CompletedTask;
|
||||||
@ -151,9 +158,11 @@ namespace NadekoBot.Modules.Games.Commands.Hangman
|
|||||||
{
|
{
|
||||||
if (Guesses.Contains(guess))
|
if (Guesses.Contains(guess))
|
||||||
{
|
{
|
||||||
|
MessagesSinceLastPost = 0;
|
||||||
++Errors;
|
++Errors;
|
||||||
if (Errors < MaxErrors)
|
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
|
else
|
||||||
await End().ConfigureAwait(false);
|
await End().ConfigureAwait(false);
|
||||||
return;
|
return;
|
||||||
@ -170,14 +179,18 @@ namespace NadekoBot.Modules.Games.Commands.Hangman
|
|||||||
await End().ConfigureAwait(false);
|
await End().ConfigureAwait(false);
|
||||||
return;
|
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
|
else
|
||||||
{
|
{
|
||||||
|
MessagesSinceLastPost = 0;
|
||||||
++Errors;
|
++Errors;
|
||||||
if (Errors < MaxErrors)
|
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
|
else
|
||||||
await End().ConfigureAwait(false);
|
await End().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
@ -114,14 +114,34 @@ namespace NadekoBot.Extensions
|
|||||||
public static Task<IUserMessage> EmbedAsync(this IMessageChannel ch, Discord.API.Embed embed, string msg = "")
|
public static Task<IUserMessage> EmbedAsync(this IMessageChannel ch, Discord.API.Embed embed, string msg = "")
|
||||||
=> ch.SendMessageAsync(msg, embed: embed);
|
=> ch.SendMessageAsync(msg, embed: embed);
|
||||||
|
|
||||||
public static Task<IUserMessage> SendErrorAsync(this IMessageChannel ch, string title, string error, string url = null)
|
public static Task<IUserMessage> 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 });
|
=> ch.SendMessageAsync("", embed: new Embed()
|
||||||
|
{
|
||||||
|
Description = error,
|
||||||
|
Title = title,
|
||||||
|
Url = url,
|
||||||
|
Color = NadekoBot.ErrorColor,
|
||||||
|
Footer = new Discord.API.EmbedFooter()
|
||||||
|
{
|
||||||
|
Text = footer
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
public static Task<IUserMessage> SendErrorAsync(this IMessageChannel ch, string error)
|
public static Task<IUserMessage> SendErrorAsync(this IMessageChannel ch, string error)
|
||||||
=> ch.SendMessageAsync("", embed: new Embed() { Description = error, Color = NadekoBot.ErrorColor });
|
=> ch.SendMessageAsync("", embed: new Embed() { Description = error, Color = NadekoBot.ErrorColor });
|
||||||
|
|
||||||
public static Task<IUserMessage> SendConfirmAsync(this IMessageChannel ch, string title, string text, string url = null)
|
public static Task<IUserMessage> 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 });
|
=> ch.SendMessageAsync("", embed: new Embed()
|
||||||
|
{
|
||||||
|
Description = text,
|
||||||
|
Title = title,
|
||||||
|
Url = url,
|
||||||
|
Color = NadekoBot.OkColor,
|
||||||
|
Footer = new Discord.API.EmbedFooter()
|
||||||
|
{
|
||||||
|
Text = footer
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
public static Task<IUserMessage> SendConfirmAsync(this IMessageChannel ch, string text)
|
public static Task<IUserMessage> SendConfirmAsync(this IMessageChannel ch, string text)
|
||||||
=> ch.SendMessageAsync("", embed: new Embed() { Description = text, Color = NadekoBot.OkColor });
|
=> ch.SendMessageAsync("", embed: new Embed() { Description = text, Color = NadekoBot.OkColor });
|
||||||
|
Loading…
Reference in New Issue
Block a user