Exemplo n.º 1
0
        private void UpdateClients()
        {
            lock (clientsLock)
            {
                var response = new ClientListCommand(includeUniqueId: true, includeGroupInfo: true, includeCountry: true).Execute(Interface.TS3Bot.QueryClient);
                if (response.IsErroneous)
                {
                    return;
                }

                foreach (var c in response.Values)
                {
                    UpdateClient(mapper.Map <ClientListEntry, Client>(c));
                }
            }
        }
Exemplo n.º 2
0
        private void RegisterConnectedClients()
        {
            RankingBot.Logger.Debug(_file + " Registering connected clients");
            EntityListCommandResponse <ClientListEntry> clients = new ClientListCommand(true).Execute(RankingBot.TS3);

            foreach (ClientListEntry client in clients.Values)
            {
                RankingBot.Logger.Debug(_file + " Found new client (ClientID: '" + client.ClientId + "', Nickname: '" + client.Nickname + "', UniqueID: '" + client.ClientUniqueId + "', Type: '" + client.ClientType + "')");
                if (RankingBot.Debugging && RankingBot.Debugger != null && RankingBot.Debugger != client.ClientUniqueId)
                {
                    RankingBot.Logger.Debug(_file + " Ignoring client. Debugging with a specific UniqueID (ClientID: '" + client.ClientId + "')");
                }
                else if (client.ClientType == 0)
                {
                    RankingBot.Logger.Debug(_file + " Added new client (ClientID: '" + client.ClientId + "')");
                    _clients.Add(client.ClientId, new Client(client.ClientId));
                }
            }
        }
Exemplo n.º 3
0
 public void CheckOnInterval()
 {
     try
     {
         var restrictedwords   = _config.BannedWords;
         var regexMatch        = string.Join <string>("|", restrictedwords);
         var regex             = new Regex($"({regexMatch})", RegexOptions.IgnoreCase);
         var clientListCommand = new ClientListCommand().ExecuteAsync(Interface.XfQueryBot.QueryClient);
         var clientList        = clientListCommand.Result.Values;
         clientList.ForEach(client =>
         {
             var clientinfo = new ClientInfoCommand(client.ClientId)
                              .ExecuteAsync(Interface.XfQueryBot.QueryClient)
                              .Result;
             if (!regex.IsMatch(client.Nickname) || !client.ClientType.Equals(0))
             {
                 return;
             }
             if (_config.PokeOrKick.Equals("Kick", StringComparison.OrdinalIgnoreCase))
             {
                 new ClientKickCommand(client.ClientId, KickReason.Server,
                                       _config.Reason[CheckClientLang(clientinfo)].Replace("[NICKNAME]", client.Nickname))
                 .ExecuteAsync(Interface.XfQueryBot.QueryClient);
             }
             else
             {
                 new ClientPokeCommand(client.ClientId,
                                       _config.Reason[CheckClientLang(clientinfo)].Replace("[NICKNAME]", client.Nickname))
                 .ExecuteAsync(Interface.XfQueryBot.QueryClient);
             }
         });
     }
     catch (Exception ex)
     {
         _log.Error($"({_extension.Name}) : {ex}");
     }
 }