Example #1
0
 public DiscordAnnouncer(DiscordRestClient discordClient, ulong guildId, ulong purgeLogChannelId, string warningText)
 {
     _warningText  = warningText;
     _guild        = discordClient.GetGuildAsync(guildId).Result;
     _purgeChannel = _guild.GetTextChannelAsync(purgeLogChannelId).Result;
     _userDict     = _guild.GetUsersAsync().FlattenAsync().Result.ToDictionary(u => u.Id, u => u);
 }
        private async Task <(RestRole role, RestCategoryChannel category, RestTextChannel text, RestVoiceChannel voice)> CreateGroup(int groupNumber)
        {
            string   name = string.Format(_groupConfig.GroupChannelNameTemplate, groupNumber);
            RestRole role = await Context.Guild.CreateRoleAsync(name,
                                                                GuildPermissions.None,
                                                                _roleColors[(groupNumber - 1) % _roleColors.Count], // groupNumber is 1-indexed
                                                                isMentionable : false,
                                                                isHoisted : true);

            // Create group-category which only 'role' can see and join
            RestCategoryChannel category = await Context.Guild.CreateCategoryChannelAsync(name);

            OverwritePermissions groupPermission = new OverwritePermissions(viewChannel: PermValue.Allow, connect: PermValue.Allow);
            await category.AddPermissionOverwriteAsync(role, groupPermission);

            // The bot needs those permissions as well otherwise it can't delete the channel later on. Alternatively you could add 'role' to the bot.
            await category.AddPermissionOverwriteAsync(Context.Client.CurrentUser, groupPermission);

            OverwritePermissions everyonePermission = new OverwritePermissions(viewChannel: PermValue.Deny, connect: PermValue.Deny);
            await category.AddPermissionOverwriteAsync(Context.Guild.EveryoneRole, everyonePermission);

            // Add one text and one voice channel
            Action <GuildChannelProperties> assignCategoryId = c => c.CategoryId = category.Id;
            RestTextChannel text = await Context.Guild.CreateTextChannelAsync(name, assignCategoryId);

            RestVoiceChannel voice = await Context.Guild.CreateVoiceChannelAsync(name, assignCategoryId);

            return(role, category, text, voice);
        }
Example #3
0
 public static async Task SetAccessPermissions(RestTextChannel channel, IUser[] users)
 {
     foreach (IUser user in users)
     {
         await channel.AddPermissionOverwriteAsync(user, ACCESS_PERMISSIONS);
     }
 }
Example #4
0
 private OverwritePermissions BasicViewChannelPerms(RestTextChannel channel)
 {
     return(OverwritePermissions.DenyAll(channel).Modify(
                connect: PermValue.Allow,
                viewChannel: PermValue.Allow,
                readMessageHistory: PermValue.Allow));
 }
Example #5
0
        public async Task CreateChannels(SocketCommandContext context, PendingGame pendingGame)
        {
            SocketGuild guild = GetGuildByContext(context);

            DayChannel = await CreatePrivateGroupTextChannel(
                guild,
                GameElement.Channel.Public(),
                GameElement.ChannelDescription.Public());

            NightChannel = await CreatePrivateGroupTextChannel(
                guild,
                GameElement.Channel.Private(),
                GameElement.ChannelDescription.Private(ActiveGame.Uninformed.ToList()));

            CommandChannel = await CreatePrivateGroupTextChannel(
                guild,
                GameElement.Channel.Command(),
                string.Empty);

            GameChannels = new List <GameChannel>(new[]
            {
                new GameChannel(DayChannel, new [] { "excommunicate" }),
                new GameChannel(NightChannel, new [] { "sacrifice" }),
                new GameChannel(CommandChannel, new [] { "start", "kill", "kick", "signs" })
            });
        }
Example #6
0
 private OverwritePermissions InteractChannelPerms(RestTextChannel channel)
 {
     return(BasicViewChannelPerms(channel).Modify(
                sendMessages: PermValue.Allow,
                addReactions: PermValue.Allow,
                sendTTSMessages: PermValue.Allow));
 }
