示例#1
0
        private async Task Dispose(string msg = "")
        {
            lock (DisposeLock)
            {
                if (IsDisposed)
                {
                    return;
                }
                IsDisposed = true;
            }
            foreach (var player in Players)
            {
                _ = Task.Run(async() => {
                    await player.Dispose(msg).ConfigureAwait(false);
                });
            }
            lock (_drawLock)
            {
                DirectoryInfo dir = new DirectoryInfo(_tempPath);
                foreach (FileInfo file in dir.GetFiles())
                {
                    file.Delete();
                }
                Directory.Delete(_tempPath);
            }
            var timeMsg = _secondsToDelete <= 60 ? $"{_secondsToDelete} seconds" : $"{_secondsToDelete / 60} minutes";

            msg += $"Channel will be deleted in {timeMsg}.\n";
            await _ch.SendMessageAsync(msg).ConfigureAwait(false);

            await Task.Delay(_secondsToDelete * 1000).ConfigureAwait(false);

            await _ch.DeleteAsync().ConfigureAwait(false);
        }
示例#2
0
        public async Task DeleteAsync(CommandContext ctx,
                                      [Description("Channel to delete.")] DiscordChannel channel = null,
                                      [RemainingText, Description("Reason.")] string reason      = null)
        {
            channel = channel ?? ctx.Channel;

            if (channel.Type == ChannelType.Category && channel.Children.Any())
            {
                if (await ctx.WaitForBoolReplyAsync("The channel specified is a non-empty category and deleting it will delete child channels as well. Continue?"))
                {
                    foreach (DiscordChannel child in channel.Children.ToList())
                    {
                        await child.DeleteAsync(reason : ctx.BuildInvocationDetailsString(reason));
                    }
                }
            }
            else
            {
                if (!await ctx.WaitForBoolReplyAsync($"Are you sure you want to delete channel {Formatter.Bold(channel.Name)} (ID: {Formatter.InlineCode(channel.Id.ToString())})? This cannot be undone!"))
                {
                    return;
                }
            }

            string name = Formatter.Bold(channel.Name);
            await channel.DeleteAsync(reason : ctx.BuildInvocationDetailsString(reason));

            if (channel.Id != ctx.Channel.Id)
            {
                await this.InformAsync(ctx, $"Successfully deleted channel: {name}", important : false);
            }
        }
示例#3
0
        public async Task DeleteChannel(CommandContext ctx,
                                        [Description("Channel to delete.")][RemainingText]
                                        DiscordChannel channel = null)
        {
            // Set the current channel for deletion if one isn't provided by the user
            channel ??= ctx.Channel;

            var prompt = await ctx
                         .RespondAsync("You're about to delete the " + Formatter.Bold(channel.ToString()) +
                                       "\nRespond with **yes** if you want to proceed or wait 10 seconds to cancel the operation.")
                         .ConfigureAwait(false);

            var interactivity = await BotServices.GetUserInteractivity(ctx, "yes", 10).ConfigureAwait(false);

            if (interactivity.Result is null)
            {
                await ctx.RespondAsync(Resources.INFO_REQ_TIMEOUT).ConfigureAwait(false);

                return;
            }

            await BotServices.RemoveMessage(interactivity.Result).ConfigureAwait(false);

            await BotServices.RemoveMessage(prompt).ConfigureAwait(false);

            await ctx.RespondAsync("Successfully deleted " + Formatter.Bold(channel.Name)).ConfigureAwait(false);

            await channel.DeleteAsync().ConfigureAwait(false);
        }
示例#4
0
        public async Task CreatePrivateLobby(CommandContext ctx, string lobbyName, params DiscordMember[] allowedUsers)
        {
            try
            {
                await ctx.Channel.DeleteMessageAsync(ctx.Message);

                DiscordChannel parentCategory = await ctx.Client.GetChannelAsync(ParentCategoryId);

                DiscordChannel waitChannel = await ctx.Client.GetChannelAsync(WaitChannelId);

                if (!waitChannel.Users.Contains(ctx.User))
                {
                    throw new NBWaitRoomException();
                }

                DiscordRole createdRole = await ctx.Guild.CreateRoleAsync(lobbyName);

                DiscordChannel createdLobby = await ctx.Guild.CreateVoiceChannelAsync(
                    lobbyName == "_"?$"Lobby - {ctx.Member.DisplayName}" : lobbyName,
                    parent : parentCategory);

                await createdLobby.PlaceMemberAsync(ctx.Member);

                await createdLobby.AddOverwriteAsync(ctx.Guild.GetRole(DefaultRole), deny : Permissions.AccessChannels);

                await createdLobby.AddOverwriteAsync(createdRole, allow : Permissions.AccessChannels);

                await createdLobby.AddOverwriteAsync(ctx.Member, allow : Permissions.MuteMembers | Permissions.DeafenMembers);

                IReadOnlyCollection <DiscordMember> allMembers = await ctx.Guild.GetAllMembersAsync();

                await ctx.Member.GrantRoleAsync(createdRole);

                foreach (DiscordMember member in allowedUsers)
                {
                    await member.GrantRoleAsync(createdRole);
                }

                while (true)
                {
                    await Task.Delay(5000);

                    if (createdLobby.Users.Count() <= 0)
                    {
                        await createdLobby.DeleteAsync();

                        await createdRole.DeleteAsync();

                        return;
                    }
                }
            }
            catch (NBException ex)
            {
                await ex.SendException(ctx);
            }
        }
示例#5
0
        public async Task DeleteChannel(CommandContext x, DiscordChannel c, string reason)
        {
            if (string.IsNullOrEmpty(reason))
            {
                await x.RespondAsync("`You cannot leave the reason for deleting a channel to be blank!` baka... ''");

                return;
            }

            await c.DeleteAsync(reason);
        }
示例#6
0
            public async Task DeleteVoiceChannelAsync([VoiceChannel, Remainder] DiscordChannel channel)
            {
                if (!ChannelExtensions.CheckViewChannelPermission(Context.CurrentMember !, channel))
                {
                    await ReplyErrorAsync(Localization.AdministrationVoiceChannelNoViewPermission);

                    return;
                }

                await channel.DeleteAsync();

                await ReplyConfirmationAsync(Localization.AdministrationVoiceChannelDeleted, channel.Name);
            }
示例#7
0
        public async Task DeleteChannel(CommandContext context, DiscordChannel channel)
        {
            if (!config.ImportantMembers.ContainsValue(context.Member.Id))
            {
                await context.RespondAsync("Only cool people can execute this!.");

                return;
            }

            await channel.DeleteAsync();

            await context.RespondAsync("Channel has been deleted");
        }
示例#8
0
        public async Task PurgeChatAsync(CommandContext ctx)
        {
            DiscordChannel channel = ctx.Channel;
            var            z       = ctx.Channel.Position;
            var            x       = await channel.CloneAsync();

            await channel.DeleteAsync();

            await x.ModifyPositionAsync(z);

            var embed2 = new DiscordEmbedBuilder()
                         .WithTitle("✅ Purged")
                         .WithFooter($"foo");
            await x.SendMessageAsync(embed : embed2);
        }
        public async Task PurgeChatAsync(CommandContext ctx)
        {
            Serilog.Log.Debug("PC");
            DiscordChannel channel = ctx.Channel;
            var            z       = ctx.Channel.Position;
            var            x       = await channel.CloneAsync();

            await channel.DeleteAsync();

            await x.ModifyPositionAsync(z);

            var embed2 = new DiscordEmbedBuilder()
                         .WithTitle("✅ Purged")
                         .WithFooter($"(C) 𝖆𝖇𝖓𝖔𝖗𝖒𝖆𝖑#0666, foo");
            await x.SendMessageAsync(embed : embed2);
        }
