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);
        }
示例#2
0
        private static async Task <TeamSpeakClient> GetConnectedClient()
        {
            var bot = new TeamSpeakClient(ConfigManager.Config.Host, ConfigManager.Config.Port);
            await bot.Connect();

            await bot.Login(ConfigManager.Config.QueryUsername, ConfigManager.Config.QueryPassword);

            await bot.UseServer((await bot.GetServers()).FirstOrDefault().Id);

            return(bot);
        }