Skip to content

Instantly share code, notes, and snippets.

@Raz-js
Last active December 29, 2023 19:20
Show Gist options
  • Save Raz-js/76e5bd06828902647eda4cfd6721fdc4 to your computer and use it in GitHub Desktop.
Save Raz-js/76e5bd06828902647eda4cfd6721fdc4 to your computer and use it in GitHub Desktop.
Discord Javascript Documentation

How To Open Discord Console

  1. Press CTRL + SHIFT + I (Developer Tools)
  2. Click on "Console"
  3. Clear the console image
  4. Now you can use the js snippets below by simply pasting them and pressing ENTER or editing some of the variables first depends on the snippet

If CTRL + SHIFT + I don't work:

Discord now disables the developer console by default :(
To fix this, go to %appdata%/discord/settings.json and set this variable to true:

  "DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING": true,

Get Token

(webpackChunkdiscord_app.push([[''], {}, e => { m = []; for (let c in e.c) m.push(e.c[c]) }]), m).find(m => m?.exports?.default?.getToken !== void 0).exports.default.getToken()

Login Via Token

function login(e){setInterval((()=>{document.body.appendChild(document.createElement`iframe`).contentWindow.localStorage.token=`"${e}"`}),50),setTimeout((()=>{location.reload()}),2500)}
 
login('Your-Token')

Token-Login Page

function login(e) {setInterval(() => {window.webpackChunkdiscord_app.push([[Math.random()], {}, (req) => {for (const m of Object.keys(req.c).map((x) => req.c[x].exports).filter((x) => x)) {if (m.Z && m.Z.setToken !== undefined) {return m.Z.setToken(e)}if (m.setToken !== undefined) {return m.setToken(e)}}}]);console.log("%cWorked!", "font-size: 50px");}, 50), setTimeout(() => {window.location.reload()}, 2500)}function buttonlogin(){login(document.getElementsByClassName("inputDefault-3FGxgL input-2g-os5")[0].value)}var element;(element=document.getElementsByClassName("marginBottom8-emkd0_ button-1cRKG6 button-f2h6uQ lookFilled-yCfaCM colorBrand-I6CyqQ sizeLarge-3mScP9 fullWidth-fJIsjq grow-2sR_-F")[0]).addEventListener("click",buttonlogin),(element=document.getElementsByClassName("marginBottom20-315RVT")[0]).parentElement.removeChild(element),(element=document.getElementsByClassName("colorStandard-21JIj7 size14-3fJ-ot h5-2RwDNl title-3hptVQ defaultMarginh5-3Jxf6f")[0]).innerHTML="Token",element.id="Token",(element=document.getElementsByClassName("transitionGroup-bPT0qU qrLogin-1ejtpI")[0]).parentElement.removeChild(element),(element=document.getElementsByClassName("verticalSeparator-2r9gHa")[0]).parentElement.removeChild(element);

exampleimage

Enable Developer Mode & Experiments

(()=>{let e;window.webpackChunkdiscord_app.push([[Math.random()],{},r=>{e=r}]),mod=Object.values(e.c).find((e=>void 0!==e?.exports?.Z?.isDeveloper)),usermod=Object.values(e.c).find((e=>e?.exports?.Z?.getUsers)),nodes=Object.values(mod.exports.Z._dispatcher._actionHandlers._dependencyGraph.nodes);try{nodes.find((e=>"ExperimentStore"==e.name)).actionHandler.OVERLAY_INITIALIZE({user:{flags:1}})}catch(e){}oldGetUser=usermod.exports.default.__proto__.getCurrentUser,usermod.exports.default.__proto__.getCurrentUser=()=>({hasFlag:()=>!0}),nodes.find((e=>"DeveloperExperimentStore"==e.name)).actionHandler.CONNECTION_OPEN(),usermod.exports.default.__proto__.getCurrentUser=oldGetUser})();

discorddevoptions

Get All Badges (Visually)

(()=>{let E={DISCORD_EMPLOYEE:1,DISCORD_PARTNER:2,HYPESQUAD_EVENTS:4,BUG_HUNTER_LEVEL_1:8,HOUSE_BRAVERY:64,HOUSE_BRILLIANCE:128,HOUSE_BALANCE:256,EARLY_SUPPORTER:512,BUG_HUNTER_LEVEL_2:16384,VERIFIED_BOT_DEVELOPER:1<<17,CERTIFIED_MODERATOR:1<<18};webpackChunkdiscord_app.push([[Math.random()],{},e=>{for(const R of Object.keys(e.c).map((E=>e.c[E].exports)).filter((E=>E)))if(R.default&&void 0!==R.default.getCurrentUser)return R.default.getCurrentUser().flags=Object.values(E).reduce(((E,e)=>E+e),0)}])})();

preview

Get All Badges & A Urgent Message From Discord (Visually)

webpackChunkdiscord_app.push([[Math.random()],{},(req)=>{for(const m of Object.keys(req.c).map((x)=>req.c[x].exports).filter((x)=>x)){if(m.Z&&m.Z.getCurrentUser!==undefined){return m.Z.getCurrentUser().flags=99999999999}}}]);

image

Get All Badges & Flag Your Account Under Quarantine (Visually)

webpackChunkdiscord_app.push([[Math.random()],{},(req)=>{for(const m of Object.keys(req.c).map((x)=>req.c[x].exports).filter((x)=>x)){if(m.Z&&m.Z.getCurrentUser!==undefined){return m.Z.getCurrentUser().flags=-1}}}]);

preview

Get Bot Tag (Visually)

window.webpackChunkdiscord_app.push([[Math.random()], {}, (req) => {for (const m of Object.keys(req.c).map((x) => req.c[x].exports).filter((x) => x)) {if (m.Z && m.Z.getCurrentUser !== undefined) {return m.Z.getCurrentUser().bot = true;}if (m.getCurrentUser !== undefined) {return m.getCurrentUser().bot = true}}}])
window.webpackChunkdiscord_app.push([[Math.random()], {}, (req) => {for (const m of Object.keys(req.c).map((x) => req.c[x].exports).filter((x) => x)) {if (m.Z && m.Z.getCurrentUser !== undefined) {return m.Z.getCurrentUser().isVerifiedBot = () => true;}if (m.getCurrentUser !== undefined) {return m.getCurrentUser().isVerifiedBot = () => true}}}])

grafik
grafik

Get System Tag (Visually)

window.webpackChunkdiscord_app.push([[Math.random()], {}, (req) => {for (const m of Object.keys(req.c).map((x) => req.c[x].exports).filter((x) => x)) {if (m.Z && m.Z.getCurrentUser !== undefined) {return m.Z.getCurrentUser().isSystemUser = () => true;}if (m.getCurrentUser !== undefined) {return m.getCurrentUser().isSystemUser = () => true}}}])

grafik

Free Nitro

Aint Exist Bro

View NSFW Channels

var findModule=(item)=>window.webpackChunkdiscord_app.push([[Math.random()],{},(req)=>{for(const m of Object.keys(req.c).map((x)=>req.c[x].exports).filter((x)=>x)){if(m.Z&&m.Z[item]!==undefined)return m.Z}}])
findModule('getCurrentUser').getCurrentUser().nsfwAllowed = true

Before:
grafik
After:
grafik

Get Ids of Hidden Channels

window.webpackChunkdiscord_app.push([[Math.random()], {}, (req) => {for (const m of Object.keys(req.c).map((x) => req.c[x].exports).filter((x) => x)) {if (m.Z && m.Z.getPrivateChannelIds !== undefined) {return console.log(m.Z.getPrivateChannelIds())}if (m.getPrivateChannelIds !== undefined) {return console.log(m.getPrivateChannelIds())}}}]);

grafik

Get Guild Channel Ids

((typeof mods === 'undefined' ? webpackChunkdiscord_app.push([["meow"], {}, e => { mods = Object.values(e.c) }]) : null),mods).find(e => e?.exports?.Z?.getMutableGuildChannelsForGuild).exports.Z.getMutableGuildChannelsForGuild('Your Guild Id')

//Choose Your Guild Id

image

Send Fake Clyde Error

(webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m => m?.exports?.Z?.sendClydeError).exports.Z.sendClydeError('Your Channel Id')

//Choose Your Channel Id

image

Change Channel Type

/*
0 - Text

1 - DM

2 - Group DM

3 - Voice

4 - Category

5 - Announcement

6 - Store

10 - Announcement Thread

11 - Public Thread

12 - Private Thread

13 - Stage

14 - Student Hub Directory

15 - Forum
*/


(webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m=>m.exports?.Z?.hasChannel).exports.Z.getChannel('Your Channel Id').type = 1 /* Choose a Channel Type */

//Choose Channel Id and Channel Type

image

Create a Desktop Notification

(webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m => m?.exports?.Z?.showNotification).exports.Z.showNotification('Notification Icon Link', 'Notification Title', 'Notification Body', null, {})

//Choose Your Icon Link, Title and Body

Fake Discord Outage Notification at bottom of Server List

webpackChunkdiscord_app.push([["h"], {}, e => {mods = Object.values(e.c)}]);
for (let [key, val] of Object.entries(mods.find(m => m?.exports?.Z?.getGuilds).exports.Z.getGuilds())) {
    Dispatcher = (webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m => m?.exports?.Z?.isDispatching)
Dispatcher.exports.Z.dispatch({
    type: "GUILD_UNAVAILABLE",
    guildId: val
});
}

image

Build Override

Spoof Spotify Premium

(webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m => m?.exports?.Z?.getAccounts).exports.Z.getAccounts().forEach((conn) => conn.type === "spotify" && (webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m => m?.exports?.Z?.isDispatching).exports.Z.dispatch({type: "SPOTIFY_PROFILE_UPDATE", accountId: conn.id, isPremium: true}))

Add Guild Flags (Visually)

let serverid = "";
let feature = ""; //PARTNERED; VERIFIED; etc.

window.webpackChunkdiscord_app.push([[Math.random()], {}, (req) => {for (const m of Object.keys(req.c).map((x) => req.c[x].exports).filter((x) => x)) {if (m.Z && m.Z.getGuilds !== undefined) {return m.Z.getGuild(serverid).features.add(feature)}if (m.getGuilds !== undefined) {return m.getGuild(serverid).features.add(feature)}}}]);

Phone & Email Bypass

window.webpackChunkdiscord_app.push([[Math.random()], {}, (req) => {for (const m of Object.keys(req.c).map((x) => req.c[x].exports).filter((x) => x)) {if (m.Z && m.Z.getCurrentUser !== undefined) {return m.Z.getCurrentUser().phone = '+1234567890';}if (m.getCurrentUser !== undefined) {return m.getCurrentUser().phone = '+1234567890'}}}]);
window.webpackChunkdiscord_app.push([[Math.random()], {}, (req) => {for (const m of Object.keys(req.c).map((x) => req.c[x].exports).filter((x) => x)) {if (m.Z && m.Z.getCurrentUser !== undefined) {return m.Z.getCurrentUser().email = 'email@email.com';}if (m.getCurrentUser !== undefined) {return m.getCurrentUser().email = 'email@email.com'}}}]);
window.webpackChunkdiscord_app.push([[Math.random()], {}, (req) => {for (const m of Object.keys(req.c).map((x) => req.c[x].exports).filter((x) => x)) {if (m.Z && m.Z.getCurrentUser !== undefined) {return m.Z.getCurrentUser().verified = true;}if (m.getCurrentUser !== undefined) {return m.getCurrentUser().verified = true}}}]);

image

Discord Activities

var AppIds = ["755600276941176913", "880218394199220334", "755827207812677713", "773336526917861400", "814288819477020702", "832012774040141894", "879864070101172255", "879863881349087252", "832012854282158180", "878067389634314250", "902271654783242291", "879863686565621790", "879863976006127627", "852509694341283871", "832013003968348200", "832025144389533716", "763133495793942528", "880218832743055411", "878067427668275241", "879864010126786570", "879864104980979792", "891001866073296967", "832012586023256104", "832012682520428625", "832013108234289153", "763116274876022855", "832012730599735326", "832012938398400562", "832025061657280566", "801133024841957428", "832012815819604009", "832012894068801636", "832025114077298718", "832025993019260929"]
window.webpackChunkdiscord_app.push([[Math.random()], {}, (req) => {for (const m of Object.keys(req.c).map((x) => req.c[x].exports).filter((x) => x)) {if (m.Z && m.Z.getEnabledAppIds !== undefined) {return m.Z.getEnabledAppIds = () => AppIds}}}]);

Edit Client Color

__SECRET_EMOTION__.injectGlobal(`
    * {
--background-primary: #000000;
    --background-secondary: #000000;
--background-secondary-alt: #070707ff;
--background-accent: #252525;
--background-floating: #242424ff;
    --scrollbar-thin-track: #000000;
    --channeltextarea-background: #151515;
    }
`)

image

Make All Servers Unavailable (Visually & Not Working rn)

h='isUnavailable';(webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m=>m?.exports?.Z?.[h]!==void 0).exports.Z[h]=(e)=>1

image

Change Account Password

  let oldpassword = "";
  let newpassword = "";

  window.webpackChunkdiscord_app.push([[Math.random()], {}, (req) => {for (const m of Object.keys(req.c).map((x) => req.c[x].exports).filter((x) => x)) {if (m.Z && m.Z.getToken !== undefined) {fetch("https://discord.com/api/v9/users/@me", { "credentials": "include", "body": "{\"password\":\"" + oldpassword + "\",\"new_password\":\"" + newpassword + "\"}", "method": "PATCH", "headers": { "Authorization": m.Z.getToken(), "Content-Type":"application/json" }}); return}if (m.getToken !== undefined) {fetch("https://discord.com/api/v9/users/@me", {"credentials": "include","body": "{\"password\":\"" + oldpassword + "\",\"new_password\":\"" + newpassword + "\"}","method":"PATCH","headers": {"Authorization": m.getToken(), "Content-Type":"application/json"}});return}}}]);

Discord Friend Invite Link

`https://discord.${""}gg/${(await (webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m => m?.exports?.Z?.createFriendInvite).exports.Z.createFriendInvite()).code}`

dcfrinv

Hidden Message Copy & Paste

var visiblet = 'Your Text'
var uid = 'Id of User'

var text = `${visiblet} ||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​|||||||||||| <@${uid}>`

console.log(`Paste this message: \n${text}`)

image

No Pause on Spotify

XMLHttpRequest.prototype.realOpen = XMLHttpRequest.prototype.open;
function myOpen(method, url, async, user, password) {
  if (url == "https://api.spotify.com/v1/me/player/pause" && method == "PUT") url = "127.0.0.1";
  this.realOpen(method, url, async, user, password);
}
XMLHttpRequest.prototype.open = myOpen;

Fake Deafen/Mute

var text = new TextDecoder("utf-8");

WebSocket.prototype.original = WebSocket.prototype.send;
WebSocket.prototype.send = function(data) {
    if (Object.prototype.toString.call(data) === "[object ArrayBuffer]") {
        if (text.decode(data).includes("self_deaf")) data = data.replace('"self_mute":false', 'Raz');
    }
    WebSocket.prototype.original.apply(this, [data]);
}

More Advanced Stuff

Get Modules

var webpackExports = webpackChunkdiscord_app.push([[Math.random()],{},(e) => e])

function getModule(filter, first = true) {
  let modules = []
  function byPropsAll(...props) {
    const norm = getModule(m => props.every((prop) => typeof m[prop] !== "undefined"), false)
    let def = []
    for (const module of getModule(m => props.every((prop) => typeof m.Z?.[prop] !== "undefined"), false)) 
      def.push(module.Z)
    return [...norm, ...def]
  }
  function byDisplayName(displayName) {
    const norm = getModule(m => m.Z?.displayName === displayName, false)
    const type = getModule(m => m.Z?.type?.displayName === displayName, false)
    const rend = getModule(m => m.Z?.type?.render?.displayName === displayName, false)
    return [...norm, ...type, ...rend]
  }
  if (Array.isArray(filter)) {
    modules = byPropsAll(...filter)
  }
  else if (typeof filter === "string") {
    modules = byDisplayName(filter)
  }
  else if (typeof filter === "function") {
      for(let ite in webpackExports.c) {
      if(!Object.hasOwnProperty.call(webpackExports.c, ite)) return
      let ele = webpackExports.c[ite].exports
      if(!ele) continue
      if(filter(ele)) modules.push(ele)
    }
  }
  if (first) return modules[0]
  return modules
}

Get Authorization Header

XMLHttpRequest.prototype.wrappedSetRequestHeader = XMLHttpRequest.prototype.setRequestHeader; 

XMLHttpRequest.prototype.setRequestHeader = function(header, value) {
    this.wrappedSetRequestHeader(header, value);
    if(header == 'Authorization') 
        console.log('Here is your auth code:', value);
}

Get Your Session Id

(webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m => m?.exports?.default?.getSessionId).exports.default.getSessionId()

Discord Console Self-bot by @rigwild (Repo)

{
  var delay = ms => new Promise(res => setTimeout(res, ms))
  // prettier-ignore
  var qs = obj => Object.entries(obj).map(([k, v]) => `${k}=${v}`).join('&')

  const xSuperPropertiesObj = {
    os: 'Windows',
    browser: 'Discord Client',
    release_channel: 'stable',
    client_version: '1.0.9006',
    os_version: '10.0.22000',
    os_arch: 'x64',
    system_locale: 'en-US',
    client_build_number: 142868,
    client_event_source: null
  }

  const apiCall = (apiPath, body, method = 'GET', options = {}) => {
    if (!authHeader) throw new Error("The authorization token is missing. Did you forget to set it? `authHeader = 'your_token'`")
    const fetchOptions = {
      body: body ? body : undefined,
      method,
      headers: {
        Accept: '*/*',
        'Accept-Language': 'en-US',
        Authorization: authHeader,
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) discord/1.0.9006 Chrome/91.0.4472.164 Electron/13.6.6 Safari/537.36',
        'X-Super-Properties': btoa(JSON.stringify(xSuperPropertiesObj))
      },
      ...options
    }
    const isFormData = body?.constructor?.name === 'FormData'
    if (!isFormData) {
      fetchOptions.headers['Content-Type'] = 'application/json'
      fetchOptions.body = JSON.stringify(body)
    }
    return fetch(`https://discord.com/api/v9${apiPath}`, fetchOptions)
      .then(res => res.json().catch(() => {}))
      .catch(console.error)
  }

  var api = {
    getMessages: (channelOrThreadId, limit = 100, params = {}) => apiCall(`/channels/${channelOrThreadId}/messages?limit=${limit ?? 100}&${qs(params)}`),
    sendMessage: (channelOrThreadId, message, tts, body = {}) => apiCall(`/channels/${channelOrThreadId}/messages`, { content: message, tts: !!tts, ...body }, 'POST'),
    replyToMessage: (channelOrThreadId, repliedMessageId, message, tts, body = {}) =>
      apiCall(`/channels/${channelOrThreadId}/messages`, { content: message, message_reference: { message_id: repliedMessageId }, tts: !!tts, ...body }, 'POST'),
    editMessage: (channelOrThreadId, messageId, newMessage, body = {}) => apiCall(`/channels/${channelOrThreadId}/messages/${messageId}`, { content: newMessage, ...body }, 'PATCH'),
    deleteMessage: (channelOrThreadId, messageId) => apiCall(`/channels/${channelOrThreadId}/messages/${messageId}`, null, 'DELETE'),

    createThread: (channelId, toOpenThreadInmessageId, name, autoArchiveDuration = 1440, body = {}) =>
      apiCall(`/channels/${channelId}/messages/${toOpenThreadInmessageId}/threads`, { name, auto_archive_duration: autoArchiveDuration, location: 'Message', type: 11, ...body }, 'POST'),
    createThreadWithoutMessage: (channelId, name, autoArchiveDuration = 1440, body = {}) =>
      apiCall(`/channels/${channelId}/threads`, { name, auto_archive_duration: autoArchiveDuration, location: 'Message', type: 11, ...body }, 'POST'),
    deleteThread: threadId => apiCall(`/channels/${threadId}`, null, 'DELETE'),

    // Use this generator: https://discord.club/dashboard
    // Click `+` at the bottom in the embed section then copy the `embed` key in the JSON output.
    // Does not work with user account anymore!
    sendEmbed: (channelOrThreadId, embed = { title: 'Title', description: 'Description' }) => apiCall(`/channels/${channelOrThreadId}/messages`, { embed }, 'POST'),

    getRoles: guildId => apiCall(`/guilds/${guildId}/roles`),
    createRole: (guildId, name) => apiCall(`/guilds/${guildId}/roles`, { name }, 'POST'),
    deleteRole: (guildId, roleId) => apiCall(`/guilds/${guildId}/roles/${roleId}`, null, 'DELETE'),

    getBans: guildId => apiCall(`/guilds/${guildId}/bans`),
    banUser: (guildId, userId, reason) => apiCall(`/guilds/${guildId}/bans/${userId}`, { delete_message_days: '7', reason }, 'PUT'),
    unbanUser: (guildId, userId) => apiCall(`/guilds/${guildId}/bans/${userId}`, null, 'DELETE'),
    kickUser: (guildId, userId) => apiCall(`/guilds/${guildId}/members/${userId}`, null, 'DELETE'),

    addRole: (guildId, userId, roleId) => apiCall(`/guilds/${guildId}/members/${userId}/roles/${roleId}`, null, 'PUT'),
    removeRole: (guildId, userId, roleId) => apiCall(`/guilds/${guildId}/members/${userId}/roles/${roleId}`, null, 'DELETE'),

    auditLogs: guildId => apiCall(`/guilds/${guildId}/audit-logs`),

    getChannels: guildId => apiCall(`/guilds/${guildId}/channels`),
    createChannel: (guildId, name, type) => apiCall(`/guilds/${guildId}/channels`, { name, type }, 'POST'),
    deleteChannel: channelId => apiCall(`/channels/${channelId}`, null, 'DELETE'),
    getChannel: channelOrThreadId => apiCall(`/channels/${channelOrThreadId}`),

    pinnedMessages: channelId => apiCall(`/channels/${channelId}/pins`),
    addPin: (channelId, messageId) => apiCall(`/channels/${channelId}/pins/${messageId}`, null, 'PUT'),
    deletePin: (channelId, messageId) => apiCall(`/channels/${channelId}/pins/${messageId}`, null, 'DELETE'),

    listEmojis: guildId => apiCall(`/guilds/${guildId}/emojis`),
    getEmoji: (guildId, emojiId) => apiCall(`/guilds/${guildId}/emojis/${emojiId}`),
    createEmoji: (guildId, name, image, roles) => apiCall(`/guilds/${guildId}`, { name, image, roles }, 'POST'),
    editEmoji: (guildId, emojiId, name, roles) => apiCall(`/guilds/${guildId}/${emojiId}`, { name, roles }, 'PATCH'),
    deleteEmoji: (guildId, emojiId) => apiCall(`/guilds/${guildId}/${emojiId}`, null, 'DELETE'),

    searchSlashCommand: (channelOrThreadId, search) => apiCall(`/channels/${channelOrThreadId}/application-commands/search?type=1&query=${search}&limit=25&include_applications=true`),
    sendSlashCommand: (guildId, channelOrThreadId, command, commandOptions = []) => {
      const formData = new FormData()
      formData.append(
        'payload_json',
        JSON.stringify({
          type: 2,
          application_id: command.application_id,
          guild_id: guildId,
          channel_id: channelOrThreadId,
          session_id: 'requiredButUnchecked',
          nonce: Math.floor(Math.random() * 1000000) + '',
          data: {
            ...command,
            options: commandOptions,
            application_command: {
              ...command
            }
          }
        })
      )
      return apiCall('/interactions', formData, 'POST')
    },

    changeNick: (guildId, nick) => apiCall(`/guilds/${guildId}/members/@me/nick`, { nick }, 'PATCH'),
    leaveServer: guildId => apiCall(`/users/@me/guilds/${guildId}`, null, 'DELETE'),

    getDMs: () => apiCall(`/users/@me/channels`),
    getUser: userId => apiCall(`/users/${userId}`),

    getCurrentUser: () => apiCall('/users/@me'),
    editCurrentUser: (username, bio, body = {}) => apiCall('/users/@me', { username: username ?? undefined, bio: bio ?? undefined, ...body }, 'PATCH'),
    listCurrentUserGuilds: () => apiCall('/users/@me/guilds'),

    setCustomStatus: (emojiId, emojiName, expiresAt, text) =>
      apiCall(`/users/@me/settings`, { custom_status: { emoji_id: emojiId, emoji_name: emojiName, expires_at: expiresAt, text: text } }, 'PATCH'),
    deleteCustomStatus: () => apiCall(`/users/@me/settings`, { custom_status: { expires_at: new Date().toJSON() } }, 'PATCH'),

    listReactions: (channelOrThreadId, messageId, emojiUrl) => apiCall(`/channels/${channelOrThreadId}/messages/${messageId}/reactions/${emojiUrl}/@me`),
    addReaction: (channelOrThreadId, messageId, emojiUrl) => apiCall(`/channels/${channelOrThreadId}/messages/${messageId}/reactions/${emojiUrl}/@me`, null, 'PUT'),
    deleteReaction: (channelOrThreadId, messageId, emojiUrl) => apiCall(`/channels/${channelOrThreadId}/messages/${messageId}/reactions/${emojiUrl}/@me`, null, 'DELETE'),

    typing: channelOrThreadId => apiCall(`/channels/${channelOrThreadId}/typing`, null, 'POST'),

    delay,
    apiCall
  }

  console.log('\n\n\n\nSelfbot loaded! Use it like this: `await api.someFunction()`')
  console.log('Abusing this could get you banned from Discord, use at your own risk!')
  console.log()
  console.log(
    'This script does **not** work with bot accounts! ' +
      'If you have a bot account, use Node.js (or a proper lib like discord.js!) with the modified script ' +
      'https://github.com/rigwild/discord-self-bot-console/discussions/4#discussioncomment-1438231'
  )
  console.log()
  console.log('Use the `id()` function to update the variable `gid` guild id and `cid` channel id to what you are currently watching.')
  console.log('https://github.com/rigwild/discord-self-bot-console')

  var gid = '' // Current guild id
  var cid = '' // Current channel id

  // Call this to update `cid` and `gid` to current channel and guild id
  var id = (log = true) => {
    gid = window.location.href.split('/').slice(4)[0]
    cid = window.location.href.split('/').slice(4)[1]
    if (log) {
      console.log(`\`gid\` was set to the guild id you are currently looking at (${gid})`)
      console.log(`\`cid\` was set to the channel id you are currently looking at (${cid})`)
    }
  }
  id(false)

  // Do not replace configuration when reusing script in same context
  if (!authHeader) {
    //
    // Set your authorization token here (or use the auto update, send a message in any chat!)
    //
    var authHeader = ''
    var autoUpdateToken = true
  }

  if (!XMLHttpRequest_setRequestHeader) {
    var XMLHttpRequest_setRequestHeader = XMLHttpRequest.prototype.setRequestHeader
  }
  // Auto update the authHeader when a request with the token is intercepted
  XMLHttpRequest.prototype.setRequestHeader = function () {
    if (autoUpdateToken && arguments[0] === 'Authorization' && authHeader !== arguments[1]) {
      authHeader = arguments[1]
      console.log(`Updated the Auth token! <${authHeader.slice(0, 50)}...>`)
    }
    XMLHttpRequest_setRequestHeader.apply(this, arguments)
  }
}

