Skip to content

Instantly share code, notes, and snippets.

@v1ctorio
Created July 25, 2021 14:26
Show Gist options
  • Select an option

  • Save v1ctorio/0e16f0324e969e8c2cf55d4ad462fd77 to your computer and use it in GitHub Desktop.

Select an option

Save v1ctorio/0e16f0324e969e8c2cf55d4ad462fd77 to your computer and use it in GitHub Desktop.
How to make an youtube together invite using node-fetch
const fetch = require('node-fetch') //npm i node-fetch
const token = ""//this is your bot token, you need it to create the invite
const voiceChannelId = ""//channel's id
fetch(`https://discord.com/api/v8/channels/${voiceChannelId}/invites`, {
method: 'POST',
body: JSON.stringify({
max_age: 86400,
max_uses: 0,
target_application_id: "755600276941176913", // this is the application id of youtube
target_type: 2,
temporary: false,
validate: null
}),
headers: {
'Authorization': `Bot ${token}`,
'Content-Type': 'application/json'
}
}).then(res => res.json())
.then(invite => {
console.log(`https://discord.com/invite/${invite.code}`) //this logs the invite
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment