# Path: channelredirect/converters.py
# class CogOrCOmmand(NamedTuple):
#     stype: str
#     obj: str
# 
#     @classmethod
#     async def convert(cls, ctx: commands.Context, arg: str):
#         # mypy doesn't do type narrowing for the walrus yet
#         if com := ctx.bot.get_command(arg):
#             assert com, "mypy"  # nosec
#             return cls("command", com.qualified_name)
#         if cog := ctx.bot.get_cog(arg):
#             assert cog, "mypy"  # nosec
#             return cls("cog", cog.__class__.__name__)
#         raise commands.BadArgument('Cog or Command "{arg}" not found.'.format(arg=arg))
# 
# class CommandConverter(NamedTuple):
#     com: commands.Command
# 
#     @classmethod
#     async def convert(cls, ctx: commands.Context, arg: str):
#         ret = ctx.bot.get_command(arg)
#         if ret:
#             return cls(ret)
#         raise commands.BadArgument('Command "{arg}" not found.'.format(arg=arg))
# 
# class TrinaryBool(NamedTuple):
#     state: Union[bool, None]
# 
#     @classmethod
#     async def convert(cls, ctx: commands.Context, arg: str):
#         try:
#             ret = {"allow": True, "deny": False, "clear": None}[arg.lower()]
#         except KeyError:
#             raise commands.BadArgument(
#                 "Was expecting one of `allow`, `deny`, or `clear`, got {arg}".format(
#                     arg=arg
#                 )
#             )
#         else:
#             return cls(ret)


import asyncio
import contextlib
import discord
from typing import Set
from redbot.core import checks, commands
from redbot.core.config import Config
from .converters import CogOrCOmmand, CommandConverter, TrinaryBool
        """

        if not channels:
            return await ctx.send_help()

        gsets = await self.config.guild(ctx.guild).all()
        mode = gsets["mode"]
        if not mode:
            return await ctx.send(
                "You need to set a mode using `{ctx.prefix}redirectset mode` first".format(
                    ctx=ctx
                )
            )

        for channel in channels:
            while channel.id in gsets[mode]:
                gsets[mode].remove(channel.id)

        await self.config.guild(ctx.guild).set_raw(mode, value=gsets[mode])
        await ctx.tick()

    @rset.group(name="exceptions")
    async def rset_except(self, ctx):
        """
        Commands for configuring exceptions.
        """
        pass

    @rset_except.command(name="allowcommandeverywhere")
    async def rset_whitelistcom_add(

# Path: channelredirect/converters.py
# class CogOrCOmmand(NamedTuple):
#     stype: str
#     obj: str
# 
#     @classmethod
#     async def convert(cls, ctx: commands.Context, arg: str):
#         # mypy doesn't do type narrowing for the walrus yet
#         if com := ctx.bot.get_command(arg):
#             assert com, "mypy"  # nosec
#             return cls("command", com.qualified_name)
#         if cog := ctx.bot.get_cog(arg):
#             assert cog, "mypy"  # nosec
#             return cls("cog", cog.__class__.__name__)
#         raise commands.BadArgument('Cog or Command "{arg}" not found.'.format(arg=arg))
# 
# class CommandConverter(NamedTuple):
#     com: commands.Command
# 
#     @classmethod
#     async def convert(cls, ctx: commands.Context, arg: str):
#         ret = ctx.bot.get_command(arg)
#         if ret:
#             return cls(ret)
#         raise commands.BadArgument('Command "{arg}" not found.'.format(arg=arg))
# 
# class TrinaryBool(NamedTuple):
#     state: Union[bool, None]
# 
#     @classmethod
#     async def convert(cls, ctx: commands.Context, arg: str):
#         try:
#             ret = {"allow": True, "deny": False, "clear": None}[arg.lower()]
#         except KeyError:
#             raise commands.BadArgument(
#                 "Was expecting one of `allow`, `deny`, or `clear`, got {arg}".format(
#                     arg=arg
#                 )
#             )
#         else:
#             return cls(ret)


# Path: channelredirect/redirect.py
import asyncio
import contextlib
import discord
from typing import Set
from redbot.core import checks, commands
from redbot.core.config import Config
from .converters import CogOrCOmmand, CommandConverter, TrinaryBool

        """

        if not channels:
            return await ctx.send_help()

        gsets = await self.config.guild(ctx.guild).all()
        mode = gsets["mode"]
        if not mode:
            return await ctx.send(
                "You need to set a mode using `{ctx.prefix}redirectset mode` first".format(
                    ctx=ctx
                )
            )

        for channel in channels:
            while channel.id in gsets[mode]:
                gsets[mode].remove(channel.id)

        await self.config.guild(ctx.guild).set_raw(mode, value=gsets[mode])
        await ctx.tick()

    @rset.group(name="exceptions")
    async def rset_except(self, ctx):
        """
        Commands for configuring exceptions.
        """
        pass

    @rset_except.command(name="allowcommandeverywhere")
    async def rset_whitelistcom_add(

        self, ctx: commands.Context, *, cog_or_command: CogOrCOmmand