{"id":13758387,"url":"https://github.com/twitch-js/twitch-js","last_synced_at":"2025-05-10T08:30:24.879Z","repository":{"id":38272336,"uuid":"113653349","full_name":"twitch-js/twitch-js","owner":"twitch-js","description":"[DEPRECATED] A community-centric, community-supported version of tmi.js","archived":true,"fork":false,"pushed_at":"2025-01-25T16:06:09.000Z","size":4690,"stargazers_count":347,"open_issues_count":11,"forks_count":40,"subscribers_count":12,"default_branch":"next","last_synced_at":"2025-05-09T02:41:37.276Z","etag":null,"topics":["api","bot","broadcast","deprecated","javascript","message","messaging","stream","tmi","twitch","typescript","websocket","ws"],"latest_commit_sha":null,"homepage":"https://twitch-js.netlify.com","language":"TypeScript","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/twitch-js.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null}},"created_at":"2017-12-09T08:09:20.000Z","updated_at":"2025-04-24T14:11:52.000Z","dependencies_parsed_at":"2023-02-18T08:31:40.573Z","dependency_job_id":"81b88342-e3ed-45cb-a179-d66ce88287e5","html_url":"https://github.com/twitch-js/twitch-js","commit_stats":{"total_commits":123,"total_committers":10,"mean_commits":12.3,"dds":0.5121951219512195,"last_synced_commit":"bc663573f15eac51c23b30be85d3cdd41dba84ae"},"previous_names":[],"tags_count":84,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitch-js%2Ftwitch-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitch-js%2Ftwitch-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitch-js%2Ftwitch-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitch-js%2Ftwitch-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twitch-js","download_url":"https://codeload.github.com/twitch-js/twitch-js/tar.gz/refs/heads/next","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253389382,"owners_count":21900750,"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":["api","bot","broadcast","deprecated","javascript","message","messaging","stream","tmi","twitch","typescript","websocket","ws"],"created_at":"2024-08-03T13:00:29.117Z","updated_at":"2025-05-10T08:30:24.871Z","avatar_url":"https://github.com/twitch-js.png","language":"TypeScript","funding_links":[],"categories":["Libraries","TypeScript"],"sub_categories":["JavaScript (Node.js)"],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg width=\"128\" src=\"media/logo.svg\"\u003e\n\u003c/p\u003e\n\n# [DEPRECATED] [TwitchJS](https://twitch-js.netlify.com/)\n\n[![No Maintenance Intended](http://unmaintained.tech/badge.svg)](http://unmaintained.tech/)\n[![Coverage status](https://img.shields.io/codecov/c/github/twitch-js/twitch-js/next.svg?longCache=true\u0026style=flat-square)](https://codecov.io/gh/twitch-js/twitch-js/branch/next)\n[![NPM version](https://img.shields.io/npm/v/twitch-js.svg?longCache=true\u0026style=flat-square)](https://www.npmjs.com/package/twitch-js)\n[![NPM downloads](https://img.shields.io/npm/dm/twitch-js.svg?longCache=true\u0026style=flat-square)](https://www.npmjs.com/package/twitch-js)\n[![GitHub issues](https://img.shields.io/github/issues-raw/twitch-js/twitch-js.svg?longCache=true\u0026style=flat-square)](https://github.com/twitch-js/twitch-js/issues)\n[![GitHub bug issues](https://img.shields.io/github/issues-raw/twitch-js/twitch-js/bug?style=flat-square)](https://github.com/twitch-js/twitch-js/issues?q=is%3Aopen+is%3Aissue+label%3Abug)\n\nA community-centric, community-supported Twitch JavaScript SDK.\n\n## Features\n\n- Aligns with official\n  [Twitch IRC documentation](https://dev.twitch.tv/docs/irc/)\n- Forward-compatible, low-level, minimally-assertive architecture\n- Supports Node environments\n- Supports Browsers\n- Supports TypeScript\n- Connect to multiple channels\n- Chat commands\n- Rate limiter\n\n### In progress...\n\nHere are the\n[planned features](https://github.com/twitch-js/twitch-js/milestones). If you\nfeel something is missing, create an issue or submit a PR against the next\nbranch.\n\n## Documentation\n\n1. [Getting started](#getting-started)\n2. [Authentication](#authentication)\n3. [Examples](#examples)\n4. [Interacting with Twitch chat](https://twitch-js.netlify.com/classes/chat.html)\n5. [Making requests to Twitch API](https://twitch-js.netlify.com/classes/api.html)\n6. [Reference](https://twitch-js.netlify.com/globals.html)\n\n## Getting started\n\n### Module bundler (CJS/ESM)\n\nIf you are using a module bundler, such as [Webpack](https://webpack.js.org/),\n[Browserify](http://browserify.org/), or a in a Node environment:\n\n1. Add TwitchJS to your project:\n   ```bash\n   npm install --save twitch-js\n   ```\n2. Import TwitchJS\n\n   ```js\n   // ES2015 syntax\n   import TwitchJs from 'twitch-js'\n\n   // OR ES5 syntax\n   var TwitchJs = require('twitch-js')\n\n   const twitchJs = new TwitchJs({ username, token })\n   ```\n\n### Browser (IIFE)\n\nIf you are not using a module bundler, precompiled builds are available in the\n[`dist` folder](https://unpkg.com/twitch-js@\u003e2.0.0-beta/dist/):\n\n1. Include a script tag in your HTML:\n   ```html\n   \u003cscript src=\"//unpkg.com/twitch-js@\u003e2.0.0-beta.31\"\u003e\u003c/script\u003e\n   ```\n2. Consume the library:\n   ```html\n   \u003cscript type=\"javascript\"\u003e\n     const twitchJs = new window.TwitchJs({ username, token })\n   \u003c/script\u003e\n   ```\n\n## Authentication\n\n### Obtaining a client ID\n\nTo obtain a client ID, follow the\n[instructions](https://dev.twitch.tv/docs/authentication/#registration) found in\nthe [Twitch Developers documentation](https://dev.twitch.tv/docs).\n\n### Obtaining a token\n\nWith a client ID,\n[tokens may be generated](https://dev.twitch.tv/docs/authentication/#getting-tokens)\non behalf of your users.\n\nTo quickly get started without a client ID, you may generate token using the\nfollowing, community-maintained, sites:\n\n1. [Twitch Token Generator](https://twitchtokengenerator.com)\n2. [Twitch Chat OAuth Password Generator](https://twitchapps.com/tmi)\n\n### Refreshing tokens\n\nTo help with refreshing tokens, an `onAuthenticationFailure` function may be\nprovided to the Messaging and API clients. `onAuthenticationFailure()` must\nreturn a `Promise` that resolves with the refreshed token. Upon resolution, any\nactions that yielded an _expired token_ response will be retried with the new,\nrefreshed token.\n\n#### Handling token refresh example\n\n```js\n// Optionally, use fetchUtil to help.\nimport fetchUtil from 'twitch-js/lib/utils/fetch'\n\nconst refreshToken = 'eyJfaWQmNzMtNGCJ9%6VFV5LNrZFUj8oU231/3Aj'\nconst clientId = 'fooid'\nconst secret = 'barbazsecret'\n\nconst onAuthenticationFailure = () =\u003e\n  fetchUtil('https://id.twitch.tv/oauth2/token', {\n    method: 'post',\n    search: {\n      grant_type: 'refresh_token',\n      refresh_token: refreshToken,\n      client_id: clientId,\n      client_secret: clientSecret,\n    },\n  }).then((response) =\u003e response.accessToken)\n\nconst token = 'cfabdegwdoklmawdzdo98xt2fo512y'\nconst username = 'ronni'\nconst twitchJs = new TwitchJs({ token, username, onAuthenticationFailure })\n\ntwitchJs.chat.connect().then((globalUserState) =\u003e {\n  // Do stuff ...\n})\n```\n\nSee\n[Refreshing access tokens](https://dev.twitch.tv/docs/authentication/#refreshing-access-tokens)\nfor more information.\n\n### More information\n\nSee the\n[Twitch Developers documentation](https://dev.twitch.tv/docs/authentication) for\nmore information on authentication.\n\n## Examples\n\nExamples are provided via [CodeSandbox](https://codesandbox.io):\n\n- [Browser](https://codesandbox.io/s/twitch-js-browser-example-upf4x)\n- [Node](https://codesandbox.io/s/twitch-js-node-example-mnel5)\n- [TypeScript](https://codesandbox.io/s/twitch-js-typescript-example-tnnys)\n\n## Contribution guidelines\n\nIf you wish to contribute, please see the\n[CONTRIBUTING](https://github.com/twitch-js/twitch-js/blob/master/CONTRIBUTING.md)\ndoc.\n\n## Special thanks\n\n[Schmoopiie](https://github.com/Schmoopiie) and all the\n[original contributors](https://github.com/tmijs/tmi.js/graphs/contributors) of\n`tmi.js`.\n\n## License\n\nMIT\n\nTwitchJS is not affiliated, associated, authorized, endorsed by, or in any way\nofficially connected with [Twitch](https://www.twitch.tv/), or any of its\nsubsidiaries or its affiliates. The name \"Twitch\" as well as related names,\nmarks, emblems and images are registered trademarks of\n[Twitch](https://www.twitch.tv/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwitch-js%2Ftwitch-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwitch-js%2Ftwitch-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwitch-js%2Ftwitch-js/lists"}