.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);
}
}
}
}
}

View File

@ -2781,6 +2781,15 @@
<data name="hangman_usage" xml:space="preserve">
<value>`{0}hangman` or `{0}hangman movies`</value>
</data>
<data name="hangmanstop_cmd" xml:space="preserve">
<value>hangmanstop</value>
</data>
<data name="hangmanstop_desc" xml:space="preserve">
<value>Stops the active hangman game on this channel if it exists.</value>
</data>
<data name="hangmanstop_usage" xml:space="preserve">
<value>`{0}hangmanstop`</value>
</data>
<data name="crstatsclear_cmd" xml:space="preserve">
<value>crstatsclear</value>
</data>

View File

@ -375,6 +375,7 @@
"games_hangman_game_started": "Hangman game started",
"games_hangman_running": "Hangman game already running on this channel.",
"games_hangman_start_errored": "Starting hangman errored.",
"games_hangman_stopped": "Hangman game stopped.",
"games_hangman_types": "List of \"{0}hangman\" term types:",
"games_leaderboard": "Leaderboard",
"games_not_enough": "You don't have enough {0}",