コード例 #1
0
 public Subscriptions(ILogger <Subscriptions> logger, TtsDbContext db)
 {
     _logger         = logger;
     _db             = db;
     _clientId       = BotDataAccess.ClientId;
     _appAccessToken = BotDataAccess.GetAppAccessToken(_db.BotData);
 }
コード例 #2
0
ファイル: Users.cs プロジェクト: icecreamdatabase/TtsApi
        public async Task <List <TwitchUser> > GetList(string[] userIdsToCheck = null, string[] userLoginsToCheck = null)
        {
            string clientId       = BotDataAccess.ClientId;
            string appAccessToken = BotDataAccess.GetAppAccessToken(_db.BotData);

            // Try first time
            DataHolder <TwitchUser> rewardData =
                await UsersStatics.Users(clientId, appAccessToken, userIdsToCheck, userLoginsToCheck);

            // If we don't have an Unauthorized result return it
            if (rewardData is not {
                Status : (int)HttpStatusCode.Unauthorized
            })
コード例 #3
0
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            /* SCOPE */
            using IServiceScope serviceScope = _serviceProvider.CreateScope();
            IServiceProvider scopeServiceProvider = serviceScope.ServiceProvider;

            /* BOT DATA */
            await using TtsDbContext ttsDbContext = scopeServiceProvider.GetRequiredService <TtsDbContext>();
            BotDataAccess.Prefetch(ttsDbContext.BotData);

            /* POLLY */
            Polly polly = scopeServiceProvider.GetRequiredService <Polly>();
            await polly.InitVoicesData();

            /* EVENT SUB */
            Subscriptions subscriptions = scopeServiceProvider.GetRequiredService <Subscriptions>();

            Transport.Default = _hostEnvironment.IsDevelopment()
                ? Transport.DefaultDevelopment
                : Transport.DefaultProduction;
            await subscriptions.SetRequiredSubscriptionsForAllChannels();
        }