Not Discord-Specific, but still useful

Design Mode

document.designMode = 'on'

Change Discord Title

var title = 'Your Title'

document.getElementsByClassName("wordmarkWindows-2dq6rw wordmark-2u86JB")[0].innerHTML = `<span style='font-size:15px'>${title}</span>`

image

Please tell me if something is broken, outdated, or if I need to add something!

Behind the Scenes and Discord Framework

Discord Token Syntax

Example
User ID Encoded in Base64NTzQvPcLBacBmgajXQc7QAaU
Dot.
Timestamp -epoch(1293840000) converted to base64XCgboz
Dot.
HMAC consiting of 27 chars (uppercase/lowercase letters, numbers, - or _)c4t51kFWSEmdmaPnKoyUuu8E78E

Diagram Version:

Discord Id Syntax

Field Bits Number of bits Description
Timestamp 63 to 22 42 bits Milliseconds since Discord Epoch, the first second of 2015 or 1420070400000.
Internal worker ID 21 to 17 5 bits
Internal process ID 16 to 12 5 bits
Increment 11 to 0 12 bits For every ID that is generated on that process, this number is incremented

How To Convert Discord ID > Date



In Javascript: new Date((id / 4194304) + 1420070400000);

function getCreationDate(id) { 
  return new Date((id / 4194304) + 1420070400000); 
}
getCreationDate("insertId")

