Skip to content

Instantly share code, notes, and snippets.

@oSumAtrIX
Last active May 11, 2026 13:23
Show Gist options
  • Select an option

  • Save oSumAtrIX/8c0540c80ca2b91efa18d137e239570f to your computer and use it in GitHub Desktop.

Select an option

Save oSumAtrIX/8c0540c80ca2b91efa18d137e239570f to your computer and use it in GitHub Desktop.
Useful snippets for Discord

Discord console scripts

My collection of scripts for Discord.

Scripts

  • friend_invitelink.js: Generate a friend invite link
  • clientside_nitro.js: Spoof the client and enable client side Discord Nitro
webpackChunkdiscord_app.push([[[Math.random()]],{},q=>Object.values(q.c).find(e=>e.exports?.default?.getCurrentUser).exports.default.getCurrentUser().premiumType=2])
@kylianpl

kylianpl commented Feb 22, 2023

Copy link
Copy Markdown

it seems useless to send a request manually now, i just tried and it still expires after 1 week or 5 max uses

@RedBoardDev

Copy link
Copy Markdown

What have you try the put on the body ?

@kylianpl

Copy link
Copy Markdown

it seems to ignore input or use input that i don't know of (add me as friend https://discord.gg/77rPTQTs if you want to talk more or ask me questions)

@RobinRMC

RobinRMC commented Apr 6, 2023

Copy link
Copy Markdown

This code doesn't work anymore, does it?

@XplosiON1232

Copy link
Copy Markdown

This code doesn't work anymore, does it?

nope :(

@B-rancher

Copy link
Copy Markdown

anyone know why they got rid of it? it was so cool

@yumiruuwu

Copy link
Copy Markdown

anyone know why they got rid of it? it was so cool

They didn't get rid of it. If you want to use it, Vencord has a plugin that allows you to create friend invites. But still expire after 5 uses or a week.

@002-sans

Copy link
Copy Markdown

I saw that feature on discord.js-selfbot-v13 module, idk if that can help somebody xD

https://discordjs-self-v13.netlify.app/#/docs/docs/main/class/ClientUser?scrollTo=createFriendInvite

@RedBoardDev

Copy link
Copy Markdown

I saw that feature on discord.js-selfbot-v13 module, idk if that can help somebody xD

https://discordjs-self-v13.netlify.app/#/docs/docs/main/class/ClientUser?scrollTo=createFriendInvite

Oh thanks !
`void async function () {
const { createFriendInvite } = webpackChunkdiscord_app.push([[Symbol()], {}, req => (
Object.values(req.c).find(m => m?.exports?.Z?.createFriendInvite)
)]).exports.Z;

// Prevent memory leak
webpackChunkdiscord_app.pop();

console.log(Friend invite: https://discord.gg/${(await createFriendInvite()).code});
}();` works if you send that on the console of discord.com/app
But I can't find something to use on a javascript script :(

@RedBoardDev

Copy link
Copy Markdown

and for this code:
client.user.createFriendInvite() .then(console.log) .catch(console.error);

It's work. But you can be banned of discord x': Use a self-bot is not allow by discord.
And the link create by this code can be use just once. I've search how to change that but I've not found... If someone as an idea I'm here ;)

ghost commented Jun 23, 2023

Copy link
Copy Markdown

does anyone know how createFriendInvite() even works? I'm thinking maybe there might be parameters we could put in and since we're not doing that it just defaults to 5 uses and expiry after a week

@RedBoardDev

RedBoardDev commented Aug 13, 2023

Copy link
Copy Markdown

Hi ! I'm coming with news.
Actually, it's no longer possible to do like before with the link discord.gg like server invitation.
Like I said before (May 29), you still can create a self-bot and create link with this code:
client.user.createFriendInvite() .then(console.log) .catch(console.error);

But I've found nothing to change settings, so it's 5 person per link and expire after 1 week.
Self-bot aren't allowed by discord, so be careful with that.

BUUUT, I have find an another way !
You can do the link with 'https://discord.com/users/USER_iD'. For example with mine: https://discord.com/users/419926802366988292
You can see how that is on my github profil.
You directly have the profil of the person like in discord so its nice too ;)

@RobinRMC

Copy link
Copy Markdown

It's still possible by using client mods like BetterDiscord or Vencord.

@dgxo

dgxo commented Aug 16, 2023

Copy link
Copy Markdown

I modified some of the code RedBoardDev to work, and it works consistently. Enter this into your browser/discord dev tools console and it will give you a new invite code in an alert.