示例#10
0
            internal async Task Dispose(string msg = "")
            {
                if (IsDisposed)
                {
                    return;
                }
                var timeMsg = _secondsToDelete <= 60 ? $"{_secondsToDelete} seconds" : $"{_secondsToDelete / 60} minutes";

                msg += $"Channel will be deleted in {timeMsg}. \n";
                await _pCh.SendMessageAsync(msg).ConfigureAwait(false);

                await Task.Delay(_secondsToDelete * 1000).ConfigureAwait(false);

                await _pCh.DeleteAsync().ConfigureAwait(false);

                IsDisposed = true;
            }
示例#11
0
        public async Task Destroy(CommandContext e, [Description("Quote the ID at the beginning of the channel name.")] int rpID)
        {
            InstanceObject.RootObject instance = RPClass.InstanceList.FirstOrDefault(x => x.Id == rpID);
            if (instance != null)
            {
                DiscordChannel c = e.Guild.GetChannel(instance.ChannelID);
                await c.DeleteAsync();

                RPClass.InstanceList.Remove(instance);
                RPClass.SaveData(7);
                await e.RespondAsync("Instance destroyed.");
            }
            else
            {
                await e.RespondAsync("Use the ID at the beginning of the channel name.");
            }
        }
示例#12
0
        private async Task Dispose(string msg = "")
        {
            DirectoryInfo dir = new DirectoryInfo(_tempPath);

            foreach (FileInfo file in dir.GetFiles())
            {
                file.Delete();
            }
            Directory.Delete(_tempPath);
            var timeMsg = _secondsToDelete <= 60 ? $"{_secondsToDelete} seconds" : $"{_secondsToDelete / 60} minutes";

            msg += $"Channel will be deleted in {timeMsg}.\n";
            await _ch.SendMessageAsync(msg).ConfigureAwait(false);

            await Task.Delay(_secondsToDelete * 1000).ConfigureAwait(false);

            await _ch.DeleteAsync().ConfigureAwait(false);
        }
示例#13
0
        public async Task RemoveVoiceChannel(CommandContext ctx, [RemainingText] DiscordChannel channel)
        {
            if (channel == null)
            {
                await BotServices.SendErrorEmbedAsync(ctx, ":mag: Channel not found in this server!");
            }
            else if (channel.Type != ChannelType.Voice)
            {
                await BotServices.SendErrorEmbedAsync(ctx, ":warning: This is not a voice channel, use **.deletetext** instead!");
            }
            else
            {
                await ctx.TriggerTypingAsync();

                await channel.DeleteAsync();

                await ctx.RespondAsync($"Voice Channel **{channel.Name}** has been **removed**");
            }
        }
示例#14
0
        public async Task CreateLobby(CommandContext ctx, string lobbyName, int userLimit = 20)
        {
            try
            {
                await ctx.Channel.DeleteMessageAsync(ctx.Message);

                DiscordChannel parentCategory = await ctx.Client.GetChannelAsync(ParentCategoryId);

                DiscordChannel waitChannel = await ctx.Client.GetChannelAsync(WaitChannelId);

                if (!waitChannel.Users.Contains(ctx.User))
                {
                    throw new NBWaitRoomException();
                }

                DiscordChannel createdLobby = await ctx.Guild.CreateChannelAsync(
                    lobbyName == "_"?$"Lobby - {ctx.Member.DisplayName}" : lobbyName,
                    ChannelType.Voice,
                    parent : parentCategory,
                    userLimit : userLimit);

                await createdLobby.PlaceMemberAsync(ctx.Member);

                await createdLobby.AddOverwriteAsync(ctx.Member, allow : Permissions.MuteMembers | Permissions.DeafenMembers);

                while (true)
                {
                    await Task.Delay(5000);

                    if (createdLobby.Users.Count() <= 0)
                    {
                        await createdLobby.DeleteAsync();

                        return;
                    }
                }
            }
            catch (NBException ex)
            {
                await ex.SendException(ctx);
            }
        }