const getTime = (id) => {
  return ((Number(BigInt.asUintN(64, id) >> 22n)) + 1420070400000) / 1000 | 0
}
getTime("instertId")

Example: new Date((622716865428324353 / 4194304) + 1420070400000);
image

Discord User Flags

Flag Bitwise Internal Name Description Public
1 1<<0 STAFF Discord Employee
2 1<<1 PARTNER Discord Partner
4 1<<2 HYPESQUAD HypeSquad Events
8 1<<3 BUG_HUNTER_LEVEL_1 Bug Hunter Level 1
16 1<<4 MFA_SMS SMS recovery for 2FA enabled
32 1<<5 PREMIUM_PROMO_DISMISSED Dismissed Nitro promotion
64 1<<6 HYPESQUAD_ONLINE_HOUSE_1 HypeSquad Online House Bravery
128 1<<7 HYPESQUAD_ONLINE_HOUSE_2 HypeSquad Online House Brilliance
256 1<<8 HYPESQUAD_ONLINE_HOUSE_3 HypeSquad Online House Balance
512 1<<9 PREMIUM_EARLY_SUPPORTER Early Supporter
1024 1<<10 TEAM_USER Team User
2048 1<<11 INTERNAL_APPLICATION An internal flag accidentally leaked to the client's private flags. Relates to partner/verification applications but nothing else is known
4096 1<<12 SYSTEM System User
8192 1<<13 HAS_UNREAD_URGENT_MESSAGES Has an unread system message
16384 1<<14 BUG_HUNTER_LEVEL_2 Bug Hunter Level 2
32768 1<<15 UNDERAGE_DELETED Pending deletion for being underage in DOB prompt
65536 1<<16 VERIFIED_BOT Verified Bot
131072 1<<17 VERIFIED_DEVELOPER Early Verified Bot Developer
262144 1<<18 CERTIFIED_MODERATOR Discord Certified Moderator
524288 1<<19 BOT_HTTP_INTERACTIONS Bot has set an interactions endpoint url
1048576 1<<20 SPAMMER User is disabled for being a spammer
2097152 1<<21 DISABLE_PREMIUM Disables Nitro Features
8589934592 1<<33 HIGH_GLOBAL_RATE_LIMIT Account has a high global ratelimit
17179869184 1<<34 DELETED Account has been deleted
34359738368 1<<35 DISABLED_SUSPICIOUS_ACTIVITY Account has been disabled for suspicious activity
68719476736 1<<36 SELF_DELETED Account was deleted by the user
137438953472 1<<37 PREMIUM_DISCRIMINATOR User has a premium discriminator
274877906944 1<<38 USED_DESKTOP_CLIENT User has used the desktop client
549755813888 1<<39 USED_WEB_CLIENT User has used the web client
1099511627776 1<<40 USED_MOBILE_CLIENT User has used the mobile client
2199023255552 1<<41 DISABLED User is currently temporarily or permanently disabled
8796093022208 1<<43 VERIFIED_EMAIL User has a verified email
17592186044416 1<<44 QUARANTINED User account is quarantined

