Пример #1
0
        public RotatingStatusService(BaseSocketClient socket, Queue <string> statuses = null)
        {
            StatusValues = statuses ?? new Queue <string>();
            Socket       = socket;

            rotationTimer = new Timer(async _ =>
            {
                if (StatusValues.Count <= 0)
                {
                    return;
                }

                var status = StatusValues.Dequeue();
                if (status.EqualsIgnoreCase(Socket.Activity?.Name ?? ""))
                {
                    return;
                }

                StatusValues.Enqueue(status);
                await Socket.SetGameAsync(await VariableFormatting.FormatStatus(Socket, status));
            },
                                      null,
                                      Timeout.Infinite,
                                      Timeout.Infinite);
        }
Пример #2
0
 public void AddStatus(string status)
 {
     if (string.IsNullOrWhiteSpace(status))
     {
         return;
     }
     StatusValues.Enqueue(status);
 }