const { createFriendInvite } = webpackChunkdiscord_app.push([[Symbol()], {}, req => (
  Object.values(req.c).find(m => m?.exports?.Z?.createFriendInvite)
)]).exports.Z;
webpackChunkdiscord_app.pop();
let msg = `Here's your friend invite: https://discord.gg/${(await createFriendInvite()).code}`;
console.log(msg);
alert(msg);
return(msg);

Shorter version:

(async function(){const { createFriendInvite: a } = webpackChunkdiscord_app.push([[Symbol()], {}, (req) => Object.values(req.c).find((m) => m?.exports?.Z?.createFriendInvite)]).exports.Z;webpackChunkdiscord_app.pop();let m = `Here's your friend invite: https://discord.gg/${(await a()).code}`;alert(m);})()

If it's easier, you can even make a bookmark(let) with this as the contents:

javascript:(async function(){const { createFriendInvite: a } = webpackChunkdiscord_app.push([[Symbol()], {}, (req) => Object.values(req.c).find((m) => m?.exports?.Z?.createFriendInvite)]).exports.Z;webpackChunkdiscord_app.pop();let m = `Here's your friend invite: https://discord.gg/${(await a()).code}`;console.log(m);alert(m);return m;})()

@veraci-ty

Copy link
Copy Markdown

Hi ! I'm coming with news. Actually, it's no longer possible to do like before with the link discord.gg like server invitation. Like I said before (May 29), you still can create a self-bot and create link with this code: client.user.createFriendInvite() .then(console.log) .catch(console.error);

But I've found nothing to change settings, so it's 5 person per link and expire after 1 week. Self-bot aren't allowed by discord, so be careful with that.

BUUUT, I have find an another way ! You can do the link with 'https://discord.com/users/USER_iD'. For example with mine: https://discord.com/users/419926802366988292 You can see how that is on my github profil. You directly have the profil of the person like in discord so its nice too ;)

Unfortunately this only works if you have a mutual server with the person in question.

@NightMean

Copy link
Copy Markdown

Here's a patched version that works for now, it will log the invite link to the console.

webpackChunkdiscord_app.push([
    [Symbol()], {},
    async r => r?.c && console.log('https://discord.gg/' + (await Object.values(r.c).find(a => a.exports?.default?.createFriendInvite).exports.default.createFriendInvite()).code)
]);
!!webpackChunkdiscord_app.pop();

Minified:

webpackChunkdiscord_app.push([[Symbol()],{},async e=>e?.c&&console.log("discord.gg/"+(await Object.values(e.c).find(e=>e.exports?.default?.createFriendInvite).exports.default.createFriendInvite()).code)]);!!webpackChunkdiscord_app.pop();

Thanks, this worked like a charm!

@SwiftWinds

Copy link
Copy Markdown

Here's a patched version that works for now, it will log the invite link to the console.

webpackChunkdiscord_app.push([
    [Symbol()], {},
    async r => r?.c && console.log('https://discord.gg/' + (await Object.values(r.c).find(a => a.exports?.default?.createFriendInvite).exports.default.createFriendInvite()).code)
]);
!!webpackChunkdiscord_app.pop();

Minified:

webpackChunkdiscord_app.push([[Symbol()],{},async e=>e?.c&&console.log("discord.gg/"+(await Object.values(e.c).find(e=>e.exports?.default?.createFriendInvite).exports.default.createFriendInvite()).code)]);!!webpackChunkdiscord_app.pop();

Does this have an expiry? Or a max uses? I prefer no expiry and no max uses.

@LestAndrea

Copy link
Copy Markdown

Here's a patched version that works for now, it will log the invite link to the console.

webpackChunkdiscord_app.push([
    [Symbol()], {},
    async r => r?.c && console.log('https://discord.gg/' + (await Object.values(r.c).find(a => a.exports?.default?.createFriendInvite).exports.default.createFriendInvite()).code)
]);
!!webpackChunkdiscord_app.pop();

Minified:

webpackChunkdiscord_app.push([[Symbol()],{},async e=>e?.c&&console.log("discord.gg/"+(await Object.values(e.c).find(e=>e.exports?.default?.createFriendInvite).exports.default.createFriendInvite()).code)]);!!webpackChunkdiscord_app.pop();

will the link expire?

@RedBoardDev

Copy link
Copy Markdown

yep same question here ! I'm looking for the response and found nothing about that

@RedBoardDev

Copy link
Copy Markdown

thanks for your patch ! so sad that it's just for 7 days or 5 uses...

@Happypig375

Happypig375 commented Dec 3, 2024

Copy link
Copy Markdown

Please, you don't need to paste any code in your console for friend invites.
image

@RobinRMC

RobinRMC commented Dec 4, 2024

Copy link
Copy Markdown

Please, you don't need to paste any code in your console for friend invites. image

You're using a Vencord plugin. :/

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