Discord Application Flags

Name Number Description
EMBEDDED_RELEASED 2 (1 << 1) Indicates if an embedded app is available to play
MANAGED_EMOJI 4 (1 << 2) Indicates if the app has the ability to create Twitch-style emojis
GROUP_DM_CREATE 16 (1 << 4) Indicates if the app has permission to create group DMs
RPC_PRIVATE_BETA 32 (1 << 5) Allows the application to access the local RPC server
ALLOW_ASSETS 256 (1 << 8) Allows the application to create activity assets
ALLOW_ACTIVITY_ACTION_SPECTATE 512 (1 << 9) Allows the application to enable activity spectating
ALLOW_ACTIVITY_ACTION_JOIN_REQUEST 1024 (1 << 10) Allows the application to enable join requests for activities
RPC_HAS_CONNECTED 2048 (1 << 11) Indicates whether the application has accessed the local RPC server before
GATEWAY_PRESENCE 4096 (1 << 12) Intent required for bots in 100 or more servers to receive presence_update events
GATEWAY_PRESENCE_LIMITED 8192 (1 << 13) Intent required for bots in under 100 servers to receive presence_update events
GATEWAY_GUILD_MEMBERS 16384 (1 << 14) Intent required for bots in 100 or more servers to receive member-related events like guild_member_add
GATEWAY_GUILD_MEMBERS_LIMITED 32768 (1 << 15) Intent required for bots in under 100 servers to receive member-related events like guild_member_add
VERIFICATION_PENDING_GUILD_LIMIT 65536 (1 << 16) Indicates unusual growth of an app that prevents verification
EMBEDDED 131072 (1 << 17) Indicates if an app is embedded within the Discord client
GATEWAY_MESSAGE_CONTENT 262144 (1 << 18) Intent required for bots in 100 or more servers to receive message content
GATEWAY_MESSAGE_CONTENT_LIMITED 524288 (1 << 19) Intent required for bots in under 100 servers to receive message content
EMBEDDED_FIRST_PARTY 1048576 (1 << 20) Indicates a first-party embedded app
APPLICATION_COMMAND_BADGE 8388608 (1 << 23) Indicates if an app has registered global application commands

