Пример #1
0
            public async Task Acro(int time = 60)
            {
                if (time < 10 || time > 120)
                {
                    return;
                }
                var channel = (ITextChannel)Context.Channel;

                var game = new AcrophobiaGame(channel, time);

                if (AcrophobiaGames.TryAdd(channel.Id, game))
                {
                    try
                    {
                        await game.Run();
                    }
                    finally
                    {
                        game.EnsureStopped();
                        AcrophobiaGames.TryRemove(channel.Id, out game);
                    }
                }
                else
                {
                    await ReplyErrorLocalized("acro_running").ConfigureAwait(false);
                }
            }
Пример #2
0
            public async Task Acro(int time = 60)
            {
                var channel = (ITextChannel)Context.Channel;

                var game = new AcrophobiaGame(channel, time);

                if (AcrophobiaGames.TryAdd(channel.Id, game))
                {
                    try
                    {
                        await game.Run();
                    }
                    finally
                    {
                        game.EnsureStopped();
                        AcrophobiaGames.TryRemove(channel.Id, out game);
                    }
                }
                else
                {
                    await channel.SendErrorAsync("Acrophobia game is already running in this channel.").ConfigureAwait(false);
                }
            }