hangman fix? closes #956

This commit is contained in:
Kwoth 2017-01-11 13:54:25 +01:00
parent 24d82d26d1
commit 11da7c89b6
2 changed files with 12 additions and 2 deletions

View File

@ -52,7 +52,7 @@ namespace NadekoBot.Modules.Games.Commands.Hangman
} }
} }
public class HangmanGame public class HangmanGame: IDisposable
{ {
private readonly Logger _log; private readonly Logger _log;
@ -196,5 +196,11 @@ namespace NadekoBot.Modules.Games.Commands.Hangman
{(Errors > 1 ? "/" : " ")} {(Errors > 2 ? "|" : " ")} {(Errors > 3 ? "\\" : " ")} | {(Errors > 1 ? "/" : " ")} {(Errors > 2 ? "|" : " ")} {(Errors > 3 ? "\\" : " ")} |
{(Errors > 4 ? "/" : " ")} {(Errors > 5 ? "\\" : " ")} | {(Errors > 4 ? "/" : " ")} {(Errors > 5 ? "\\" : " ")} |
/-\"; /-\";
public void Dispose()
{
NadekoBot.Client.MessageReceived -= PotentialGuess;
OnEnded = null;
}
} }
} }

View File

@ -52,8 +52,12 @@ namespace NadekoBot.Modules.Games
{ {
hm.Start(); hm.Start();
} }
catch (Exception ex) { catch (Exception ex)
{
try { await Context.Channel.SendErrorAsync($"Starting errored: {ex.Message}").ConfigureAwait(false); } catch { } try { await Context.Channel.SendErrorAsync($"Starting errored: {ex.Message}").ConfigureAwait(false); } catch { }
HangmanGame throwaway;
HangmanGames.TryRemove(Context.Channel.Id, out throwaway);
throwaway.Dispose();
return; return;
} }