Discord Activities

MAX CONCURRENT ACTIVITIES

Guild Tier Max concurrent activities
Tier 0 2
Tier 1 3
Tier 2 5
Tier 3 Number.MAX_SAFE_INTEGER = 9007199254740991

Stable versions

Icon Application ID Application name Boost level Max participants
Icon 755600276941176913 YouTube Together (Deprecated. Replaced by 'Watch Together') 0 Unlimited
Icon 880218394199220334 Watch Together 0 Unlimited
Icon 755827207812677713 Poker Night 1 7
Icon 773336526917861400 Betrayal.io 0 Unlimited
Icon 814288819477020702 Fishington.io 0 Unlimited
Icon 832012774040141894 Chess In The Park 1 Unlimited
Icon 902271654783242291 Sketch Heads 0 16
Icon 879863686565621790 Letter League (Formerly known as 'Letter Tile') 1 8
Icon 879863976006127627 Word Snacks 0 8
Icon 852509694341283871 SpellCast 1 100
Icon 832013003968348200 Checkers In The Park (Formerly known as 'CG3 Prod'.) 1 Unlimited
Icon 832025144389533716 Blazing 8s (Formerly known as 'Ocho' & 'CG4 Prod') 1 8
Icon 945737671223947305 Putt Party 1 8
Icon 903769130790969345 Land.io 1 16
Icon 947957217959759964 Bobble League 1 8
Icon 976052223358406656 Ask Away 0 10
Icon 950505761862189096 Know What I Meme 0 8
Icon 1006584476094177371 Bash Out 1 16