Example #7
0
        public async Task FixRoomsAsync()
        {
            await ReplyAsync("Checking rooms...");

            int roomCount = 0;

            using (DiscordContext db = new DiscordContext())
            {
                foreach (SocketGuildUser user in Context.Guild.Users)
                {
                    Logger.Verbose("system", $"Room check for {user.Username}");
                    SocketTextChannel pRoom = Context.Guild.TextChannels.Where(x => x.Name.Contains(user.Id.ToString())).FirstOrDefault();

                    if (pRoom == null)
                    {
                        Logger.Verbose("system", $"No room found. Creating room.");
                        await ReplyAsync($"No room found for {user.Username}. Room created");

                        RestTextChannel newPersonalRoom = await RoomUtilities.CreatePersonalRoomAsync(Context.Guild, user);

                        db.Users.Where(u => u.DiscordId == user.Id).FirstOrDefault().PersonalRoom = newPersonalRoom.Id;

                        roomCount++;
                    }
                    else
                    {
                        db.Users.Where(u => u.DiscordId == user.Id).FirstOrDefault().PersonalRoom = pRoom.Id;
                    }
                }
            }

            await ReplyAsync($"Finished checking rooms. Rooms created: {roomCount}");
        }
Example #8
0
        public async Task CreateVoiceChannelForRole(string channelName)
        {
            RestRole newRole = await Context.Guild.CreateRoleAsync(channelName);

            RestTextChannel textChannel = await Context.Guild.CreateTextChannelAsync(channelName);

            RestVoiceChannel voiceChannel = await Context.Guild.CreateVoiceChannelAsync(channelName);

            Discord.OverwritePermissions newRolePermission = new Discord.OverwritePermissions(
                readMessages: Discord.PermValue.Allow
                );

            Discord.OverwritePermissions everyonePermission = new Discord.OverwritePermissions(
                readMessages: Discord.PermValue.Deny
                );

            await textChannel.AddPermissionOverwriteAsync(Context.Guild.EveryoneRole, everyonePermission);

            await textChannel.AddPermissionOverwriteAsync(newRole, newRolePermission);

            DiscordServer server = DiscordServer.GetServerFromID(Context.Guild.Id);

            server.voiceChannelRoles.Add(new VoiceChannelRole()
            {
                voiceChannelID = voiceChannel.Id,
                textChannelID  = textChannel.Id,
                roleID         = newRole.Id
            });
            server.SaveData();
        }
Example #9
0
        public async Task CreateSection()
        {
            GuildBson guild = await Database.LoadRecordsByGuildId(Context.Guild.Id);

            RestCategoryChannel categoryChannel = await Context.Guild.CreateCategoryChannelAsync("Auditor");

            await categoryChannel.AddPermissionOverwriteAsync(Context.Guild.EveryoneRole,
                                                              OverwritePermissions.DenyAll(categoryChannel));

            foreach ((string name, ulong?channel) in GetSettingStates(guild))
            {
                if (channel == null)
                {
                    continue;
                }

                RestTextChannel textChannel = await Context.Guild.CreateTextChannelAsync(name.Replace("Event", ""),
                                                                                         o => o.CategoryId = categoryChannel.Id);

                guild.GetType().GetProperty(name)?.SetValue(guild, textChannel.Id);
            }

            guild.CategoryId = categoryChannel.Id;
            await Database.UpdateGuild(guild);

            await SendSuccessAsync("Created Auditor sections, please move to a more convenient place.");
        }
Example #10
0
        private async Task <ITextChannel> CreateFameChannelAsync(IMessage msg)
        {
            string name = "⭐hall-of-fames⭐";
            string desc = $"Memorable, unique messages. Adds a message when reacting with a ⭐ to a message.";

            if (msg.Author is SocketGuildUser guildUser)
            {
                IGuild     guild   = guildUser.Guild;
                IGuildUser botUser = await guild.GetCurrentUserAsync();

                if (botUser.GuildPermissions.ManageChannels)
                {
                    RestTextChannel chan = await guildUser.Guild.CreateTextChannelAsync(name);

                    OverwritePermissions basePerms = new OverwritePermissions(mentionEveryone: PermValue.Deny, sendMessages: PermValue.Deny, sendTTSMessages: PermValue.Deny);
                    OverwritePermissions botPerms  = new OverwritePermissions(sendMessages: PermValue.Allow, addReactions: PermValue.Allow, embedLinks: PermValue.Allow, manageWebhooks: PermValue.Allow);
                    await chan.AddPermissionOverwriteAsync(guildUser.Guild.EveryoneRole, basePerms);

                    await chan.AddPermissionOverwriteAsync(guildUser.Guild.CurrentUser, botPerms);

                    await chan.ModifyAsync(prop => prop.Topic = desc);

                    return(chan);
                }
            }

            return(null);
        }
