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