private async Task <bool> SetStreamsOnline(List <string> OnlineStreamIDs, GetStreamsResponse StreamsData)
 {
     using (var scope = _scopeFactory.CreateScope())
     {
         var     _context = scope.ServiceProvider.GetRequiredService <ApplicationDbContext>();
         var     Streams  = _context.StreamModels.Where(s => OnlineStreamIDs.Contains(s.UserID) && s.Type == StreamProviderTypes.Twitch).Include(x => x.StreamSubscriptions).ThenInclude(y => y.User);
         Boolean write    = false;
         foreach (Data.DBModels.StreamModels.Stream stream in Streams)
         {
             TwitchLib.Api.Helix.Models.Streams.Stream streamdata = StreamsData.Streams.Single(sd => sd.UserId == stream.UserID);
             if (stream.StreamState == StreamState.NotRunning)
             {
                 stream.StreamState = StreamState.Running;
                 stream.Started     = streamdata.StartedAt.ToLocalTime();
                 write = true;
                 if (stream.DiscordRelayChannel == "An")
                 {
                     stream.DiscordRelayChannel = getRandomRelayChannel();
                 }
                 NotifyUsers(stream, streamdata);
             }
         }
         if (write)
         {
             _context.SaveChanges();
         }
     }
     return(true);
 }
        private async Task NotifyUsers(Data.DBModels.StreamModels.Stream stream, TwitchLib.Api.Helix.Models.Streams.Stream streamdata)
        {
            int longDelayCounter = 0;

            foreach (string username in stream.GetActiveSubscribers())
            {
                longDelayCounter++;
                if (longDelayCounter == 5)
                {
                    longDelayCounter = 0;
                    await Task.Delay(2000);
                }
                _eventBus.TriggerEvent(EventType.DiscordMessageSendRequested, new MessageArgs()
                {
                    Message = stream.StreamStartedMessage(streamdata.Title, GetStreamUrl(stream)), RecipientName = username
                });
                await Task.Delay(100);
            }
        }