Example #11
0
        public async Task GetGuildUsersAsync()
        {
            string response = "";

            // Implementation via Guild.Users
            // foreach (var x in Context.Guild.Users) { response += (x.Username + " "); };

            //Implementation via REST Client directly
            //RestGuild guildRest = await _clientRest.GetGuildAsync(Context.Guild.Id);
            //await guildRest.GetUsersAsync().ForEachAsync(x =>
            //{
            //    foreach (IGuildUser y in x) { Console.Write("{name} ", y.Username); };
            //});

            // Implementation via Websocket method that uses REST API
            await Context.Guild.GetUsersAsync().ForEachAsync(x =>
            {
                foreach (IGuildUser y in x)
                {
                    response += y.Username + " ";
                }
                ;
            });

            // Sending response via REST for test purposes
            RestGuild guildRest = await _clientRest.GetGuildAsync(Context.Guild.Id);

            RestTextChannel channelRest = await guildRest.GetTextChannelAsync(Context.Channel.Id);

            await channelRest.SendMessageAsync(response);

            // Sending response via WebSocket
            // await ReplyAsync(response);
        }
        async Task InitializeDiscord()
        {
            client = new DiscordRestClient();
            await client.LoginAsync(TokenType.Bot, token);

            channel = await client.GetChannelAsync(GeneralChannelId) as RestTextChannel;
        }
Example #13
0
        private async Task <RestTextChannel> CreateChannels()
        {
            infoChannel = await discord.GetGuild(505485680344956928).CreateTextChannelAsync(randomEventModel.title + "-randomevent-info", null, new RequestOptions());

            //await infoChannel.AddPermissionOverwriteAsync(discord.GetGuild(505485680344956928).Roles.FirstOrDefault(x => x.Id == 611102875241676811), new OverwritePermissions().Modify(readMessageHistory:Discord.PermValue.Allow, viewChannel: Discord.PermValue.Allow, sendMessages: Discord.PermValue.Deny));
            await infoChannel.AddPermissionOverwriteAsync(discord.GetGuild(505485680344956928).Roles.FirstOrDefault(x => x.Id == 505485680344956928), new OverwritePermissions().Modify(readMessageHistory: Discord.PermValue.Allow, viewChannel: Discord.PermValue.Deny, useExternalEmojis: Discord.PermValue.Deny, sendMessages: Discord.PermValue.Deny));

            generalChannel = await discord.GetGuild(505485680344956928).CreateTextChannelAsync(randomEventModel.title + "-randomevent-general", null, new RequestOptions());

            await generalChannel.AddPermissionOverwriteAsync(discord.GetGuild(505485680344956928).Roles.FirstOrDefault(x => x.Id == 505485680344956928), new OverwritePermissions().Modify(readMessageHistory: Discord.PermValue.Deny, viewChannel: Discord.PermValue.Deny));

            var eventleiders = randomEventModel.eventLeider.Split(" ");

            foreach (var eventleider in eventleiders)
            {
                var id   = eventleider.Replace("<@!", "").Replace(">", "");
                var user = discord.GetUser(ulong.Parse(id));
                await infoChannel.AddPermissionOverwriteAsync(user, new OverwritePermissions().Modify(sendMessages: Discord.PermValue.Allow));
            }

            var builder = EmbedBuilderExtension.NullEmbed(randomEventModel.title, randomEventModel.description, null, null);

            builder.AddField(new EmbedFieldBuilder {
                Name = "Datum", Value = randomEventModel.date.ToString()
            });
            builder.AddField(new EmbedFieldBuilder {
                Name = "Locatie", Value = randomEventModel.locatie
            });
            builder.AddField(new EmbedFieldBuilder {
                Name = "Eventleider(s)", Value = randomEventModel.eventLeider
            });

            builder.Footer = new EmbedFooterBuilder {
                Text = "Groen vinkje = Ik neem deel aan \nBlauw vinkje = Ik ben geinteresseerd \nRode kruis = verwijder deze channel"
            };

            await infoChannel.SendFileAsync("../../../Resources/Img/randomevent.jpg", "", false);

            var messageInChannel = await infoChannel.SendMessageAsync(null, false, builder.Build());

            var deelnemersMessage = await infoChannel.SendMessageAsync(null, false, EmbedBuilderExtension.NullEmbed("Deelnemers", "", null, null).Build());

            await messageInChannel.AddReactionAsync(Emote.Parse("<:green_check:671412276594475018>"));

            await messageInChannel.AddReactionAsync(Emote.Parse("<:blue_check:671413239992549387>"));

            await messageInChannel.AddReactionAsync(Emote.Parse("<:red_check:671413258468720650>"));

            var deelnemers = new Dictionary <ulong, string[]>();
            //deelnemers.Add(deelnemersMessage.Id, new string[]{ "Testname", "Testname2" });
            var f             = messageInChannel.Id.ToString() + "0";
            var generalFakeId = ulong.Parse(f);

            deelnemers.Add(deelnemersMessage.Id, new string[] { "Yeet" });
            deelnemers.Add(generalFakeId, new string[] { generalChannel.Id.ToString() });
            JsonExtension.InsertJsonData("../../../Resources/irleventdata.txt", messageInChannel.Id.ToString(), deelnemers);

            return(infoChannel);
        }
        async Task InitializeDiscord(string token)
        {
            client = new DiscordRestClient();

            await client.LoginAsync(TokenType.Bot, "NDU5NzM3ODk4NjUzMzE5MTY4.XrA89w.H6nM6U4zhpde3gJOu471KEErMJQ");

            channel = await client.GetChannelAsync(GeneralChannelId) as RestTextChannel;
        }
        public async Task SendMessage(string message)
        {
            RestGuild guild = (RestGuild)await _client.GetGuildAsync(225374061386006528);

            RestTextChannel channel = await guild.GetTextChannelAsync(718854497245462588);

            await channel.SendMessageAsync(message);
        }
