internal async Task ProcessQueueAsync() { Console.Write("\u2588"); if (queue.Count == 0) { return; } Effect br = queue.First.Value; switch (br.EffectType) { case EffectType.BITS: BitEffect be = (BitEffect)br; Log.Information($"BIT EFFECT SET: {be.Username}, {br.EffectName}, {br.Milliseconds / 1000} seconds"); if (!be.Continued) { string msgBit = settings.msgEffectSet.Replace("{username}", be.Username) .Replace("{effect}", br.EffectName).Replace("{seconds}", br.Milliseconds / 1000 + ""); twitchClient.SendMessage(settings.botJoinChannel, msgBit); } await ProcessEffect(br); break; case EffectType.SUB: SubEffect se = (SubEffect)br; Log.Information($"SUB EFFECT SET: Tier {se.Tier}, {se.Months} months," + $" {br.EffectName}, {br.Milliseconds / 1000} seconds"); await ProcessEffect(br); break; } }
internal void HandleSubscription(OnChannelSubscriptionArgs args) { Console.WriteLine(); Log.Information($"{args.Subscription.DisplayName}/{args.Subscription.RecipientDisplayName} has just subscribed!" + $" ({args.Subscription.Months} months, tier {args.Subscription.SubscriptionPlan})"); SubEffect se = new SubEffect(args.Subscription.Months != null? (int)args.Subscription.Months : 0, args.Subscription.SubscriptionPlan, args.Subscription.DisplayName); queue.EnqueueSubEffect(se); }