public ReactionCommands(IServiceProvider serviceProvider)
        {
            _cache = serviceProvider.GetRequiredService <IMemoryCache>();
            _db    = serviceProvider.GetRequiredService <PerudoBotDbContext>();

            _gameHandler = new GameHandler(_db, _cache);
        }
Beispiel #2
0
 public EloHandler(PerudoBotDbContext db, ulong guildId, string gameMode)
 {
     _db       = db;
     _guildId  = guildId;
     _match    = new EloMatch();
     _gameMode = gameMode;
 }
        public PerudoBotDbContext CreateContext()
        {
            if (_connection == null)
            {
                _connection = new SqliteConnection("DataSource=:memory:");
                _connection.Open();

                var options = CreateOptions();
                using (var context = new PerudoBotDbContext(options))
                {
                    context.Database.EnsureCreated();
                }
            }

            return(new PerudoBotDbContext(CreateOptions()));
        }
Beispiel #4
0
 public GameObject(PerudoBotDbContext db, ulong channelId, ulong guildId)
 {
     _db        = db;
     _channelId = channelId;
     _guildId   = guildId;
 }
Beispiel #5
0
        /*
         *  Do all the user handling and setup for the game here
         *  Save it all in cache,
         *  and then use it all when starting the game
         */


        public GameHandler(PerudoBotDbContext db, IMemoryCache cache)
        {
            _db    = db;
            _cache = cache;
        }
Beispiel #6
0
 public RankService(PerudoBotDbContext db)
 {
     _db = db;
 }
Beispiel #7
0
 public void Setup()
 {
     _factory     = new GameBotDbContextFactory();
     _db          = _factory.CreateContext();
     _gameHandler = new GameHandler(_db, new MemoryCache(new MemoryCacheOptions()));
 }