Ejemplo n.º 1
0
        public async Task playShiritori(params string[] gameName)
        {
            p.doAction(Context.User, Context.Guild.Id, Program.Module.Game);
            if (p.games.Any(x => x.m_chan == Context.Channel))
            {
                await ReplyAsync(Sentences.gameAlreadyRunning(Context.Guild.Id));
            }
            else
            {
                string finalGameName = Program.addArgs(gameName);
                if (finalGameName == null || (finalGameName.ToLower() != "shiritori" && finalGameName.ToLower() != "kancolle" && finalGameName.ToLower() != "booru"))
                {
                    await ReplyAsync(Sentences.invalidGameName(Context.Guild.Id));
                }
                else
                {
                    if (!p.gameThread.IsAlive)
                    {
                        p.gameThread.Start();
                    }
                    Game g = null;
                    if (finalGameName.ToLower() == "shiritori")
                    {
                        await ReplyAsync(Sentences.rulesShiritori(Context.Guild.Id));

                        g = new Shiritori(Context.Channel, Context.Guild, Context.User);
                    }
                    else if (finalGameName.ToLower() == "kancolle")
                    {
                        await ReplyAsync(Sentences.rulesKancolle(Context.Guild.Id));

                        g = new Kancolle(Context.Channel, Context.Guild, Context.User);
                    }
                    else if (finalGameName.ToLower() == "booru")
                    {
                        if (!(Context.Channel as ITextChannel).IsNsfw)
                        {
                            await ReplyAsync(Sentences.chanIsNotNsfw(Context.Guild.Id));

                            return;
                        }
                        await ReplyAsync(Sentences.rulesBooru(Context.Guild.Id));

                        g = new BooruGame(Context.Channel, Context.Guild, Context.User);
                    }
                    p.games.Add(g);
                    g.Post();
                }
            }
        }