{"id":16095639,"url":"https://github.com/rigwild/discord-self-bot-console","last_synced_at":"2026-02-24T21:32:13.995Z","repository":{"id":38818583,"uuid":"373261360","full_name":"rigwild/discord-self-bot-console","owner":"rigwild","description":"A simple Discord Self-bot using devtools console","archived":false,"fork":false,"pushed_at":"2024-09-16T20:33:19.000Z","size":3610,"stargazers_count":88,"open_issues_count":0,"forks_count":17,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-09T01:16:34.929Z","etag":null,"topics":["console","devtools","discord","discord-api","discord-selfbot","selfbot"],"latest_commit_sha":null,"homepage":"","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/rigwild.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-02T18:07:19.000Z","updated_at":"2025-04-02T17:15:52.000Z","dependencies_parsed_at":"2024-10-26T19:31:19.666Z","dependency_job_id":"df0dcd90-4c7d-4020-81ad-a0663eda75dc","html_url":"https://github.com/rigwild/discord-self-bot-console","commit_stats":{"total_commits":43,"total_committers":6,"mean_commits":7.166666666666667,"dds":0.2325581395348837,"last_synced_commit":"4bcd946717401daad73f3dfd866f45e60e403c6c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rigwild/discord-self-bot-console","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rigwild%2Fdiscord-self-bot-console","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rigwild%2Fdiscord-self-bot-console/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rigwild%2Fdiscord-self-bot-console/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rigwild%2Fdiscord-self-bot-console/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rigwild","download_url":"https://codeload.github.com/rigwild/discord-self-bot-console/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rigwild%2Fdiscord-self-bot-console/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29801021,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T21:02:39.706Z","status":"ssl_error","status_checked_at":"2026-02-24T21:02:21.834Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["console","devtools","discord","discord-api","discord-selfbot","selfbot"],"created_at":"2024-10-09T17:07:14.600Z","updated_at":"2026-02-24T21:32:13.974Z","avatar_url":"https://github.com/rigwild.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Discord self-bot console\n\nA simple Discord Self-bot using console. Intended for quick scripts runnable directly from the devtools. Can also be [used with Node.js](https://github.com/rigwild/discord-self-bot-console/discussions/4#discussioncomment-1438231) for quick simple scripts!\n\n# Disclaimer\n\nAutomating user accounts is against [Discord's Terms of Service](https://discord.com/terms). You might get banned if you abuse it (too much spam, unusual activity).\n\n# Usage\n\n1. Close Discord client (`Quit Discord` in system tray)\n2. Open the settings file, it's location depends on your OS:\n   - Windows: `%appdata%\\discord\\settings.json`\n   - macOS: `~/Library/Application Support/Discord/settings.json`\n   - Linux: `~/.config/discord/settings.json`\n3. Add `\"DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING\": true,` (this is necessary [since last update](https://www.reddit.com/r/discordapp/comments/sc61n3/comment/hu4fw5x))\n4. Save the file\n5. Restart Discord client\n6. Open Chrome devtools on Discord using `Ctrl + shift + i`\n7. Go to the console tab and paste the entire [`index.js`](./index.js) script\n8. Send a message in any channel/DM, this will automatically set your auth token into the script\n9. ...\n10. Profit!\n\nIf you want to disable the token from being automatically set, use `autoUpdateToken = false` at the start of your bot script. You can extract the auth token manually by doing this:\n\n6. Open Chrome devtools on Discord using `Ctrl + shift + i`\n7. Go to the console tab and paste the entire [`index.js`](./index.js) script\n8. Go to the network tab and send a message in any channel/DM\n9. A new entry should appear, click it then copy the `Authorization` header (in the `Request Headers` section)\n10. Paste it in `authHeader` at the end of the script in the console\n\n![How to use video](./howto.gif)\n\nYou can now use any function provided by this script in the console like `await api.someFunction()`. Don't forget `await` or the server's response will not be printed to the console.\n\nUse the `api.id()` function to update the variable `gid` guild id and `cid` channel id to what you are currently watching.\n\n**Note:** It's a good idea to wrap your code in its own scope `{ code }` or you might get an error when reusing the same variable names later!\n\n# Examples\n\n## Basic example\n\nUpdate `cid` to the channel you are watching, get the last 100 messages, send a message, edit then delete.\n\n```js\n{\n  api.id()\n  // or api.update_guildId_and_channelId_withCurrentlyVisible()\n\n  let channelId = cid\n  // or let channelId = api.getConfig().channelId\n\n  // Send a message\n  let sentMessage = await api.sendMessage(channelId, `Hello! 👋 My name is ${user.username}!`)\n\n  await api.delay(2000)\n\n  // Edit a message\n  let editedMessage = await api.editMessage(channelId, sentMessage.id, 'Hello, edited! ✌️')\n\n  await api.delay(2000)\n\n  // Delete a message\n  await api.deleteMessage(channelId, editedMessage.id)\n\n  await api.delay(2000)\n\n  // Log the last 100 messages in the console\n  let messages = await api.getMessages(channelId)\n  console.log(messages)\n}\n```\n\n## Develop in IDE and get typings\n\nTypes are provided at [`types.d.ts`](./types.d.ts). You can use them in your IDE to get typings and develop your script in a better environment. The typings are not fully complete, but it's better than nothing ([PRs are welcome!](https://github.com/rigwild/discord-self-bot-console/issues/60)).\n\nThe script will not work with Node.js (and not supposed to be made for it), you need to copy/paste it in the Discord console to run it.\n\nDon't forget to paste the full [`index.js`](./index.js) script in the console first to get the `api` variable!\n\n```bash\ngit clone git@github.com:rigwild/discord-self-bot-console.git\n# or\ngit clone https://github.com/rigwild/discord-self-bot-console.git\n\ncd discord-self-bot-console\ncode .\n```\n\nDoing the following, you should be able to get typings. Open [`myScripts/example.js`](./myScripts/example.js).\n\n```js\n// myScripts/example.js\n\n// @ts-check\nconst { api } = require('../index.js')\n\n// Copy paste the below code inside the Discord console\n;(async () =\u003e {\n  const user = await api.getCurrentUser()\n\n  console.log(user.username)\n})()\n```\n\n## Send an embed\n\n**SENDING EMBEDS AS A USER ACCOUNT IS NOT POSSIBLE ANYMORE, DISCORD UPDATED ITS API (see [this reddit post](https://web.archive.org/web/20220209223900/https://www.reddit.com/r/Discord_selfbots/comments/sa0hc2/discord_embeds_patched/))**\n\nSee [How to send an embed?](https://github.com/rigwild/discord-self-bot-console/discussions/6#discussioncomment-1779730)\n\n![embed example](https://user-images.githubusercontent.com/26366184/145406696-8734410a-fc08-40e3-abf8-de12d8d89db9.png)\n\n## Run in Node.js\n\nSee [Can I run it without opening Discord?](https://github.com/rigwild/discord-self-bot-console/discussions/4#discussioncomment-1438231)\n\n## Use multiple account tokens\n\nSee [Is it possible to use multiple tokens?](https://github.com/rigwild/discord-self-bot-console/discussions/21#discussioncomment-3048097)\n\n## Use a bot account\n\nThis specific script only works for user accounts. If you want to use a bot account, you need to use the provided Node.js version (see above).\n\n[Why can't I use a bot account with the Discord client?](https://github.com/rigwild/discord-self-bot-console/discussions/4#discussioncomment-1999680)\n\n## List all custom emojis urls from all guilds you are a member of\n\nSee [How to list all custom emojis urls from all guilds you are a member of](https://github.com/rigwild/discord-self-bot-console/discussions/2#discussioncomment-986874)\n\n## React with emoji or custom emoji\n\nSee [How to react with emoji or custom emoji ? 🤔](https://github.com/rigwild/discord-self-bot-console/discussions/23#discussioncomment-3135937)\n\n## Send slash commands (/something)\n\nSee [Send slash commands (/something)](https://github.com/rigwild/discord-self-bot-console/discussions/31#discussioncomment-3442385)\n\n## Add and remove reactions to every message on a channel\n\nSee [Add and remove reactions to every message on a channel](https://github.com/rigwild/discord-self-bot-console/discussions/32#discussioncomment-3620234)\n\n## Open a thread\n\n```js\n{\n  api.id()\n  let channelId = cid\n\n  const sentMessage = await api.sendMessage(channelId, 'Hello, please open a thread here! 💕')\n\n  // A new thread opened in reply to a message\n  const createdThread = await api.createThread(channelId, sentMessage.id, 'A cool thread 🤔')\n  const sentMessage2 = await api.sendMessage(createdThread.id, 'Here it is, this is a thread! 😁')\n  await api.replyToMessage(createdThread.id, sentMessage2.id, 'Thanks! ✌️')\n\n  // A clean new thread without any message in it (not opened on any message!)\n  await api.createThreadWithoutMessage(channelId, 'Another thread 😁')\n}\n```\n\n## Farm XP\n\nSend a `message` to a channel (`channelId`) every minute then delete it (useful for XP farming in some servers).\n\nYou can use `loop = false` at any time to stop it.\n\n```js\n{\n  api.id()\n  let channelId = cid\n  let message = 'Hi, I like spamming 🦜'\n\n  var loop = true\n  let count = 0\n  while (loop) {\n    const sentMessage = await api.sendMessage(channelId, message)\n    await api.deleteMessage(channelId, sentMessage.id)\n    console.log(`Sent ${++count} messages`)\n    await api.delay(61000) // 61 seconds\n  }\n}\n```\n\nTo farm XP with multiple accounts, check [Is it possible to farm XP using multiple tokens?](https://github.com/rigwild/discord-self-bot-console/discussions/21#discussioncomment-3136195)\n\n## Clear messages of user\n\nDelete the `amount` messages from user (`userId`) sent to a channel/DM (`channelId`) appearing before message (`beforeMessageId`) and wait `delayMs` milliseconds everytime.\n\nI use sometimes to fully clear my DMs as Discord does not offer it as a feature.\n\nYou can use `loop = false` at any time to stop it.\n\nDiscord recently made its rate limiting strictier. I recommend 1100ms as a minimum to not get rate limited. Make it even bigger if you are affraid of getting banned.\n\n```js\n{\n  api.id()\n  let channelId = cid\n  let userId = '012345678987654321'\n  let amount = 99999999\n  let delayMs = 1100\n\n  let beforeMessageId = '8999999999999999999' // Leave it like this to delete from latest\n\n  let deletionCount = 0\n  var loop = true\n  while (loop) {\n    const messages = await api.getMessages(channelId, 100, { before: beforeMessageId })\n\n    // We reached the start of the conversation\n    if (messages.length \u003c 100 \u0026\u0026 messages.filter(x =\u003e x.author.id === userId \u0026\u0026 (x.type === 0 || x.type === 19)).length === 0) {\n      loop = false\n      console.log(`[${deletionCount}/${amount}] Reached the start of the conversations! Ending.`)\n      continue\n    }\n\n    // Update last message snowflake for next iteration\n    beforeMessageId = messages[0].id\n\n    for (const aMessage of messages) {\n      if (loop === false) break\n\n      // Check if the max amount was reached\n      if (deletionCount \u003e= amount) {\n        loop = false\n        console.log(`[${deletionCount}/${amount}] Deleted the requested amount of messages! Ending.`)\n        break\n      }\n\n      // Update last message snowflake for next iteration\n      beforeMessageId = aMessage.id\n\n      // Check if the message should be deleted\n      if (aMessage.author.id === userId \u0026\u0026 (aMessage.type === 0 || aMessage.type === 19)) {\n        await api.deleteMessage(channelId, aMessage.id)\n        deletionCount++\n        console.log(`[${deletionCount}/${amount}] Deleted a message!`)\n        if (deletionCount \u003c amount) await api.delay(delayMs)\n      }\n    }\n    await api.delay(delayMs)\n  }\n}\n```\n\n## Do anything to every messages in a text channel\n\nPass your custom function!\n\nThis example will apply all reactions already there on all messages, then add 👋 if message says `hi!!` or `hello`.\n\n```js\n{\n  api.id()\n  let channelId = cid\n  let amount = 99999999\n  let delayMs = 500\n\n  let actionFn = async (channelId, message) =\u003e {\n    //\n    // Your custom code here\n    //\n    let wasActiontriggered = false\n\n    // Copy all reactions already present on message\n    for (const reaction of message.reactions || []) {\n      let reactionToAdd = reaction.emoji.id ? `${reaction.emoji.name}:${reaction.emoji.id}` : reaction.emoji.name\n      await api.addReaction(channelId, message.id, reactionToAdd)\n      wasActiontriggered = true\n      await api.delay(delayMs)\n    }\n\n    // If person said `hello!!!` or `hi!`, react with waving hand 👋\n    if (message.content.match(/^(?:hi|hello)!*$/)) {\n      await api.addReaction(channelId, message.id, '👋')\n      wasActiontriggered = true\n    }\n\n    // Return a boolean indicating if you did something to the message\n    // If true, will log and apply delay\n    return wasActiontriggered\n  }\n\n  let beforeMessageId = '8999999999999999999' // Leave it like this to react from latest\n\n  let count = 0\n  var loop = true\n  while (loop) {\n    const messages = await api.getMessages(channelId, 100, { before: beforeMessageId })\n\n    // We reached the start of the conversation\n    if (messages.length \u003c 100 \u0026\u0026 messages.filter(x =\u003e x.type === 0 || x.type === 19).length === 0) {\n      loop = false\n      console.log(`[${count}/${amount}] Reached the start of the conversation! Ending.`)\n      continue\n    }\n\n    // Update last message snowflake for next iteration\n    beforeMessageId = messages[0].id\n\n    for (const aMessage of messages) {\n      if (loop === false) break\n\n      // Check if the max amount was reached\n      if (count \u003e= amount) {\n        loop = false\n        console.log(`[${count}/${amount}] Treated the requested amount of messages! Ending.`)\n        break\n      }\n\n      // Update last message snowflake for next iteration\n      beforeMessageId = aMessage.id\n\n      // Check if the message should be reacted\n      if (aMessage.type === 0 || aMessage.type === 19) {\n        let wasActiontriggered = await actionFn(channelId, aMessage)\n        // Apply delay and log only if return true\n        if (wasActiontriggered) {\n          count++\n          console.log(`[${count}/${amount}] Treated a message! ID=${aMessage.id}`)\n          if (count \u003c amount) await api.delay(delayMs)\n        }\n      }\n    }\n    await api.delay(delayMs)\n  }\n}\n```\n\n# FAQ\n\n## Will I get banned if I do x?\n\nI don't know, maybe. I have used lots of scripts in the past, often deleted 100k+ messages of mine accross private messages and servers and never got banned, ever.\n\nBut I can't guarantee anything. Use at your own risk.\n\nAutomating user accounts is againt [Discord's Terms of Service](https://discord.com/terms).\n\n## Listen to events, do some advanced stuff\n\nThis is intended for small scripts, not to implement a full-featured bot.\n\nIf you need to listen to events or do something more advanced you can use the [discord.js](https://github.com/discordjs/discord.js) package with your user token (with v11.3.2 and below though, they deprecated user token support starting v11.4.0!).\n\n**Note:** As they don't support user bots anymore, it may break at any time (with Discord changing their APIs).\n\n## Can it do x? Can you help me?\n\nPost your requests in the [Discussions](https://github.com/rigwild/discord-self-bot-console/discussions) tab. Please search if your request was not mentionned in an earlier post before asking.\n\n## I made a nice/useful script, can I share?\n\nOf course! Post it in the [Discussions](https://github.com/rigwild/discord-self-bot-console/discussions) tab. Please search if a similar script was shared earlier before posting.\n\n## Why this repo?\n\nInitially, this was posted as [a gist for myself](https://gist.github.com/rigwild/28f5d9479e3e122070e27db84e104719). As there's interest for such a thing, I figured out making a proper repo was better to share scripts.\n\n# API\n\n## Full list\n\nThe full list of available functions is available in [`types.d.ts`](./types.d.ts).\n\n```js\napi.id()\napi.update_guildId_and_channelId_withCurrentlyVisible()\napi.delay(ms)\napi.apiCall(apiPath, body, method = 'GET')\n\napi.getMessages(channelOrThreadId, limit?, params = {})\napi.sendMessage(channelOrThreadId, message, tts?, body = {})\napi.replyToMessage(channelOrThreadId, repliedMessageId, message, tts?, body = {})\napi.editMessage(channelOrThreadId, messageId, newMessage, body = {})\napi.deleteMessage(channelOrThreadId, messageId)\n\napi.createThread(channelId, toOpenThreadInmessageId, name, autoArchiveDuration?, body = {})\n\napi.getCurrentUser()\napi.editCurrentUser(username?, bio?, body = {})\n// and more...\n```\n\n## `api.delay(ms)`\n\n`api.delay(ms: number) =\u003e Promise\u003cvoid\u003e`\n\nWait for `ms` milliseconds.\n\n```js\nawait delay(1500)\nawait api.delay(1500)\n```\n\n## `api.downloadFileByUrl(url, filename)`\n\n`api.downloadFileByUrl(url: string, filename: string) =\u003e Promise\u003cvoid\u003e`\n\nDownload a file at `url` and name it `filename`.\n\nSee [How to download attachments (file, image) from a message?](https://github.com/rigwild/discord-self-bot-console/discussions/66)\n\n```js\nawait api.downloadFileByUrl('https://cataas.com/cat', 'cat.png')\nawait api.downloadFileByUrl(messages[0].attachments[0].url, messages[0].attachments[0].filename)\n```\n\n## `api.id()`\n\n`api.id() =\u003e void` (old alias)\n\n`api.update_guildId_and_channelId_withCurrentlyVisible() =\u003e void`\n\nUpdate the variable `gid` guild id and `cid` channel id to what you are currently watching in the Discord client.\n\n```js\nid()\napi.id()\n```\n\n## `api.getConfig()`\n\n```ts\napi.getConfig(): Readonly\u003c{\n  authHeader: string,\n  autoUpdateToken: boolean,\n  guildId: string,\n  channelId: string,\n  gid: string,\n  cid: string,\n}\u003e\n```\n\nReturns the current configuration, read-only. Useful if you want to use typings in your IDE.\n\nSet configuration\n\n```\napi.setConfigAutoUpdateToken(autoUpdateToken: boolean): void\napi.setConfigGid(guildId: string): void\napi.setConfigGuildId(guildId: string): void\napi.setConfigCid(channelId: string): void\napi.setConfigChannelId(channelId: string): void\n```\n\n## Variables\n\n- `authHeader`: You Discord account auth token\n- `autoUpdateToken`: If true, the token will be automatically updated in the bot when a request is sent from the client (e.g sending a message)\n- `gid`: Current guild id (update to what you are currently watching using `api.id()`)\n- `cid`: Current channel id (update to what you are currently watching using `api.id()`)\n\n# License\n\n[The MIT License](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frigwild%2Fdiscord-self-bot-console","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frigwild%2Fdiscord-self-bot-console","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frigwild%2Fdiscord-self-bot-console/lists"}