示例#1
0
    async def tembed(self, ctx, *, teststr):
        """Parses `str` as if it were in an alias, for testing, then creates and prints an Embed.
        Arguments: -title [title]
        -desc [description text]
        -thumb [image url]
        -image [image url]
        -footer [footer text]
        -f ["Field Title|Field Text"]
        -color [hex color]
        -t [timeout (0..600)]
        """
        try:
            char = await Character.from_ctx(ctx)
            transformer = helpers.parse_with_character(ctx, char, teststr)
        except NoCharacter:
            transformer = helpers.parse_no_char(ctx, teststr)

        try:
            parsed = await transformer
        except EvaluationError as err:
            return await helpers.handle_alias_exception(ctx, err)

        embed_command = self.bot.get_command('embed')
        if embed_command is None:
            return await ctx.send("Error: pbpUtils cog not loaded.")
        else:
            return await ctx.invoke(embed_command, args=parsed)
示例#2
0
    async def test(self, ctx, *, teststr):
        """Parses `str` as if it were in an alias, for testing."""
        try:
            char = await Character.from_ctx(ctx)
            transformer = helpers.parse_with_character(ctx, char, teststr)
        except NoCharacter:
            transformer = helpers.parse_no_char(ctx, teststr)

        try:
            parsed = await transformer
        except EvaluationError as err:
            return await helpers.handle_alias_exception(ctx, err)
        await ctx.send(f"{ctx.author.display_name}: {parsed}")