# Path: roomtools/abcs.py
# class MixedMeta(abc.ABC):
#     """
#     mypy is nice, but I need this for it to shut up about composite classes.
#     """
# 
#     def __init__(self, *args):
#         self.bot: Red
#         self._antispam: dict
#         self.antispam_intervals: list
#         self.tmpc_config: Config
#         self.ar_config: Config
#         self.qualified_name: str
# 
# Path: roomtools/checks.py
# def aa_active():
#     async def check(ctx: commands.Context):
#         if not ctx.guild:
#             return False
#         cog = ctx.bot.get_cog("RoomTools")
#         if TYPE_CHECKING:
#             assert isinstance(cog, RoomTools)  # nosec
#         if not cog:
#             return False
#         return await cog.ar_config.guild(ctx.guild).active()
# 
#     return commands.check(check)


import asyncio
import discord
from datetime import datetime, timedelta
from typing import Generator, cast
from redbot.core import checks, commands
from redbot.core.utils.antispam import AntiSpam
from redbot.core.utils.chat_formatting import pagify
from .abcs import MixedMeta
from .checks import aa_active
    from redbot.core.commands import GuildContext
    from redbot.core.commands import Context as GuildContext  # type: ignore
        try:
            chan = await source.guild.create_voice_channel(
                cname, category=category, overwrites=overwrites
            )
        except discord.Forbidden:
            await self.ar_config.guild(source.guild).active.set(False)
            return
        except discord.HTTPException:
            pass
        else:
            await self.ar_config.channel(chan).clone.set(True)
            if who.id not in self._antispam:
                self._antispam[who.id] = AntiSpam(self.antispam_intervals)
            self._antispam[who.id].stamp()
            await who.move_to(chan, reason="autoroom")
            await asyncio.sleep(0.5)
            await chan.edit(bitrate=source.bitrate, user_limit=source.user_limit)
            # TODO:
            # discord.HTTP to avoid needing the edit
            # This extra API call is avoidable when working with the lower level tools.

    @commands.bot_has_permissions(manage_channels=True)
    @checks.admin_or_permissions(manage_channels=True)
    @commands.group(autohelp=True)
    async def autoroomset(self, ctx: GuildContext):
        """
        Commands for configuring autorooms
        """
        pass


# Path: roomtools/abcs.py
# class MixedMeta(abc.ABC):
#     """
#     mypy is nice, but I need this for it to shut up about composite classes.
#     """
# 
#     def __init__(self, *args):
#         self.bot: Red
#         self._antispam: dict
#         self.antispam_intervals: list
#         self.tmpc_config: Config
#         self.ar_config: Config
#         self.qualified_name: str
# 
# Path: roomtools/checks.py
# def aa_active():
#     async def check(ctx: commands.Context):
#         if not ctx.guild:
#             return False
#         cog = ctx.bot.get_cog("RoomTools")
#         if TYPE_CHECKING:
#             assert isinstance(cog, RoomTools)  # nosec
#         if not cog:
#             return False
#         return await cog.ar_config.guild(ctx.guild).active()
# 
#     return commands.check(check)


# Path: roomtools/autorooms.py
import asyncio
import discord
from datetime import datetime, timedelta
from typing import Generator, cast
from redbot.core import checks, commands
from redbot.core.utils.antispam import AntiSpam
from redbot.core.utils.chat_formatting import pagify
from .abcs import MixedMeta
from .checks import aa_active
    from redbot.core.commands import GuildContext
    from redbot.core.commands import Context as GuildContext  # type: ignore

        try:
            chan = await source.guild.create_voice_channel(
                cname, category=category, overwrites=overwrites
            )
        except discord.Forbidden:
            await self.ar_config.guild(source.guild).active.set(False)
            return
        except discord.HTTPException:
            pass
        else:
            await self.ar_config.channel(chan).clone.set(True)
            if who.id not in self._antispam:
                self._antispam[who.id] = AntiSpam(self.antispam_intervals)
            self._antispam[who.id].stamp()
            await who.move_to(chan, reason="autoroom")
            await asyncio.sleep(0.5)
            await chan.edit(bitrate=source.bitrate, user_limit=source.user_limit)
            # TODO:
            # discord.HTTP to avoid needing the edit
            # This extra API call is avoidable when working with the lower level tools.

    @commands.bot_has_permissions(manage_channels=True)
    @checks.admin_or_permissions(manage_channels=True)
    @commands.group(autohelp=True)
    async def autoroomset(self, ctx: GuildContext):
        """
        Commands for configuring autorooms
        """
        pass


    @aa_active()