{"id":14983474,"url":"https://github.com/haileybot/captcha-generator","last_synced_at":"2025-07-27T19:35:49.700Z","repository":{"id":37796105,"uuid":"244793487","full_name":"HaileyBot/captcha-generator","owner":"HaileyBot","description":"An NPM package to generate captcha images that can be used in Discord bots or various other projects","archived":false,"fork":false,"pushed_at":"2023-01-06T17:41:17.000Z","size":775,"stargazers_count":56,"open_issues_count":11,"forks_count":17,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-18T04:46:53.681Z","etag":null,"topics":["authentication","captcha","captcha-generator","captcha-images","discord","discord-bots","discord-js","haileybot","javascript","nodejs","npm","slack","slack-bot","verification"],"latest_commit_sha":null,"homepage":"https://haileybot.com/captcha-generator","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HaileyBot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-04T02:56:08.000Z","updated_at":"2025-05-21T09:19:51.000Z","dependencies_parsed_at":"2023-02-06T07:16:49.235Z","dependency_job_id":null,"html_url":"https://github.com/HaileyBot/captcha-generator","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/HaileyBot/captcha-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HaileyBot%2Fcaptcha-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HaileyBot%2Fcaptcha-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HaileyBot%2Fcaptcha-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HaileyBot%2Fcaptcha-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HaileyBot","download_url":"https://codeload.github.com/HaileyBot/captcha-generator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HaileyBot%2Fcaptcha-generator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262361664,"owners_count":23299085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","captcha","captcha-generator","captcha-images","discord","discord-bots","discord-js","haileybot","javascript","nodejs","npm","slack","slack-bot","verification"],"created_at":"2024-09-24T14:07:15.714Z","updated_at":"2025-06-28T01:37:15.124Z","avatar_url":"https://github.com/HaileyBot.png","language":"TypeScript","readme":"\u003ch1 align=\"center\"\u003eCaptcha Generator\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://www.npmjs.com/package/@haileybot/captcha-generator\" title=\"NPM version\"\u003e\u003cimg alt=\"NPM version\" src=\"https://img.shields.io/npm/v/@haileybot/captcha-generator?logo=npm\"/\u003e\u003c/a\u003e\n\t\u003ca href=\"https://www.npmjs.com/package/@haileybot/captcha-generator\" title=\"NPM downloads\"\u003e\u003cimg alt=\"NPM downloads\" src=\"https://img.shields.io/npm/dt/@haileybot/captcha-generator?logo=npm\"/\u003e\u003c/a\u003e\n\t\u003ca href=\"https://david-dm.org/HaileyBot/captcha-generator\" title=\"Dependencies\"\u003e\u003cimg alt=\"Dependencies\" src=\"https://img.shields.io/david/HaileyBot/captcha-generator?logo=npm\"/\u003e\u003c/a\u003e\n\t\u003cbr\u003e\n\t\u003ca href=\"https://github.com/HaileyBot/captcha-generator/blob/master/LICENSE\" title=\"License\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/github/license/HaileyBot/captcha-generator?logo=github\u0026logoColor=black\"/\u003e\u003c/a\u003e\n\t\u003ca href=\"https://app.fossa.com/projects/git%2Bgithub.com%2FHaileyBot%2Fcaptcha-generator?ref=badge_shield\" title=\"FOSSA Status\"\u003e\u003cimg alt=\"FOSSA Status\" src=\"https://app.fossa.com/api/projects/git%2Bgithub.com%2FHaileyBot%2Fcaptcha-generator.svg?type=shield\"/\u003e\u003c/a\u003e\n\t\u003ca href=\"https://codecov.io/gh/HaileyBot/captcha-generator\" title=\"Code Coverage\"\u003e\u003cimg alt=\"Code Coverage\" src=\"https://codecov.io/gh/HaileyBot/captcha-generator/branch/master/graph/badge.svg?token=OW7Q7Y1B2A\"/\u003e\u003c/a\u003e\n\t\u003cbr\u003e\n\t\u003ca href=\"https://github.com/sponsors/cheesits456\" title=\"GitHub Sponsors\"\u003e\u003cimg alt=\"GitHub Sponsors\" src=\"https://img.shields.io/github/sponsors/cheesits456?color=EA4AAA\u0026logo=github-sponsors\"/\u003e\u003c/a\u003e\n\t\u003ca href=\"https://donate.haileybot.com\" title=\"PayPal\"\u003e\u003cimg alt=\"PayPal\" src=\"https://img.shields.io/badge/donate-paypal-13e?logo=paypal\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nCaptcha Generator is a Node library for quickly and easily generating captcha images that can be used through an authorized bot to verify human users on a chat platform such as Slack or Discord.\n\n## Installation\n\nUse the package manager [npm](https://www.npmjs.com/) to install Captcha Generator\n\n```bash\nnpm i @haileybot/captcha-generator\n```\n\n## Usage\n\n### Basic\n\n```js\n// Import the module\nconst Captcha = require(\"@haileybot/captcha-generator\");\n\n// Create a new Captcha object\n//  - Optional argument to specify image height (250 to 400px, default 250)\n//    - Image width is 400px\n//  - Returned object will contain 4 properties\n//    - \"PNGStream\" is a stream object for the image file in PNG format\n//    - \"JPEGStream\" is a stream object for the image file in JPEG format\n//    - \"dataURL\" is a data URL containing the JPEG image data\n//    - \"value\" is the 6 character code the image contains\nlet captcha = new Captcha();\nconsole.log(captcha.value);\n```\n\n### Save to file example\n\n```js\nconst path = require(\"path\"),\n\tfs = require(\"fs\"),\n\tCaptcha = require(\"@haileybot/captcha-generator\");\n\nlet captcha = new Captcha();\ncaptcha.PNGStream.pipe(fs.createWriteStream(path.join(__dirname, `${captcha.value}.png`)));\ncaptcha.JPEGStream.pipe(fs.createWriteStream(path.join(__dirname, `${captcha.value}.jpeg`)));\n```\n\n### Discord Example\n\nThis example assumes you already have the core framework of a Discord Bot set up\n\n```js\nconst Captcha = require(\"@haileybot/captcha-generator\");\n\n// Use this function for blocking certain commands or features from automated self-bots\nfunction verifyHuman(msg) {\n\tlet captcha = new Captcha();\n\tmsg.channel.send(\n\t\t\"**Enter the text shown in the image below:**\",\n\t\tnew Discord.MessageAttachment(captcha.JPEGStream, \"captcha.jpeg\")\n\t);\n\tlet collector = msg.channel.createMessageCollector(m =\u003e m.author.id === msg.author.id);\n\tcollector.on(\"collect\", m =\u003e {\n\t\tif (m.content.toUpperCase() === captcha.value) msg.channel.send(\"Verified Successfully!\");\n\t\telse msg.channel.send(\"Failed Verification!\");\n\t\tcollector.stop();\n\t});\n}\n```\n\n## License\n\nThis project is licensed under [GPL-3.0](https://github.com/HaileyBot/captcha-generator/blob/master/LICENSE)\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FHaileyBot%2Fcaptcha-generator.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FHaileyBot%2Fcaptcha-generator?ref=badge_large)\n","funding_links":["https://github.com/sponsors/cheesits456"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaileybot%2Fcaptcha-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaileybot%2Fcaptcha-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaileybot%2Fcaptcha-generator/lists"}