Example #16
0
        public async Task InterventionAsync(IUser requestedUser)
        {
            await BotReporting.ReportAsync(ReportColors.modCommand,
                                           (SocketTextChannel)Context.Channel,
                                           $"Intervention command by {Context.User.Username}",
                                           $"<@{Context.User.Id}> placed <@{requestedUser.Id}> in an intervention.",
                                           Context.User,
                                           (SocketUser)requestedUser).ConfigureAwait(false);

            using (DiscordContext db = new DiscordContext())
            {
                ulong userId = Context.User.Id;
                if (db.Users.Where(x => x.DiscordId == userId).FirstOrDefault().Privilege == User.Privileges.User)
                {
                    Logger.Warning(Context.User.Username, "Failed intervention command. Not enough privileges.");
                    await ReplyAsync("You are not a moderator, go away.");

                    return;
                }

                try
                {
                    // Look for intervention role
                    SocketRole intervetionRole = Context.Guild.Roles.Where(x => x.Name.ToLower() == "intervention").First();

                    // give user the role
                    SocketGuildUser user = requestedUser as SocketGuildUser;
                    await user.AddRoleAsync(intervetionRole);

                    // Create the channel and add the user
                    RestTextChannel interventionChannel = await Context.Guild.CreateTextChannelAsync($"intervention-{user.Id}");

                    await interventionChannel.AddPermissionOverwriteAsync(Context.Guild.EveryoneRole, Permissions.removeAllPerm);

                    await interventionChannel.AddPermissionOverwriteAsync(user, Permissions.userPerm);

                    await interventionChannel.AddPermissionOverwriteAsync(Context.Guild.Roles.Where(r => r.Name == Roles.Staff).FirstOrDefault(), Permissions.adminPerm);

                    // Notify user of intervention
                    await interventionChannel.SendMessageAsync($"{user.Mention} you have been placed in intervention due to either your profile or attitude in the server.\n" +
                                                               $"A staff member should be here shortly to assist you.");
                }
                catch (Exception e)
                {
                    await BotReporting.ReportAsync(ReportColors.exception,
                                                   (SocketTextChannel)Context.Channel,
                                                   e.Message,
                                                   $"Source: {e.Source}\n {e.InnerException}\n {e.StackTrace}",
                                                   Engine.luna);

                    return;
                }


                // Add permissions (user and staff)
                // un-limbo person
            }
        }
Example #17
0
        public static async Task RemoveAllPermissions(RestTextChannel channel)
        {
            IEnumerable <RestGuildUser> users = await channel.GetUsersAsync().FlattenAsync();

            foreach (RestGuildUser user in users)
            {
                await channel.RemovePermissionOverwriteAsync(user);
            }
        }
