public Task EditChannel(int channelId, EditChannelInfo channelInfo)
        {
            var updateParameters = channelInfo.ToQueryParameters();

            updateParameters.Add(new Parameter("cid", channelId));

            return(Client.Send("channeledit", updateParameters.ToArray()));
        }
Пример #2
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);
        }
Пример #3
0
        public Task EditChannel(int channelId, EditChannelInfo channel)
        {
            var updateParameters = new List <Parameter>
            {
                new Parameter("cid", channelId),
            };

            if (channel.Name != null)
            {
                updateParameters.Add(new Parameter("channel_name", channel.Name));
            }
            if (channel.Topic != null)
            {
                updateParameters.Add(new Parameter("channel_topic", channel.Topic));
            }
            if (channel.Description != null)
            {
                updateParameters.Add(new Parameter("channel_description", channel.Description));
            }
            if (channel.Password != null)
            {
                updateParameters.Add(new Parameter("channel_password", channel.Password));
            }
            if (channel.Codec != null)
            {
                updateParameters.Add(new Parameter("channel_codec", (int)channel.Codec));
            }
            if (channel.CodecQuality != null)
            {
                updateParameters.Add(new Parameter("channel_codec_quality", channel.CodecQuality));
            }
            if (channel.MaxClients != null)
            {
                updateParameters.Add(new Parameter("channel_maxclients", channel.MaxClients));
            }
            if (channel.MaxFamilyClients != null)
            {
                updateParameters.Add(new Parameter("channel_maxfamilyclients", channel.MaxFamilyClients));
            }
            if (channel.Order != null)
            {
                updateParameters.Add(new Parameter("channel_order", channel.Order));
            }
            if (channel.IsPermanent != null)
            {
                updateParameters.Add(new Parameter("channel_flag_permanent", channel.IsPermanent));
            }
            if (channel.IsSemiPermanent != null)
            {
                updateParameters.Add(new Parameter("channel_flag_semi_permanent", channel.IsSemiPermanent));
            }
            if (channel.IsTemporary != null)
            {
                updateParameters.Add(new Parameter("channel_flag_temporary", channel.IsTemporary));
            }
            if (channel.IsDefaultChannel != null)
            {
                updateParameters.Add(new Parameter("channel_flag_default", channel.IsDefaultChannel));
            }
            if (channel.IsMaxClientsUnlimited != null)
            {
                updateParameters.Add(new Parameter("channel_flag_maxclients_unlimited", channel.IsMaxClientsUnlimited));
            }
            if (channel.IsMaxFamilyClientsUnlimited != null)
            {
                updateParameters.Add(new Parameter("channel_flag_maxfamilyclients_unlimited", channel.IsMaxFamilyClientsUnlimited));
            }
            if (channel.IsMaxFamilyClientsInherited != null)
            {
                updateParameters.Add(new Parameter("channel_flag_maxfamilyclients_inherited", channel.IsMaxFamilyClientsInherited));
            }
            if (channel.NeededTalkPower != null)
            {
                updateParameters.Add(new Parameter("channel_needed_talk_power", channel.NeededTalkPower));
            }
            if (channel.PhoneticName != null)
            {
                updateParameters.Add(new Parameter("channel_name_phonetic", channel.PhoneticName));
            }
            if (channel.IconId != null)
            {
                updateParameters.Add(new Parameter("channel_icon_id", (int)channel.IconId));
            }
            if (channel.IsCodecUnencrypted != null)
            {
                updateParameters.Add(new Parameter("channel_codec_is_unencrypted", channel.IsCodecUnencrypted));
            }
            if (channel.ParentChannelId != null)
            {
                updateParameters.Add(new Parameter("channel_cpid", channel.ParentChannelId));
            }

            return(Client.Send("channeledit", updateParameters.ToArray()));
        }