示例#1
0
        private static async Task SetTopList(TeamSpeakClient bot)
        {
            if (!ClientManager.Clients.Any())
            {
                Console.WriteLine("[!] Couldn't update channel info: no users! ==========");
                return;
            }

            Console.WriteLine("[>] Updating channel info");
            var topUsers    = ClientManager.Clients.OrderByDescending(x => x.ActiveTime).ToArray();
            var channelName = FormatChannelName(topUsers.FirstOrDefault());;

            var channelInfo = await bot.GetChannelInfo(ConfigManager.Config.ChannelId);

            var editInfo = new EditChannelInfo();

            editInfo.Description = FormatChannelDescription(topUsers);
            if (channelInfo.Name != channelName)
            {
                editInfo.Name = channelName;
            }
            await bot.EditChannel(ConfigManager.Config.ChannelId, editInfo);
        }