Example #18
0
        public async Task DeleteChannel(RestTextChannel chnl)
        {
            if (testMode)
            {
                return;
            }

            await chnl.DeleteAsync();
        }
Example #19
0
        private async Task <RestTextChannel> CreatePrivateGroupTextChannel(SocketGuild guild, string name, string description)
        {
            var             everyoneRole = guild.Roles.FirstOrDefault(r => r.Name == "@everyone");
            RestTextChannel channel      = await guild.CreateTextChannelAsync(name, (properties) => { properties.Topic = description; });

            await channel.AddPermissionOverwriteAsync(everyoneRole, OverwritePermissions.DenyAll(channel));

            return(channel);
        }
Example #20
0
        private async Task CreateJDRChannels()
        {
            await Context.Channel.SendMessageAsync("Tentative de création");

            await DeleteOldChannels("lobby", "en attente");

            maintTextChannel = await Context.Guild.CreateTextChannelAsync("Lobby");

            mainVoiceChannel = await Context.Guild.CreateVoiceChannelAsync("Joueurs en attente");
        }
Example #21
0
 public static async Task SetAccessPermissions(RestTextChannel channel, IUser[] users, OverwritePermissions perms)
 {
     foreach (IUser user in users)
     {
         if (user != null)
         {
             await channel.AddPermissionOverwriteAsync(user, perms);
         }
     }
 }
Example #22
0
        public static void SendMainMessage(DiscordSocketClient client, RestTextChannel channel, SocketUser user, TicketChild child)
        {
            var message = channel.SendMessageAsync("", false, GetLockEmbed(child, user.Mention));

            message.Wait();

            message.Result.AddReactionAsync(LockEmoji);

            child.MainMessageId = message.Result.Id;
        }
Example #23
0
        public async Task Start(string Category)
        {
            if (!UserIsGameMater((SocketGuildUser)Context.User))
            {
                await ReplyAndDeleteAsync(":x: You are not the gamemaster. " + Context.User.Mention, timeout : new TimeSpan(0, 0, 15));

                return;
            }

            string folderPath = @$ "{ Directory.GetCurrentDirectory()}/Category/";

            if (!File.Exists(folderPath + Category + ".caty"))
            {
                await ReplyAndDeleteAsync($"Category does not exist", timeout : new TimeSpan(0, 0, 15));

                return;
            }


            var words = File.ReadAllLines(folderPath + Category + ".caty");

            if (words.Length < 1)
            {
                await ReplyAndDeleteAsync($"There are no words in **{Category}**", timeout : new TimeSpan(0, 0, 15));

                return;
            }

            var c = Context.Guild.CategoryChannels.SingleOrDefault(x => x.Name == "Games");

            if (c == null)
            {
                Console.WriteLine("There is no Category named Games");
                return;
            }

            RestTextChannel Room = await Context.Guild.CreateTextChannelAsync($"Hangman-{Category}-{_games.Count + 1}", x => {
                x.CategoryId = c.Id;
            });

            if (Room == null)
            {
                Console.WriteLine("Something went wrong");
                return;
            }

            Hangman game = new Hangman(Room.Id, Context.Client, words);

            _games.Add(game);

            await ReplyAndDeleteAsync($"A Game Has started on <#{Room.Id}>", timeout : new TimeSpan(0, 0, 15));

            game.Start();
        }
Example #24
0
                public async Task <Result> Execute(SocketUserMessage e, string name)
                {
                    if (CanCreate())
                    {
                        RestTextChannel channel = await Utility.GetServer().CreateTextChannelAsync(name);

                        return(new Result(channel, "Succesfully created a new text channel: " + channel.Mention));
                    }
                    else
                    {
                        return(new Result(null, "Failed to create new channel - Bot does not have correct permissions."));
                    }
                }
Example #25
0
        public static GameSession Build(SocketGuild g, Server s, IGame game)
        {
            EmbedBuilder    panel   = game.Embedder.DefaultPanel();
            RestTextChannel channel = g.CreateTextChannelAsync(game.ChannelName, x => { x = GameChannelProperties; }).Result;
            RestUserMessage msg     = channel.SendMessageAsync(embed: panel.Build()).Result;
            GameSession     session = new GameSession(channel.Id, msg, panel);

            if (!s.OpenGameSessions.Exists())
            {
                s.OpenGameSessions = new List <GameSession>();
            }
            s.OpenGameSessions.Add(session);
            return(session);
        }
