Created
March 19, 2021 17:38
-
-
Save Sascha-T/0f43f1dfda0617b0fb1e894368e398af to your computer and use it in GitHub Desktop.
Discord Activities Social Thing
This file contains 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
{ | |
"name": "activity-test", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"commander": "^7.1.0", | |
"node-fetch": "^2.6.1" | |
} | |
} |
This file contains 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
// Stealy wheely: https://github.com/advaith1/activities/blob/main/src/bot.ts | |
let fetch = require("node-fetch") | |
const { program } = require('commander'); | |
program.version("1.0.0") | |
program | |
.requiredOption('-c <CHANNEL>', 'Voice Channel ID') | |
.requiredOption('-t <TOKEN>', 'Client Token') | |
.option('-a <APPLICATION>', 'Application ID', 755600276941176913) | |
program.parse(process.argv); | |
const options = program.opts(); | |
console.log(options) | |
async function main() { | |
const r = await fetch(`https://discord.com/api/v8/channels/${options.c}/invites`, { | |
method: 'POST', | |
headers: { authorization: `${options.t}`, 'content-type': 'application/json' }, | |
body: JSON.stringify({ | |
max_age: 0, | |
target_type: 2, | |
target_application_id: options.a | |
}) | |
});//*/ | |
let text = await r.json(); | |
console.log(text.code) | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment