hangman doesn't break build
This commit is contained in:
parent
fc7c7c6cc9
commit
788ac7c2fa
|
@ -1,4 +1,5 @@
|
|||
using Discord.Commands;
|
||||
using dotbot.Services;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
@ -10,15 +11,22 @@ namespace dotbot.Commands
|
|||
public class Hangman : ModuleBase<SocketCommandContext>
|
||||
{
|
||||
static internal string[] Gallows = File.ReadAllText("gallows.txt").Split('=');
|
||||
public HangmanSession CurrentGames;
|
||||
public Dictionary<ulong, HangmanSession> _games;
|
||||
|
||||
|
||||
public Hangman(HangmanService hangman)
|
||||
{
|
||||
_games = hangman._activeGames;
|
||||
}
|
||||
|
||||
[Command]
|
||||
[Priority(0)]
|
||||
[Summary("start a game of hangman!")]
|
||||
public async Task StartGame([Remainder] string secret)
|
||||
{
|
||||
CurrentGames = new HangmanSession(secret);
|
||||
await ReplyAsync($"{CurrentGames}");
|
||||
var gameId = Context.Channel.Id;
|
||||
_games.Add(gameId, new HangmanSession(secret));
|
||||
await ReplyAsync($"{_games[gameId]}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ namespace dotbot
|
|||
.AddSingleton<CleverBotCacheService>()
|
||||
.AddSingleton<DotbotDb>()
|
||||
.AddSingleton<PollService>()
|
||||
.AddSingleton<HangmanService>()
|
||||
.AddSingleton<Random>()
|
||||
.AddSingleton(_config);
|
||||
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
using Discord.WebSocket;
|
||||
using dotbot.Commands;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace dotbot.Services
|
||||
{
|
||||
public class HangmanService
|
||||
{
|
||||
private DiscordSocketClient _discord;
|
||||
private Dictionary<ulong, HangmanSession> _activeGames;
|
||||
public Dictionary<ulong, HangmanSession> _activeGames;
|
||||
|
||||
public HangmanService(DiscordSocketClient discord)
|
||||
{
|
||||
_discord = discord;
|
||||
_activeGames = new Dictionary<ulong, HangmanSession>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue