예제 #1
0
    async def convert(self, ctx: commands.Context, arg: str) -> Installable:
        downloader = ctx.bot.get_cog("Downloader")
        if downloader is None:
            raise commands.CommandError("Downloader not loaded.")

        cog = discord.utils.get(await downloader.installed_cogs(), name=arg)
        if cog is None:
            raise commands.BadArgument("That cog is not installed")

        return cog
예제 #2
0
파일: converters.py 프로젝트: Cheoz/dondog
    async def convert(cls, ctx: commands.Context, arg: str) -> InstalledModule:
        downloader = ctx.bot.get_cog("Downloader")
        if downloader is None:
            raise commands.CommandError(_("No Downloader cog found."))

        cog = discord.utils.get(await downloader.installed_cogs(), name=arg)
        if cog is None:
            raise commands.BadArgument(_("That cog is not installed"))

        return cog
예제 #3
0
 async def ensure_voice(self, ctx):
     if ctx.voice_client is None:
         if ctx.author.voice:
             vc = await ctx.author.voice.channel.connect()
             await self.config.guild(ctx.guild).cid.set(vc.channel.id)
         else:
             await ctx.send("You are not connected to a voice channel.")
             raise commands.CommandError(
                 "Author not connected to a voice channel.")
     elif ctx.voice_client.is_playing():
         ctx.voice_client.stop()
예제 #4
0
    async def convert(cls, ctx: commands.Context, argument: str):
        downloader_cog = ctx.bot.get_cog("Downloader")
        if downloader_cog is None:
            raise commands.CommandError("No Downloader cog found.")

        # noinspection PyProtectedMember
        repo_manager = downloader_cog._repo_manager
        poss_repo = repo_manager.get_repo(argument)
        if poss_repo is None:
            raise commands.BadArgument("Repo by the name {} does not exist.".format(argument))
        return poss_repo