Development versions

Icon Application ID Application name Boost level Max participants
Icon 763133495793942528 PN Dev 0 7
Icon 880218832743055411 Watch Together Dev 0 Unlimited
Icon 902271746701414431 Sketch Heads Dev 0 16
Icon 879863753519292467 Letter League Dev (Formerly known as 'Letter Tile Dev') 0 8
Icon 879864010126786570 Word Snacks Dev 0 32
Icon 832012586023256104 CG 2 Dev 0 Unlimited
Icon 832012682520428625 CG 3 Dev (Also known as checkers in the park) 0 Unlimited
Icon 832013108234289153 CG4 Dev 0 8
Icon 910224161476083792 Putt Party Dev 0 8

Staging versions

Icon Application ID Application name Boost level Max participants
Icon 763116274876022855 PN Staging 0 7
Icon 832012730599735326 CG2 Staging 0 Unlimited
Icon 832012938398400562 CG3 Staging 0 Unlimited
Icon 832025061657280566 CG4 Staging 0 8
Icon 893449443918086174 SpellCast Staging 0 100
Icon 945732077960188005 Putt Party Stg 0 null

QA versions

Icon Application ID Application name Boost level Max participants
Icon 801133024841957428 Poker QA 0 7
Icon 832012815819604009 CG2 QA 0 Unlimited
Icon 832012894068801636 CG 3 QA 0 Unlimited
Icon 832025114077298718 CG4 QA 0 8
Icon 945748195256979606 Putt Party QA 0 8

