예제 #1
0
        private void Worker_DoWork(object sender, DoWorkEventArgs e)
        {
            while (true)
            {
                IReadOnlyCollection <IGuildUser> users   = AudioChannel.GetUsersAsync().ToListAsync().Result[0];
                IEnumerable <IGuildUser>         nonBots = users.Where(u => !u.IsBot).ToList();

                IEnumerable <IGuildUser> filteredUser = nonBots.Where(u => {
                    bool cond = !u.IsSelfDeafened;
                    return(cond && !u.IsSelfMuted);
                }).ToList();

                if (nonBots.Count() == 0)
                {
                    VCWorkerCompletedEvent.Invoke(this);
                    _worker.CancelAsync();
                    return;
                }

                if (filteredUser.Count() >= 2)
                {
                    foreach (IGuildUser user in filteredUser)
                    {
                        AwardVCPointsEvent.Invoke((IGuildUser)(user));
                    }
                }

                Thread.Sleep(checkPeriod);
            }
        }
예제 #2
0
 private void _worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     VCWorkerCompletedEvent.Invoke(this);
 }