DiscordFriendInvites icon indicating copy to clipboard operation
DiscordFriendInvites copied to clipboard

😎 A simple tool for generating Discord friend invite links that allows you to send friend requests via a link.

Create a Discord Friend Invite link | DiscordFriendInvites

A simple tool for generating Discord friend invite links that allows you to send friend requests via a link.


a discord friend invite

Discord Friend Invite links, a relic of the past that Discord didn't remove. How do you generate a friend invite?
The code automatically generates a link that lasts for 168 hours and has the limit of 5 uses, afterwards using the link 1 use, it becomes expired. The cool thing is, you don't even need to accept the person's friend request, upon clicking the link, the user is automatically added as a friend without you confirming.

This is a feature of Discord, and in fact, as far as I know it's still in Discord's code. As to my knowledge, you cannot change the use or time limit on the invites, nor you can delete individual invites, only all invites at once.


How to use:

  1. Open https://discord.com/
  2. Wait until Discord is fully loaded
  3. Copy this code:
/*DiscordFriendInvites 1.0.0 by woodendoors7 */ var outputCreate,selectInvite,token,div,closeBtn,offsetLeft,offsetTop,html='\n    <div id="mainWindow">\n        <div id="header">DiscordFriendInvites<br>by woodendoors7<div id="closeBtn" class="closeButton-30b1gR" aria-label="Dismiss" role="button" tabindex="0"><svg aria-hidden="true" role="img" class="closeIcon-3eoP1e" width="18" height="18" viewBox="0 0 24 24"><path fill="currentColor" d="M18.4 4L12 10.4L5.6 4L4 5.6L10.4 12L4 18.4L5.6 20L12 13.6L18.4 20L20 18.4L13.6 12L20 5.6L18.4 4Z"></path></svg></div></div>\n        <div class="dividing">\n            <p class="sectionTitle">\n                Create Invite\n            </p>\n            <button class="fieldButton-14lHvK button-ejjZWC lookFilled-1H2Jvj colorPrimary-2-Lusz sizeSmall-3R2P2p grow-2T4nbg" id="runCreate">Do It</button>\n        </div>\n    \n        <div class="dividing">\n            <p class="sectionTitle">\n                View Invite\n            </p>\n            <select name="Select Invite" id="selectInvite">\n    \n              </select>\n    \n            <button class="sectionButton fieldButton-14lHvK button-ejjZWC lookFilled-1H2Jvj colorPrimary-2-Lusz sizeSmall-3R2P2p grow-2T4nbg" id="runInfo">View Info</button>\n        </div>\n        <div onClick="this.select();" disabled type="text" class="textOutput inputDefault-Ciwd-S input-3O04eu" id="outputCreate"><b style="margin-top: 8px;display: block;">Welcome!</b></div>\n        <button style="margin-left: 32%; margin-top: 10px;" class="sectionButton fieldButton-14lHvK button-ejjZWC lookFilled-1H2Jvj colorPrimary-2-Lusz sizeSmall-3R2P2p grow-2T4nbg" id="runDelete">Delete All Invites</button>\n        <a href="https://github.com/woodendoors7/DiscordFriendInvites"><img style="margin-top: 10px; width: 250px;" src="https://cdn.discordapp.com/attachments/1113574795540430969/1113574807611650128/pleasestar.png"></a>\n        </div>',css='#mainWindow {\n        position: absolute;\n        z-index: 9;\n        background-color:  #2F3136;\n        border: 1px solid #3f4147;\n        color: white;\n        text-align: center;\n        height: 280px;\n        width: 400px;\n        font-family: "Century Gothic", CenturyGothic, Geneva, AppleGothic, sans-serif;\n        z-index: 1000;\n        border-radius: 12px;\n    }\n    \n    #header {\n        padding: 10px;\n        cursor: move;\n        z-index: 10;\n        background-color: #5865F2;\n        color: #ffe8e9;\n        user-select: none;\n        font-weight: bold;\n        border-top-left-radius:12px;\n        border-top-right-radius: 12px;\n\n    }\n    \n    .dividing {\n        background-color: #2F3136;\n        width: 100%;\n        height: 50px;\n        text-align: left;\n        vertical-align: middle;\n        white-space: nowrap;\n        line-height: 50px;\n    }\n    \n    .sectionTitle {\n        vertical-align: middle;\n        margin: 0px;\n        font-size: 18px;\n        margin-left: 15px;\n    }\n    \n    .sectionButton {\n        vertical-align: middle;\n    }\n    \n    .dividing * {\n        display: inline;\n    }\n    \n    .textOutput {\n        max-width: 93%;\n        min-height: 16px;\n        cursor: text;\n        margin-left: 10px;\n        user-select: all;\n        padding: 3px;\n        text-align: center;\n        margin-left: 10px;\n    }';async function inject(){var e=document.createElement("div");e.innerHTML=html,e.innerHTML+=`\n\n<style>${css}</style>`,document.body.appendChild(e),(div=document.getElementById("mainWindow")).style.top="100px",div.style.left="100px",window.addEventListener("mousemove",divMove,!0),document.getElementById("header").addEventListener("mousedown",mouseDown,!1),window.addEventListener("mouseup",mouseUp,!1),document.getElementById("runCreate").addEventListener("click",createElement),document.getElementById("runInfo").addEventListener("click",checkTheInfo),document.getElementById("runDelete").addEventListener("click",deleteInvites),closeBtn=document.getElementById("closeBtn"),outputCreate=document.getElementById("outputCreate"),selectInvite=document.getElementById("selectInvite"),expireAfterCreate=document.getElementById("expireAfterCreate"),maxUsesCreate=document.getElementById("maxUsesCreate"),closeBtn.addEventListener("click",uninject),token=await getToken(),outputCreate.innerHTML='<b style="margin-top: 8px;display: block;">Welcome!</b>',fetchInvites(!1)}async function createElement(){outputCreate.innerHTML='<b style="margin-top: 8px;display: block;">Loading . . .</b>';let e=await fetch("https://discord.com/api/v9/users/@me/invites",{credentials:"include",headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; rv:103.0) Gecko/20100101 Firefox/103.0",Accept:"*/*","Accept-Language":"en,sk;q=0.8,cs;q=0.5,en-US;q=0.3","Content-Type":"application/json",Authorization:token,"X-Discord-Locale":"en-US","X-Debug-Options":"bugReporterEnabled","Sec-Fetch-Dest":"empty","Sec-Fetch-Mode":"cors","Sec-Fetch-Site":"same-origin","Sec-GPC":"1"},referrer:"https://discord.com/channels/@me",body:"{}",method:"POST",mode:"cors"}),t=await e.json();outputCreate.innerHTML=`<b style="margin-top: 8px;display: block;">https://discord.gg/${t.code}</b>`,"No Invites"==selectInvite.firstChild.innerText&&(selectInvite.innerHTML="");let n=document.createElement("option");n.value=t.code,n.innerText=`discord.gg/${t.code}`,selectInvite.appendChild(n)}async function fetchInvites(e){let t=await fetch("https://discord.com/api/v9/users/@me/invites",{credentials:"include",headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; rv:103.0) Gecko/20100101 Firefox/103.0",Accept:"*/*","Accept-Language":"en,sk;q=0.8,cs;q=0.5,en-US;q=0.3","Content-Type":"application/json",Authorization:token,"X-Discord-Locale":"en-US","X-Debug-Options":"bugReporterEnabled","Sec-Fetch-Dest":"empty","Sec-Fetch-Mode":"cors","Sec-Fetch-Site":"same-origin","Sec-GPC":"1"},referrer:"https://discord.com/channels/@me",method:"GET",mode:"cors"}),n=await t.json();if(selectInvite.innerHTML="",0==n.length){let e=document.createElement("option");return e.value="none",e.innerText="No Invites",selectInvite.appendChild(e),n}for(let e=0;e<n.length;e++){let t=document.createElement("option");t.value=n[e].code,t.innerText=`discord.gg/${n[e].code}`,selectInvite.appendChild(t)}if(1==e)return n}async function checkTheInfo(){let e=selectInvite.value;outputCreate.innerHTML='<b style="margin-top: 8px;display: block;">Loading . . .</b>';let t,n=await fetchInvites(!0);for(let i=0;i<n.length;i++)n[i].code==e&&(t=n[i]);outputCreate.innerHTML=t?`<b>Uses:</b> ${t.uses}/${t.max_uses}, <b>Expires in:</b> ${Math.round(t.max_age/60/60)} hours,</br> <i>https://discord.gg/${t.code}</i>`:"Invite not found!"}async function deleteInvites(){await fetch("https://discord.com/api/v9/users/@me/invites",{credentials:"include",headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; rv:103.0) Gecko/20100101 Firefox/103.0",Accept:"*/*","Accept-Language":"en,sk;q=0.8,cs;q=0.5,en-US;q=0.3","Content-Type":"application/json",Authorization:token,"X-Discord-Locale":"en-US","X-Debug-Options":"bugReporterEnabled","Sec-Fetch-Dest":"empty","Sec-Fetch-Mode":"cors","Sec-Fetch-Site":"same-origin","Sec-GPC":"1"},referrer:"https://discord.com/channels/@me",method:"DELETE",mode:"cors"});selectInvite.innerHTML="";let e=document.createElement("option");e.value="none",e.innerText="No Invites",selectInvite.appendChild(e),outputCreate.innerHTML='<b style="margin-top: 8px;display: block;">Invites deleted</b>'}"complete"===document.readyState&&inject();var clicked=!1;async function mouseUp(){clicked=!1}async function mouseDown(e){clicked=!0,offsetLeft=div.offsetLeft-e.clientX,offsetTop=div.offsetTop-e.clientY}function divMove(e){clicked&&(div.style.position="absolute",div.style.top=e.clientY+offsetTop+"px",div.style.left=e.clientX+offsetLeft+"px")}async function getToken(){return outputCreate.innerHTML='<b style="margin-top: 8px;display: block;">Getting token...</b>',await(webpackChunkdiscord_app.push([[""],{},e=>{m=[];for(let t in e.c)m.push(e.c[t])}]),m).find((e=>void 0!==e?.exports?.default?.getToken)).exports.default.getToken()}async function uninject(){window.removeEventListener("mousemove"),document.getElementById("header").removeEventListener("mousedown"),window.removeEventListener("mouseup"),document.getElementById("mainWindow").remove(),inject=null,createElement=null,inject=null,fetchInvites=null,checkTheInfo=null,deleteInvites=null,removeEventListener("mouseMove",window)}console.log("Hello!");

(or copy it from inject.js)

  1. Open Developer Tools with F12 or CTRL+Shift+I in your browser
  2. Click on "Console" in the top menu of DevTools (ignore all the scary warnings)
  3. Paste the code into the console (The browser might prompt you to type "allow pasting", or something similiar.)
  4. A window will open up. Click "Do it" next to "Create Invite"
  5. Wait until the link is generated and send it to someone that isn't friends with you. That's it!
Image of the Friend invite sent to an already added friend on iOS