public async static Task <IReadOnlyList <TeamSpeak3QueryApi.Net.Specialized.Responses.GetServerListInfo> > GetServerinfo() { try { var rc = new TeamSpeakClient(host); await rc.Connect(); await rc.Login(username, pass); await rc.UseServer(1); await rc.WhoAmI(); await rc.RegisterServerNotification(); await rc.RegisterChannelNotification(30); var servers = await rc.GetServers(); await rc.Logout(); return(servers); } catch { } return(null); }
public async static Task <List <TeamSpeak3QueryApi.Net.Specialized.Responses.GetClientInfo> > GetClients() { try { var rc = new TeamSpeakClient(host); await rc.Connect(); await rc.Login(username, pass); await rc.UseServer(1); await rc.WhoAmI(); await rc.RegisterServerNotification(); await rc.RegisterChannelNotification(30); var serverGroups = await rc.GetServerGroups(); var firstNormalGroup = serverGroups?.FirstOrDefault(s => s.ServerGroupType == ServerGroupType.NormalGroup); var groupClients = await rc.GetServerGroupClientList(firstNormalGroup.Id); var currentClients = await rc.GetClients(); var fullClients = currentClients.Where(c => c.Type == ClientType.FullClient).ToList(); await rc.Logout(); return(fullClients); } catch { } return(null); }
public async Task Disconnect() { try { tsClient.Unsubscribe <ClientMoved>(ClientMoved); tsClient.Unsubscribe <TextMessage>(ChatMessageReceived); await tsClient.Logout(); tsClient.Dispose(); tsClient = null; } catch (Exception e) { logger.LogWarning(e.Message); logger.LogWarning(e.StackTrace); } }