示例#15
0
        public async Task DeleveVC(CommandContext ctx)
        {
            if (ValidateServerRegistered(ctx))
            {
                if (!(registeredGuildData[ctx.Guild]?[ctx.Member] is null) || registeredGuildData[ctx.Guild][ctx.Member].Count == 0)
                {
                    await RespondAsync(ctx.Message, "``You need to create a VC to delete one``");

                    return;
                }

                try
                {
                    DiscordChannel toDelete = registeredGuildData[ctx.Guild][ctx.Member].Count == 1 ? registeredGuildData[ctx.Guild][ctx.Member][0] : ctx.Member.VoiceState?.Channel;
                    if (toDelete is null)
                    {
                        await RespondAsync(ctx.Message, $"``Because you have multiple created channels, you must be in the VC you wish to delete``");

                        return;
                    }

                    if (!registeredGuildData[ctx.Guild][ctx.Member].Contains(toDelete))
                    {
                        await RespondAsync(ctx.Message, $"``You are in a VC you do not own and, therefore, cannot delete it``");

                        return;
                    }

                    await toDelete.DeleteAsync($"{ctx.Member.DisplayName}#{ctx.Member.Discriminator}:{ctx.Member.Id} requested to delete their created channel: {toDelete.Name}:{toDelete.Id}");

                    registeredGuildData[ctx.Guild].RemoveChannel(ctx.Member, toDelete);
                    await RespondAsync(ctx.Message, $"``Deleted channel {toDelete.Name}``");
                }
                catch (Exception e)
                {
                    await RespondAsync(ctx.Message, $"``{e}``");
                }
            }
        }
示例#16
0
        public async Task DeleteUnusedVoiceChannelAsync(DiscordChannel channel)
        {
            if (channel.Id == _voiceConfig.ClickChannelId)
            {
                return;
            }

            if (!channel.Parent.Equals(channel.Guild.GetChannel(_voiceConfig.ClickChannelId).Parent))
            {
                return;
            }

            if (!channel.Users.Any())
            {
                try
                {
                    await channel.DeleteAsync();
                }
                catch
                {
                    // ignored
                }
            }
        }
示例#17
0
        /// <summary>
        /// Deletes a channel.
        /// </summary>
        /// <param name="guild"></param>
        /// <param name="channel">Channel object.</param>
        /// <param name="reason">Reason for audit logs.</param>
        /// <exception cref="NullReferenceException"></exception>
        public static async Task DeleteChannelAsync(this DiscordGuild guild, DiscordChannel channel, string reason = null)
        {
            guild.IsNotNull();

            await channel.DeleteAsync(reason);
        }
示例#18
0
 public async Task DeleteChannel(DiscordChannel channel)
 {
     await channel.DeleteAsync();
 }
示例#19
0
        public async Task Destroy(CommandContext ctx, DiscordChannel dChannel, [RemainingText] string reason = null)
        {
            await dChannel.DeleteAsync(reason);

            await ctx.Channel.SendMessageAsync($"{dChannel.Name} just got obliterated!");
        }
