Пример #1
0
        private static Task CreateAndBootShardsAsync()
        {
            Console.Write($"\r[4/5] Creating {BotConfiguration.ShardCount} shards...                  ");

            Shards = new List <TheGodfatherShard>();
            for (int i = 0; i < BotConfiguration.ShardCount; i++)
            {
                var shard = new TheGodfatherShard(i, GlobalDatabaseContextBuilder, SharedData);
                shard.Initialize(async e => await RegisterPeriodicTasksAsync());
                Shards.Add(shard);
            }

            Console.WriteLine("\r[5/5] Booting the shards...                   ");
            Console.WriteLine();

            return(Task.WhenAll(Shards.Select(s => s.StartAsync())));
        }
Пример #2
0
        private static Task CreateAndBootShardsAsync()
        {
            Console.Write($"\r[4/5] Creating {BotConfiguration.ShardCount} shards...                  ");

            Shards = new List <TheGodfatherShard>();
            for (int i = 0; i < BotConfiguration.ShardCount; i++)
            {
                var shard = new TheGodfatherShard(i, DatabaseService, SharedData);
                shard.Initialize();
                Shards.Add(shard);
            }

            Console.WriteLine("\r[5/5] Booting the shards...                   ");
            Console.WriteLine();

            return(Task.WhenAll(Shards.Select(shard => shard.StartAsync())));
        }