DisCapTy


NameDisCapTy JSON
Version 1.0.3 PyPI version JSON
download
home_pagehttps://github.com/Predeactor/discapty
SummaryAn easy generator of Captcha for Discord bots, creating embeds and images.
upload_time2022-05-22 00:20:21
maintainer
docs_urlNone
authorPredeactor
requires_python>=3.8
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # DisCaPty

DisCaPty is a Python module to generate Captcha challenge more easily and with more flexibility. Principally made for Discord bot developers but available for everyone!

![PyPI](https://img.shields.io/pypi/v/discapty)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/discapty)
![PyPI - Downloads](https://img.shields.io/pypi/dm/discapty?color=blue)

# Installing

DisCaPty is available on PyPi!

```sh
python -m pip install -U discapty
```

You can also clone the module using git:

```sh
python -m pip install -U git+https://github.com/Predeactor/DisCapTy
```
It is still recommended to use PyPi.

# Creating Captcha

DisCapTy include 3 differents types of Captcha style.
- text: A Captcha that use plain text. This type is particular as it include a zero width space character between each letter/number to unallow the user to copy/paste the captcha.
- wheezy: An image Captcha, pretty basic and easy to read. Configurable
- image: An image Captcha, a bit more hard to read, less user friendly. Configurable.

You can choose which type to use when creating a Captcha object.

Example:
```py
import discapty

captcha = discapty.Captcha("wheezy")
# You are initializing a Captcha object that is the "wheezy" type.
# If you want to show the image/captcha, use generate_captcha()
captcha_image = captcha.generate_captcha() # <_io.BytesIO object at XxXXX>
```

However, using the "text" type will not return a BytesIO object but a string.
```py
import discapty

captcha = discapty.Captcha("text")
captcha_image = captcha.generate_captcha() # This will return a string, not a BytesIO object.
```

You can also easily create an embed.
```py
import discapty

async def send_captcha(ctx):
    captcha = discapty.Captcha("image")
    captcha_image = discord.File(captcha.generate_captcha(), filename="captcha.png") # This is # # important to put this filename, otherwise Discord will send the image outside of the embed.
    # You can change it when generating the embed. 
    captcha_embed = captcha.generate_embed(ctx.guild.name)
    await ctx.channel.send(embed=captcha_embed, file=captcha_image)
```

# Create more complex Captcha

The power of DisCapTy is how it let you customize your Captcha by using the setup function.
**When using this function, it is recommended to use number that are reasonable enough to not overload your machine. Image creation may take time if you abuse of it, and memory can also go high.**

```py
import discapty

def generate_captcha():
    captcha = discapty.Captcha("wheezy")

    # This function is what allow developers to set addition settings for their captcha, refer to the function's help for more parameters to use.
    captcha.setup(width=400, height=400, noise_color="#FF0000")

    return discapty.generate_embed() # Return the image with the settings that has been set.
```

# Contact

You can join my Discord server for any help: https://discord.gg/aPVupKAxxP

DisCapTy is licensied under MIT: ![PyPI - License](https://img.shields.io/pypi/l/discapty)
DisCapTy use the Roboto font as default font. This font is licensied under [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0).



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Predeactor/discapty",
    "name": "DisCapTy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Predeactor",
    "author_email": "predeactor0@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/90/45/a225cbe43cc86f87fc0f4ec0722f8d17ab86cd14a811cf6728621542b70d/DisCapTy-1.0.3.tar.gz",
    "platform": null,
    "description": "# DisCaPty\n\nDisCaPty is a Python module to generate Captcha challenge more easily and with more flexibility. Principally made for Discord bot developers but available for everyone!\n\n![PyPI](https://img.shields.io/pypi/v/discapty)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/discapty)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/discapty?color=blue)\n\n# Installing\n\nDisCaPty is available on PyPi!\n\n```sh\npython -m pip install -U discapty\n```\n\nYou can also clone the module using git:\n\n```sh\npython -m pip install -U git+https://github.com/Predeactor/DisCapTy\n```\nIt is still recommended to use PyPi.\n\n# Creating Captcha\n\nDisCapTy include 3 differents types of Captcha style.\n- text: A Captcha that use plain text. This type is particular as it include a zero width space character between each letter/number to unallow the user to copy/paste the captcha.\n- wheezy: An image Captcha, pretty basic and easy to read. Configurable\n- image: An image Captcha, a bit more hard to read, less user friendly. Configurable.\n\nYou can choose which type to use when creating a Captcha object.\n\nExample:\n```py\nimport discapty\n\ncaptcha = discapty.Captcha(\"wheezy\")\n# You are initializing a Captcha object that is the \"wheezy\" type.\n# If you want to show the image/captcha, use generate_captcha()\ncaptcha_image = captcha.generate_captcha() # <_io.BytesIO object at XxXXX>\n```\n\nHowever, using the \"text\" type will not return a BytesIO object but a string.\n```py\nimport discapty\n\ncaptcha = discapty.Captcha(\"text\")\ncaptcha_image = captcha.generate_captcha() # This will return a string, not a BytesIO object.\n```\n\nYou can also easily create an embed.\n```py\nimport discapty\n\nasync def send_captcha(ctx):\n    captcha = discapty.Captcha(\"image\")\n    captcha_image = discord.File(captcha.generate_captcha(), filename=\"captcha.png\") # This is # # important to put this filename, otherwise Discord will send the image outside of the embed.\n    # You can change it when generating the embed. \n    captcha_embed = captcha.generate_embed(ctx.guild.name)\n    await ctx.channel.send(embed=captcha_embed, file=captcha_image)\n```\n\n# Create more complex Captcha\n\nThe power of DisCapTy is how it let you customize your Captcha by using the setup function.\n**When using this function, it is recommended to use number that are reasonable enough to not overload your machine. Image creation may take time if you abuse of it, and memory can also go high.**\n\n```py\nimport discapty\n\ndef generate_captcha():\n    captcha = discapty.Captcha(\"wheezy\")\n\n    # This function is what allow developers to set addition settings for their captcha, refer to the function's help for more parameters to use.\n    captcha.setup(width=400, height=400, noise_color=\"#FF0000\")\n\n    return discapty.generate_embed() # Return the image with the settings that has been set.\n```\n\n# Contact\n\nYou can join my Discord server for any help: https://discord.gg/aPVupKAxxP\n\nDisCapTy is licensied under MIT: ![PyPI - License](https://img.shields.io/pypi/l/discapty)\nDisCapTy use the Roboto font as default font. This font is licensied under [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0).\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "An easy generator of Captcha for Discord bots, creating embeds and images.",
    "version": "1.0.3",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "c0341f1fe5d2eba584827beedcab4ea9",
                "sha256": "663f5f40733686c42900c37f4fded4e754c03248567f25c37b1578db13b27b11"
            },
            "downloads": -1,
            "filename": "DisCapTy-1.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c0341f1fe5d2eba584827beedcab4ea9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 101980,
            "upload_time": "2022-05-22T00:20:20",
            "upload_time_iso_8601": "2022-05-22T00:20:20.316336Z",
            "url": "https://files.pythonhosted.org/packages/7c/6b/329c902b6f42d42e02be80f5e75e326e01874d064f0f01eaf95f0686928b/DisCapTy-1.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "45d11539859326525fcf84b9082cdd11",
                "sha256": "006449c5022e8915adc6c0c53be80819cac75d08eb63930acb0a09fb4937d812"
            },
            "downloads": -1,
            "filename": "DisCapTy-1.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "45d11539859326525fcf84b9082cdd11",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 102452,
            "upload_time": "2022-05-22T00:20:21",
            "upload_time_iso_8601": "2022-05-22T00:20:21.706867Z",
            "url": "https://files.pythonhosted.org/packages/90/45/a225cbe43cc86f87fc0f4ec0722f8d17ab86cd14a811cf6728621542b70d/DisCapTy-1.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-05-22 00:20:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "Predeactor",
    "github_project": "discapty",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "discapty"
}
        
Elapsed time: 0.42738s