.hangmanstop command added, updated commandlist

This commit is contained in:
Master Kwoth
2017-06-28 03:42:02 +02:00
parent 36069d7552
commit cbd2de284f
4 changed files with 26 additions and 8 deletions

View File

@ -25,12 +25,14 @@ namespace NadekoBot.Modules.Games
//channelId, game
public static ConcurrentDictionary<ulong, HangmanGame> HangmanGames { get; } = new ConcurrentDictionary<ulong, HangmanGame>();
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task Hangmanlist()
{
await Context.Channel.SendConfirmAsync(Format.Code(GetText("hangman_types", Prefix)) + "\n" + string.Join(", ", HangmanTermPool.data.Keys));
}
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task Hangman([Remainder]string type = "All")
{
var hm = new HangmanGame(_client, Context.Channel, type);
@ -59,6 +61,17 @@ namespace NadekoBot.Modules.Games
await Context.Channel.SendConfirmAsync(GetText("hangman_game_started"), hm.ScrambledWord + "\n" + hm.GetHangman());
}
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task HangmanStop()
{
if (HangmanGames.TryRemove(Context.Channel.Id, out HangmanGame throwaway))
{
throwaway.Dispose();
await ReplyConfirmLocalized("hangman_stopped").ConfigureAwait(false);
}
}
}
}
}