{"id":18647941,"url":"https://github.com/gilgames000/discord-detours","last_synced_at":"2025-09-05T23:55:43.683Z","repository":{"id":57113336,"uuid":"436039417","full_name":"Gilgames000/discord-detours","owner":"Gilgames000","description":"Discord Detours is a package that helps you find, call, and hook into Discord client's functions.","archived":false,"fork":false,"pushed_at":"2022-11-03T22:39:15.000Z","size":9,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-09-28T17:35:05.363Z","etag":null,"topics":["api","detours","discord","function-hooking"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@gilgames/discord-detours","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gilgames000.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-07T22:07:37.000Z","updated_at":"2024-07-06T18:15:28.000Z","dependencies_parsed_at":"2022-08-22T02:50:21.559Z","dependency_job_id":null,"html_url":"https://github.com/Gilgames000/discord-detours","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gilgames000%2Fdiscord-detours","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gilgames000%2Fdiscord-detours/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gilgames000%2Fdiscord-detours/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gilgames000%2Fdiscord-detours/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gilgames000","download_url":"https://codeload.github.com/Gilgames000/discord-detours/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223469685,"owners_count":17150405,"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","detours","discord","function-hooking"],"created_at":"2024-11-07T06:28:23.083Z","updated_at":"2024-11-07T06:28:23.485Z","avatar_url":"https://github.com/Gilgames000.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Discord Detours\nDiscord Detours is a package that helps you find,\ncall, and hook into Discord client's functions.  \nThis is intended to be used with tools like\n[Puppeteer](https://github.com/puppeteer/puppeteer)\nwhich let you programmatically control a browser\ninstance and run JavaScript code in its context.\nYou can also inject [`api.js`](https://github.com/Gilgames000/discord-detours/blob/master/api.js)\ninto Discord using an extension like\n[Inject Code](https://chrome.google.com/webstore/detail/inject-code/gpaakhhkcmlenabckmapmlfnajboobbi)\ndirectly from your browser.\n\n## Installation\n```npm\nnpm install @gilgames/discord-detours\n```\n\n## API reference\n#### Utility functions for injecting the code (to be used with Puppeteer)\n- `detours.serializeModule(module)`: serializes a module into a string (`JSON.stringify` is no good as it won't serialize functions)\n- `detours.injectModule(serializedModule[, name])`: injects a serialized module into `window.name` (`name`defaults to `discordDetours` if not specified)\n\n#### APIs for finding functions and modules\n- `detours.api.getAllModules()`: returns a list of all modules\n- `detours.api.findModuleByFunctionName(name)`: returns a module by function name\n- `detours.api.findFunctionByName(name)`: returns a function by name\n- `detours.api.findFunctionsMatchingPattern(pattern)`: returns a list of functions matching a regex pattern\n  \n#### APIs for hooking/detouring functions\n*Will be added in the future.*\n\n## Usage\n#### Puppeteer\n```js\nconst detours = require(\"@gilgames/discord-detours\");\n\n// Open the browser with Puppeteer, navigate to Discord, and login\n// ...\n\n// Execute the code in the browser's context using Puppeteer's `page.evaluate`\nconst serializedAPI = detours.serializeModule(detours.api);\nawait page.evaluate(detours.injectModule, serializedAPI);\n\n// Call any Discord function\nconst token = await page.evaluate(() =\u003e window.discordDetours.findFunctionByName(\"getToken\")());\nconsole.log(token);\n\n```\n\n#### Using your browser\nFirst you have to install an extension that lets\nyou inject code into a webpage. Then, navigate to\nDiscord's website, login, and inject the code that\nyou can find in the [`api.js`](https://github.com/Gilgames000/discord-detours/blob/master/api.js)\nfile, bar the module export at the bottom. You can\nnow call the API functions described in the usage\nsection directly from the console of your browser. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilgames000%2Fdiscord-detours","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgilgames000%2Fdiscord-detours","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilgames000%2Fdiscord-detours/lists"}