This commit is contained in:
derpystuff 2022-06-17 22:36:10 +02:00
parent c25e876962
commit 128369350f
24 changed files with 17 additions and 45 deletions

View file

@ -22,19 +22,20 @@ async function fetchImage(url) {
}
async function processMakesweet(effect, args, image) {
if(!effects[effect.toLowerCase()]) throw "Invalid Effect"
try{
if(image){
image = await fetchImage(image)
if(!image) throw "Unable to fetch image"
let res = await superagent.post(`http://api.makesweet.com/make/${effect}`)
let res = await superagent.post(`http://api.makesweet.com/make/${effect.toLowerCase()}`)
.set("Authorization", process.env.makesweet)
.buffer(true)
.query(args)
.attach('image', image, 'image.png')
return res;
}
let res = await superagent.post(`http://api.makesweet.com/make/${effect}`)
let res = await superagent.post(`http://api.makesweet.com/make/${effect.toLowerCase()}`)
.set("Authorization", process.env.makesweet)
.buffer(true)
.query(args)