Пример #1
0
        internal static async Task Migration_CreateVoiceChannels(DiscordRestClient client, RestGuild guild)
        {
            var voice1 = await guild.CreateVoiceChannelAsync("voice1");

            var voice2 = await guild.CreateVoiceChannelAsync("voice2");

            var voice3 = await guild.CreateVoiceChannelAsync("voice3");

            var cat2 = await guild.CreateCategoryChannelAsync("cat2");

            await voice1.ModifyAsync(x =>
            {
                x.Bitrate    = 96000;
                x.Position   = 1;
                x.CategoryId = cat2.Id;
            });

            await voice2.ModifyAsync(x =>
            {
                x.UserLimit = null;
            });

            await voice3.ModifyAsync(x =>
            {
                x.Bitrate    = 8000;
                x.Position   = 1;
                x.UserLimit  = 16;
                x.CategoryId = cat2.Id;
            });

            CheckVoiceChannels(voice1, voice2, voice3);
        }
Пример #2
0
        internal static async Task Migration_CreateTextChannels(DiscordRestClient client, RestGuild guild)
        {
            var text1 = await guild.GetDefaultChannelAsync();

            var text2 = await guild.CreateTextChannelAsync("text2");

            var text3 = await guild.CreateTextChannelAsync("text3");

            var text4 = await guild.CreateTextChannelAsync("text4");

            var text5 = await guild.CreateTextChannelAsync("text5");

            // create a channel category
            var cat1 = await guild.CreateCategoryChannelAsync("cat1");

            if (text1 == null)
            {
                // the guild did not have a default channel, so make a new one
                text1 = await guild.CreateTextChannelAsync("default");
            }

            //Modify #general
            await text1.ModifyAsync(x =>
            {
                x.Name       = "text1";
                x.Position   = 1;
                x.Topic      = "Topic1";
                x.CategoryId = cat1.Id;
            });

            await text2.ModifyAsync(x =>
            {
                x.Position   = 2;
                x.CategoryId = cat1.Id;
            });

            await text3.ModifyAsync(x =>
            {
                x.Topic = "Topic2";
            });

            await text4.ModifyAsync(x =>
            {
                x.Position = 3;
                x.Topic    = "Topic2";
            });

            await text5.ModifyAsync(x =>
            {
            });

            CheckTextChannels(guild, text1, text2, text3, text4, text5);
        }