Example #26
0
        public async Task HandleCreateRoomCommand(CommandContext context)
        {
            if (context.Message.MentionedUsers.Count > 0)
            {
                RestTextChannel NewMissionChannel =
                    await MissionModel.CreateMission(context.Args[1], context.Message.MentionedUsers, context.Guild, context.User);

                await context.Channel.SendEmbedAsync("Successfully created new Mission. Check it out: " + NewMissionChannel.Mention);
            }
            else
            {
                await context.Channel.SendEmbedAsync("You need to mention explorers (Example: @Explorer#0001)!");
            }
        }
Example #27
0
        private async Task <IUser> RunVote(SocketGuild guild, RestTextChannel channel, int seconds, string message, IUser[] users, IUser[] randomSelection = null)
        {
            if (votes.ContainsKey(guild.Id))
            {
                votes[guild.Id] = new List <IUser>();
            }
            else
            {
                votes.Add(guild.Id, new List <IUser>());
            }

            if (!votingChannels.Contains(channel.Id))
            {
                votingChannels.Add(channel.Id);
            }

            await GuildUtils.SetAccessPermissions(channel, users, GuildUtils.CAN_SEND);

            await channel.SendMessageAsync(message);

            RestUserMessage timeMessage = await channel.SendMessageAsync(seconds + " seconds left.");

            for (int a = 0; a < seconds; a++)
            {
                await timeMessage.ModifyAsync(msg => msg.Content = (seconds - a) + " seconds left.");

                await Task.Delay(1000);
            }

            await GuildUtils.SetAccessPermissions(channel, users, GuildUtils.CANT_SEND);

            votingChannels.Remove(channel.Id);

            if (MafiaBot.DEBUG_MODE)
            {
                Console.WriteLine(votes[guild.Id].Count + ":" + (randomSelection == null) + ":" + (randomSelection == null ? -1 : randomSelection.Length));
            }

            if (votes[guild.Id].Count > 0)
            {
                return(votes[guild.Id].MostCommon());
            }
            else if (randomSelection != null)
            {
                return(randomSelection[(new Random()).Next(0, randomSelection.Length)]);
            }

            return(null);
        }
Example #28
0
        public static async Task <int> NumberOfOnlineUsers(RestTextChannel channel)
        {
            int count = 0;
            IEnumerable <RestGuildUser> users = await channel.GetUsersAsync().FlattenAsync();

            foreach (RestGuildUser user in users)
            {
                if (user.Status == UserStatus.Online)
                {
                    count++;
                }
            }

            return(count);
        }
Example #29
0
        public static async Task <RestTextChannel> CreatePersonalRoomAsync(SocketGuild guild, SocketGuildUser user)
        {
            SocketRole everyone = guild.Roles.Where(x => x.IsEveryone).First();

            // Creat personal room
            RestTextChannel personalRoom = await guild.CreateTextChannelAsync($"room-{user.Id}");

            // Make room only visible to new user and bots
            await personalRoom.AddPermissionOverwriteAsync(user, Permissions.roomPerm);

            await personalRoom.AddPermissionOverwriteAsync(everyone, Permissions.removeAllPerm);

            // Send intro information
            await personalRoom.SendMessageAsync($"<@{user.Id}>, welcome to your room! \n" +
                                                $"The server might be public but this is your own private sliver of the server.\n" +
                                                $"You can run commands, save images, post stuff, etc.\n" +
                                                $"type `!help` for a list of the commands!");

            return(personalRoom);
        }
Example #30
0
        private static async Task AddCategoryWithChannels(SocketGuild guild, IRole memberRole, string categoryName, int position)
        {
            RestCategoryChannel category = await guild.CreateCategoryChannelAsync(categoryName, properties => properties.Position = position);

            await category.AddPermissionOverwriteAsync(guild.EveryoneRole, OverwritePermissions.InheritAll);

            await category.AddPermissionOverwriteAsync(memberRole, OverwritePermissions.InheritAll);

            //Text chat
            RestTextChannel chat = await guild.CreateTextChannelAsync(categoryName.ToLower(), properties => properties.CategoryId = category.Id);

            await chat.SyncPermissionsAsync();

            //Auto VC chat
            RestVoiceChannel autoVcChat = await AutoVCChannelCreator.CreateAutoVCChannel(guild, categoryName);

            await autoVcChat.ModifyAsync(properties => properties.CategoryId = category.Id);

            await autoVcChat.SyncPermissionsAsync();
        }