Пример #1
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);
        }
Пример #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");

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

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

            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);
        }