Closed ronnygunawan closed 3 years ago
Code snippets for bypassing carbon.now.sh
's API.
// https://github.com/sindresorhus/got
import got from 'got';
import beautify from 'js-beautify';
/**
* Generates image from code
* @param {String} code
* @param {String} extension something like js ts or anything to signify the file name
* @returns {Promise<Buffer>}
*/
async function generateImage(code) {
const carbon = await got.post('https://carbonara.vercel.app/api/cook', {
json: { code: beautify.js(code) },
responseType: 'buffer',
headers: {
'User-Agent': 'Teknologi Umum <teknologi.umum@gmail.com>',
'Content-Type': 'application/json',
},
});
// return carbon variable
}
Kirim di private chat:
Bot akan bikinin carbon