示例#20
0
        private async Task CreatePinnedLobbyMessage(Lobby lobby, DiscordChannel lobbyChannel, DiscordUser user, bool isOtw)
        {
            _logger.Trace($"RaidLobbyManager::CreatePinnedLobbyMessage [Lobby={lobby.ChannelName}, DiscordChannel={lobbyChannel.Name}, DiscordUser={user}, IsOtw={isOtw}]");

            var pkmnImage = lobby.Gym.IsEgg
                ? string.Format(Strings.EggImage, lobby.Gym.RaidLevel)
                : lobby.Gym.RaidPokemonId.GetPokemonImage(lobby.Gym.RaidPokemonForm.ToString());
            var eb = new DiscordEmbedBuilder
            {
                Title        = $"{lobby.City}: {lobby.Gym.Name}",
                Color        = lobby.Gym.RaidLevel.BuildRaidColor(),
                Url          = string.Format(Strings.GoogleMaps, lobby.Gym.Latitude, lobby.Gym.Longitude),
                ImageUrl     = string.Format(Strings.GoogleMapsStaticImage, lobby.Gym.Latitude, lobby.Gym.Longitude) + $"&key={_config.GmapsKey}",
                ThumbnailUrl = pkmnImage,
                Footer       = new DiscordEmbedBuilder.EmbedFooter
                {
                    Text    = $"versx | {DateTime.Now}",
                    IconUrl = _client.Guilds.ContainsKey(_config.GuildId) ? _client.Guilds[_config.GuildId].IconUrl : string.Empty
                }
            };

            var item = lobby.Gym.IsEgg ? $"Level {lobby.Gym.RaidLevel} Egg" : Database.Pokemon[lobby.Gym.RaidPokemonId].Name;

            eb.AddField("Raid Boss", item, true);
            if (lobby.Gym.ExRaidEligible)
            {
                eb.AddField("EX-Eligible Raid", "Yes", true);
            }

            eb.AddField("Level", lobby.Gym.RaidLevel.ToString(), true);
            if (lobby.Gym.IsEgg)
            {
                eb.AddField("Starts", lobby.Gym.RaidBattleTimestamp.FromUnix().ToLongTimeString(), true);
            }
            else
            {
                eb.AddField("CP", lobby.Gym.RaidPokemonCP.ToString("N0"), true);
                eb.AddField("Ends", lobby.Gym.RaidEndTimestamp.FromUnix().ToLongTimeString(), true);
                if (Database.Movesets.ContainsKey(lobby.Gym.RaidPokemonMove1))
                {
                    var fastMove       = Database.Movesets[lobby.Gym.RaidPokemonMove1];
                    var fastMoveTypeId = _client.Guilds[_config.GuildId].GetEmojiId($"types_{fastMove.Type}");
                    if (fastMoveTypeId > 0)
                    {
                        eb.AddField("Fast Move", string.Format(Strings.TypeEmojiSchema, fastMove.Type.ToLower(), fastMoveTypeId) + $" {fastMove.Name}", true);
                    }
                }
                if (Database.Movesets.ContainsKey(lobby.Gym.RaidPokemonMove2))
                {
                    var chargeMove       = Database.Movesets[lobby.Gym.RaidPokemonMove2];
                    var chargeMoveTypeId = _client.Guilds[_config.GuildId].GetEmojiId($"types_{chargeMove.Type}");
                    if (chargeMoveTypeId > 0)
                    {
                        eb.AddField("Charge Move", string.Format(Strings.TypeEmojiSchema, chargeMove.Type.ToLower(), chargeMoveTypeId) + $" {chargeMove.Name}", true);
                    }
                }

                var weaknessesEmojis = Database.Pokemon[lobby.Gym.RaidPokemonId].Types.GetWeaknessEmojiIcons(_client, _config.GuildId);
                if (!string.IsNullOrEmpty(weaknessesEmojis))
                {
                    eb.AddField("Weaknesses", weaknessesEmojis + "\r\n", true);
                }
            }

            if (_client.Guilds.ContainsKey(_config.GuildId))
            {
                if (lobby.Gym.ExRaidEligible)
                {
                    var exEmojiId = _client.Guilds.ContainsKey(_config.GuildId) ? _client.Guilds[_config.GuildId].GetEmojiId("ex") : 0;
                    var exEmoji   = exEmojiId > 0 ? $"<:ex:{exEmojiId}>" : "EX";
                    eb.AddField("Ex-Eligible", exEmoji + " **Gym!**");
                }

                var teamId = _client.Guilds[_config.GuildId].GetEmojiId(lobby.Gym.Team.ToString().ToLower());
                eb.AddField("Team", $"<:{lobby.Gym.Team.ToString().ToLower()}:{teamId}>", true);
            }

            if (!string.IsNullOrEmpty(lobby.StartedBy))
            {
                eb.AddField("Started By", lobby.StartedBy, true);
            }
            eb.AddField("Location", $"{Math.Round(lobby.Gym.Latitude, 5)},{Math.Round(lobby.Gym.Longitude, 5)}\r\n" +
                        $"**[[Google Maps]({string.Format(Strings.GoogleMaps, lobby.Gym.Latitude, lobby.Gym.Longitude)})]**\r\n" +
                        $"**[[Apple Maps]({string.Format(Strings.AppleMaps, lobby.Gym.Latitude, lobby.Gym.Longitude)})]**", true);

            if (!_config.RaidLobbies.ContainsKey(lobby.ChannelName))
            {
                _logger.Warn($"Raid lobby does not exist yet for '{lobby.ChannelName}'.");
                return;
            }

            var raidLobby = _config.RaidLobbies[lobby.ChannelName];

            AddOrUpdateUser(raidLobby, user, isOtw);

            if (raidLobby.Users?.Count == 0)
            {
                //Delete the channel if no one is interested anymore.
                await lobbyChannel.DeleteAsync();

                return;
            }

            var usersOtw = string.Join(Environment.NewLine, raidLobby.Users?.Where(x => x.IsOnTheWay).Select(x => x.Username));

            eb.AddField("Trainers On the Way:", string.IsNullOrEmpty(usersOtw) ? "Unknown" : usersOtw, true);

            var usersHere = string.Join(Environment.NewLine, raidLobby.Users?.Where(x => x.IsHere).Select(x => x.Username));

            eb.AddField("Trainers At the Raid:", string.IsNullOrEmpty(usersHere) ? "Unknown" : usersHere, true);

            eb.Footer = new DiscordEmbedBuilder.EmbedFooter
            {
                Text    = $"➡ On your way ✅ Here ❌ No longer interested 🔄 Refresh lobby message.",
                IconUrl = lobbyChannel.Guild?.IconUrl
            };

            var lobbyMessage = default(DiscordMessage);
            var pinned       = await lobbyChannel.GetPinnedMessagesAsync();

            if (pinned?.Count > 0)
            {
                lobbyMessage = await pinned[0].ModifyAsync(string.Empty, eb);
            }
            else
            {
                lobbyMessage = await lobbyChannel.SendMessageAsync($"{user.Username}#{user.Discriminator} started a raid lobby for {item} at {lobby.Gym.Name}", false, eb);

                await lobbyMessage.PinAsync();
            }
            await _client.SetDefaultRaidReactions(lobbyMessage, true);
        }
