Created
July 25, 2021 14:26
-
-
Save v1ctorio/0e16f0324e969e8c2cf55d4ad462fd77 to your computer and use it in GitHub Desktop.
How to make an youtube together invite using node-fetch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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