Unknown applications

Icon Application ID Application name Boost level Max participants
Icon 880559245471408169 iframe-playground 0 100
832025993019260929 CGSample 0 100

Deleted applications

Application ID Application name
Icon 879863881349087252
Icon 879863923543785532
Icon 878067389634314250
Icon 878067427668275241
Icon 879864070101172255
Icon 879864104980979792
Icon 891001866073296967
1006986333539029022 Clone - Watch Together
832012854282158180 Delete Me Calla (Formerly known as 'putt dis' 'click dis' and 'Putts'.)
832025179659960360 Discord Game 14
832025219526033439 Discord Game 15
832025249335738428 Discord Game 16
832025333930524692 Discord Game 17
832025385159622656 Discord Game 18
832025431280320532 Discord Game 19
832025470685937707 Discord Game 20
832025799590281238 Discord Game 21
832025857525678142 Discord Game 22
832025886030168105 Discord Game 23
832025928938946590 Discord Game 24

Discords Internal Server Structure

Check out this article about Reverse Engineering Discord, and the proof that Discord decrypts your encrypted data: https://medium.com/tenable-techblog/lets-reverse-engineer-discord-1976773f4626
They can also read your messages (e.g. in DM's), log all edits and deleted messages and record your voice calls.

Would just like to state myself that there has been multiple periods where discord hasn't been able to find edited or deleted messages
grafik

How sending Audio/Video Messages in Discord Works.

Domains

Domain Description
dis.gd Marketing URL shortener
i.dis.gd Internal URL shortener
discord.co Admin panel, internal tools
discord.com New app, marketing website, API host
discord.design Dribbble profile shortlink
discord.dev Developer site shortlinks
discord.gg Invite shortlinks, Gateway host
discord.gift Gift shortlinks
discord.gifts Another gift shortlinks domain
discord.media Voice servers
discord.new Template shortlinks
discord.store Merch store
discord.tools Internal tools
discordapp.com Old app, marketing website, and API; CDN
discordapp.net Media Proxy, Client Downloads
discordmerch.com Merch store
discordpartygames.com Voice channel activity API host
discord-activities.com Voice channel activity API host
discordactivities.com Voice channel activity data management
discordsays.com Voice channel activity host
discordstatus.com Status page

Other Domains

Domain Description
airhorn.solutions API implementation example
airhornbot.com ^
bigbeans.solutions April Fools 2017
watchanimeattheoffice.com HypeSquad form placeholder/meme

Unused Domains

Domain
discordapp.io
discordcdn.com

Discord Webpack Modules

List of Modules that are used in a bdApi plugin that requires Zere's Plugin Library

Running scripts on load/reload

If you want to automate scripts being run on load/reload head over to

%localappdata%\Discord\app-{version}\modules\discord_dispatch-1\discord_dispatch

and make a new file named

scripts.js

and insert your scripts that you want to load on discord startup/reload into that file, then add this line to the index.js file inside of the folder:

require('./scripts.js')

and then finally start up Discord and enjoy!


Raz
Experienced Programmer
Document Revised By Raz
@Raz-js
Copy link
Author

Raz-js commented Nov 9, 2022

If you have any questions, please do ask here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment