Exemplo n.º 1
0
    async def captcha_type_setter(self, ctx: commands.Context,
                                  captcha_type: str):
        """
        Change the type of Captcha challenge.

        You choose the following type of Captcha:
        - image: A normal captcha image, hardest to understand.
        - wheezy: A less complex captcha image, easier than image method.
        - plain: Plain text captcha. Easiest to read, cannot be copy/pasted.
        """

        available = ("wheezy", "image", "plain")
        captcha_type = captcha_type.lower()
        if captcha_type not in available:
            await ctx.send_help()
            await ctx.send(
                form.error(
                    form.bold(
                        "{type} is not a valid Captcha type option.".format(
                            type=form.bordered(captcha_type)))))
            return

        await self.data.guild(ctx.guild).type.set(captcha_type)
        await ctx.send(
            form.info(
                "Captcha type registered: {type}".format(type=captcha_type)))
Exemplo n.º 2
0
def test_bordered_ascii():
    expected = textwrap.dedent("""\
    ----------------    ---------------
    |one           |    |four         |
    |two           |    |five         |
    |three         |    |six          |
    ----------------    ---------------""")
    col1, col2 = ["one", "two", "three"], ["four", "five", "six"]
    assert chat_formatting.bordered(col1, col2, ascii_border=True) == expected
Exemplo n.º 3
0
def test_bordered_symmetrical():
    expected = textwrap.dedent("""\
    ┌──────────────┐    ┌─────────────┐
    │one           │    │four         │
    │two           │    │five         │
    │three         │    │six          │
    └──────────────┘    └─────────────┘""")
    col1, col2 = ["one", "two", "three"], ["four", "five", "six"]
    assert chat_formatting.bordered(col1, col2) == expected