{"id":22543281,"url":"https://github.com/sefinek/is-discord-invite","last_synced_at":"2025-08-04T06:32:38.998Z","repository":{"id":57677769,"uuid":"489538805","full_name":"sefinek/is-discord-invite","owner":"sefinek","description":"Verifies the presence of a Discord server invitation within a given string or message, offering robust validation and control mechanisms to ensure the authenticity and validity of the invitation link.","archived":false,"fork":false,"pushed_at":"2024-11-19T08:53:30.000Z","size":553,"stargazers_count":4,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-27T09:41:37.317Z","etag":null,"topics":["check","discord","discord-bot","guild","invitation","invitations","invite","is","is-discord-invite","javascript","nodejs","server"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/is-discord-invite","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sefinek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"sefinek24","patreon":"sefinek","ko_fi":"sefinek","custom":["https://www.paypal.me/sefinek24"]}},"created_at":"2022-05-07T01:39:56.000Z","updated_at":"2024-11-19T08:53:33.000Z","dependencies_parsed_at":"2023-10-10T16:53:36.553Z","dependency_job_id":"aacb4513-2131-4294-ad8a-0ae321c66149","html_url":"https://github.com/sefinek/is-discord-invite","commit_stats":{"total_commits":68,"total_committers":3,"mean_commits":"22.666666666666668","dds":0.1470588235294118,"last_synced_commit":"a267089905fdcae8022c3ad24b2e33e2b63779fb"},"previous_names":["sefinek/is-discord-invite"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sefinek%2Fis-discord-invite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sefinek%2Fis-discord-invite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sefinek%2Fis-discord-invite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sefinek%2Fis-discord-invite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sefinek","download_url":"https://codeload.github.com/sefinek/is-discord-invite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228215139,"owners_count":17886347,"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":["check","discord","discord-bot","guild","invitation","invitations","invite","is","is-discord-invite","javascript","nodejs","server"],"created_at":"2024-12-07T13:15:37.264Z","updated_at":"2025-08-04T06:32:38.952Z","avatar_url":"https://github.com/sefinek.png","language":"JavaScript","funding_links":["https://github.com/sponsors/sefinek24","https://patreon.com/sefinek","https://ko-fi.com/sefinek","https://www.paypal.me/sefinek24"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003ch1\u003eIs this an invitation to a Discord server? ➕\u003c/h1\u003e\n    \u003cp\u003e\n        This module checks whether a string is a Discord server invitation.\n        If it is, it fetches information from the API to find out more about the server.\n        An alternative (but inferior) method is validating the string solely through regex.\n    \u003c/p\u003e\n    \u003ca href=\"https://www.npmjs.com/package/is-discord-invite\" target=\"_blank\" title=\"is-discord-invite - npm\" style=\"text-decoration:none\"\u003e\n        \u003cimg src=\"https://img.shields.io/npm/dt/is-discord-invite.svg?maxAge=3600\" alt=\"npm downloads\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/issues/sefinek/is-discord-invite\" alt=\"Issues\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/last-commit/sefinek/is-discord-invite\" alt=\"Last commit\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/commit-activity/w/sefinek/is-discord-invite\" alt=\"Commit activity\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/languages/code-size/sefinek/is-discord-invite\" alt=\"Code size\"\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\n## 📥 » Installation\n```bash\nnpm install is-discord-invite\n```\n\n## ✨ » Example bot made in Discord.js\n\u003e https://github.com/sefinek/is-discord-invitation-bot\n\n## 🤔 » Table\n\n| Function | Async/await | Options         | Validation                                 | Faster? | Reliability | Recommended |\n|----------|:------------|-----------------|:-------------------------------------------|---------|-------------|:------------|\n| online   | Yes         | [View](#online) | [API](https://discord.com/api/v10/invites) | ❌       | ✅           | ✅           |\n| regex    | No          | [View](#regex)  | [Regex](grex.md)                           | ✅       | ❌           | ❌           |\n\n\n## 🌍 » API\n### `online(message)` \u003cdiv id=\"online\"\u003e\u003c/div\u003e\nChecks for valid Discord invitation links in the provided text and fetches invitation data.\n\n- `message` (string): The input text to search for Discord invitation links.\n\n\u003e **Returns** ([object](#invitation-data)): A Promise that resolves to an object with invitation data.\n\n### Invitation Data\nIf a valid invitation link is found, the returned data will have the following structure:\n\n```json\n{\n  \"success\": true,\n  \"code\": 200,\n  \"isInvitation\": true,\n  \"message\": \"Success\",\n  \"url\": {\n    \"full\": \"https://discord.gg/crtm7UKz\",\n    \"invitationCode\": \"crtm7UKz\",\n    \"fetched\": \"crtm7UKz\"\n  },\n  \"inviter\": {\n    \"id\": \"614087461227986965\",\n    \"username\": \"sefinek025\",\n    \"avatar\": \"a_fc3d7404ae62d64ca4c3d777815ba167\",\n    \"discriminator\": \"0\",\n    \"public_flags\": 256,\n    \"premium_type\": 2,\n    \"flags\": 256,\n    \"banner\": \"a_d9d11fb5320ce4cca30b7d85c837ce64\",\n    \"accent_color\": null,\n    \"global_name\": \"Sefinek 🌠\",\n    \"avatar_decoration_data\": {\n      \"asset\": \"a_88f42fb7360d8224a670a50c3496f315\",\n      \"sku_id\": \"1174460780842856588\"\n    },\n    \"banner_color\": null\n  },\n  \"guild\": {\n    \"id\": \"1002327795344621669\",\n    \"name\": \"Pomoc IT - Sefinek\",\n    \"splash\": null,\n    \"banner\": null,\n    \"description\": null,\n    \"icon\": \"faf0e64797c69de5e14be94603935cd9\",\n    \"features\": [ \"COMMUNITY\", \"CHANNEL_ICON_EMOJIS_GENERATED\", \"NEWS\" ],\n    \"verification_level\": 3,\n    \"vanity_url_code\": null,\n    \"nsfw_level\": 0,\n    \"nsfw\": false,\n    \"premium_subscription_count\": 0\n  }\n}\n```\n\nIn case the invitation was not valid 100%:\n```json\n{\n  \"success\": true,\n  \"code\": null,\n  \"isInvitation\": false,\n  \"message\": \"No valid links found\",\n  \"url\": null,\n  \"inviter\": null,\n  \"guild\": null\n}\n```\n\n### `regex(message, { options })` \u003cdiv id=\"regex\"\u003e\u003c/div\u003e\nChecks if the given string contains Discord server invitations. Validation is based solely on the string itself.\nIn this case, the script does NOT verify whether the link is actually associated with a server.\n\n- `message` (string): The input string to be checked.\n- `options` (object, optional): An options object for customizing the behavior. You can customize which types of Discord server invitation links to check by setting specific options to `true` or `false`. Available options include:\n    - `defaultDiscordUrls` (boolean, default `false`): Check default Discord invitation URLs.\n    - `otherDiscordUrls` (boolean, default `false`): Checks other domains created by Discord Inc. that redirect to discord.com/*.\n    - `disboard` (boolean, default `false`): Checks URL addresses associated with the **disboard.org** website.\n    - `discordMe` (boolean, default `false`): Checks URL addresses associated with the **discord.me** website.\n    - `discordhome` (boolean, default `false`): Checks URL addresses associated with the **discordhome.com** website.\n\nIf no options are provided, the `everything` option will be set to `true`, meaning that all types of Discord server invitation links will be checked.\n\n\u003e **Returns** (boolean): `true` if the input is a valid Discord server invitation link, `false` otherwise.\n\n\n## 📄 » Examples\n### 🧪 Online\nIn this case, `isInvitation` will be `true` due to the link with the code `HjEyuee4mc`, as it is the only valid one.\n\n```js\nconst IsInvitation = require('is-discord-invite');\n\n(async () =\u003e {\n    const result = await IsInvitation.online(\n        'Lorem ipsum dolor sit amet, https://discord.gg/notValid consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna https://discord.gg/HjEyuee4mc aliqua.\",\n    );\n\n    console.log(result.isInvitation); // true\n})();\n```\nIf the regex detects any invitation, the script sends a [POST request](https://en.wikipedia.org/wiki/POST_(HTTP)) to the [API](https://en.wikipedia.org/wiki/API) to verify the link's validity.\n\n### 🔡 Regex\nQuick method, but definitely not recommended for most cases. `isInvitation` will be `true` even if the invitation has expired or simply doesn't work.\n\n```js\nconst IsInvitation = require('is-discord-invite');\n\nconst result1 = IsInvitation.regex('https://discord.gg/HjEyuee4mc', { everything: true }); // Example with `everything` option\nconsole.log(result1); // true\n\nconst result2 = IsInvitation.regex('https://discord.gg/notVaildUrl');\nconsole.log(result2); // true\n\nconst result3 = IsInvitation.regex('https://example.com/bKzhAdd6Fa');\nconsole.log(result3); // false\n```\n\n\n## 🤝 » Help\nIf you have any questions or just need help, please visit my [official website](https://sefinek.net), where you can find my email and my current Discord username. Feel free to send me a message on Discord or reach out via email.\n\n\u003e Alternatively, you can create a new [Issue](https://github.com/sefinek/is-discord-invite/issues/new).\n\n## 🌿 » Pull requests\nCollaborators are welcome! If you'd like to contribute your suggestions or corrections to this project, we encourage you to create [Pull requests](https://github.com/sefinek/is-discord-invite/pulls).\n\n## ⭐ » Thanks\nThank you for your interest in this module. If you like it or find it useful, please consider starring the [repository](https://github.com/sefinek/is-discord-invite).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsefinek%2Fis-discord-invite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsefinek%2Fis-discord-invite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsefinek%2Fis-discord-invite/lists"}