Handle finished crafting messages in backend

master
sigonasr2 2 years ago
parent 0842aaa410
commit c9e953f48b
  1. 4
      server.js

@ -100,7 +100,7 @@ app.post("/updateItem",(req,res)=>{
icon_url:itemIcon
},
color:req.body.obtained==req.body.required?32768:Number(req.body.obtained)>0?20680:2172201,
description:"**"+req.body.username+"** "+(req.body.operation==="FINISH"?" has finished collecting "+req.body.required+" __"+req.body.item_name+"__!":
description:"**"+req.body.username+"** "+(req.body.operation==="FINISH"?" has finished "+(req.body.finalcraft===true?"crafting ":"collecting ")+req.body.required+" __"+req.body.item_name+"__!":
req.body.operation==="INCREASE"?" has collected "+req.body.obtained+" / "+req.body.required+" __"+req.body.item_name+"__ (+"+(req.body.obtained-req.body.previous_amt)+")"
:" has set __"+req.body.item_name+"__ to "+req.body.obtained+" / "+req.body.required)+"\n\n[Sig Planner - Sig crafts all the things](http://projectdivar.com:3001)",
footer:{
@ -109,7 +109,7 @@ app.post("/updateItem",(req,res)=>{
}]
})})
.then((data)=>{
return db.query("insert into audit_log(username,obtained,required,item_name,operation,date,previous_amt) values($1,$2,$3,$4,$5,$6,$7)",[req.body.username,req.body.obtained,req.body.required,req.body.item_name,req.body.operation,req.body.last_modified,req.body.previous_amt])
return db.query("insert into audit_log(username,obtained,required,item_name,operation,date,previous_amt) values($1,$2,$3,$4,$5,$6,$7)",[req.body.username,req.body.obtained,req.body.required,req.body.item_name,req.body.operation==="FINISH"&&req.body.finalcraft===true?"FINISH_CRAFT":req.body.operation,req.body.last_modified,req.body.previous_amt])
})
.then((data)=>{
res.status(200).send("Yay!")

Loading…
Cancel
Save