示例#21
0
        public async Task TeamVersusTeam(CommandContext ctx,
                                         int size1, string team1,
                                         int size2, string team2,
                                         TimeSpan duration)
        {
            try
            {
                await ctx.Channel.DeleteMessageAsync(ctx.Message);

                var interactivity         = ctx.Client.GetInteractivity();
                DiscordEmbedBuilder embed = new DiscordEmbedBuilder
                {
                    Title = $"{team1} vs {team2}",
                    Color = DiscordColor.Cyan
                };

                DiscordMessage embedMessage = await ctx.Channel.SendMessageAsync(embed : embed);

                DiscordEmoji team1Emoji = DiscordEmoji.FromName(ctx.Client, EmojiTeam2String);
                DiscordEmoji team2Emoji = DiscordEmoji.FromName(ctx.Client, EmojiTeam2String);

                await embedMessage.CreateReactionAsync(team1Emoji);

                await embedMessage.CreateReactionAsync(team2Emoji);

                var reactions = await interactivity.CollectReactionsAsync(embedMessage, duration);

                List <DiscordUser> team1Users = new List <DiscordUser>();
                List <DiscordUser> team2Users = new List <DiscordUser>();
                SplitTeams(ctx, team1Emoji, reactions, team1Users, team2Users);

                Console.WriteLine("Finish placing users");

                foreach (DiscordUser user in team1Users)
                {
                    Console.WriteLine($"{user.IsBot} {user.Username}");
                }

                foreach (DiscordUser user in team2Users)
                {
                    Console.WriteLine($"{user.IsBot} {user.Username}");
                }

                team1Users.ForEach(user => team2Users.Remove(user));
                team2Users.ForEach(user => team1Users.Remove(user));

                DiscordRole team1Role = await ctx.Guild.CreateRoleAsync($"Team {team1}");

                DiscordRole team2Role = await ctx.Guild.CreateRoleAsync($"Team {team2}");

                team1Users
                .Take(size1)
                .ToList()
                .ForEach(async user => await(await ctx.Guild.GetMemberAsync(user.Id)).GrantRoleAsync(team1Role));

                team2Users
                .Take(size2)
                .ToList()
                .ForEach(async user => await(await ctx.Guild.GetMemberAsync(user.Id)).GrantRoleAsync(team2Role));

                DiscordChannel parentCategory = await ctx.Guild.CreateChannelCategoryAsync($"{team1} vs {team2}");

                await parentCategory.AddOverwriteAsync(ctx.Guild.GetRole(DefaultRole), deny : Permissions.AccessChannels);

                await parentCategory.AddOverwriteAsync(team1Role, allow : Permissions.AccessChannels);

                await parentCategory.AddOverwriteAsync(team2Role, allow : Permissions.AccessChannels);

                DiscordChannel commonChannel = await ctx.Guild.CreateVoiceChannelAsync(
                    "Common",
                    parent : parentCategory,
                    user_limit : size1 + size2
                    );

                DiscordChannel team1Lobby = await ctx.Guild.CreateVoiceChannelAsync(
                    team1,
                    parent : parentCategory,
                    user_limit : size1);

                DiscordChannel team2Lobby = await ctx.Guild.CreateVoiceChannelAsync(
                    team2,
                    parent : parentCategory,
                    user_limit : size2);

                await team1Lobby.AddOverwriteAsync(team2Role, deny : Permissions.AccessChannels);

                await team2Lobby.AddOverwriteAsync(team1Role, deny : Permissions.AccessChannels);

                await team1Lobby.AddOverwriteAsync(team1Role, allow : Permissions.AccessChannels);

                await team2Lobby.AddOverwriteAsync(team2Role, allow : Permissions.AccessChannels);


                DiscordChannel textChannel = await ctx.Guild.CreateTextChannelAsync(
                    "Common Chat",
                    parent : parentCategory
                    );

                DiscordChannel team1Chat = await ctx.Guild.CreateTextChannelAsync(
                    $"{team1} Chat",
                    parent : parentCategory
                    );

                DiscordChannel team2Chat = await ctx.Guild.CreateTextChannelAsync(
                    $"{team2} Chat",
                    parent : parentCategory
                    );

                await team1Chat.AddOverwriteAsync(team2Role, deny : Permissions.AccessChannels);

                await team2Chat.AddOverwriteAsync(team1Role, deny : Permissions.AccessChannels);

                await team1Chat.AddOverwriteAsync(team1Role, allow : Permissions.AccessChannels);

                await team2Chat.AddOverwriteAsync(team2Role, allow : Permissions.AccessChannels);

                while (true)
                {
                    await Task.Delay(10000);

                    if (team1Lobby.Users.Count() <= 0 && team2Lobby.Users.Count() <= 0 && commonChannel.Users.Count() <= 0)
                    {
                        await commonChannel.DeleteAsync();

                        await team1Lobby.DeleteAsync();

                        await team2Lobby.DeleteAsync();

                        await textChannel.DeleteAsync();

                        await team1Chat.DeleteAsync();

                        await team2Chat.DeleteAsync();

                        await team1Role.DeleteAsync();

                        await team2Role.DeleteAsync();

                        await parentCategory.DeleteAsync();

                        return;
                    }
                }
            }
            catch (NBException ex)
            {
                await ex.SendException(ctx);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }