change psql-lib from knex to postgres.js
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { promises as fs } from "fs";
|
||||
import sql from "../sql.mjs";
|
||||
import db from "../sql.mjs";
|
||||
|
||||
export default async bot => {
|
||||
|
||||
@@ -14,14 +14,22 @@ export default async bot => {
|
||||
if(id <= 0)
|
||||
return false;
|
||||
|
||||
const f0ck = await sql("items").select("dest").where("id", id).limit(1);
|
||||
const f0ck = await db`
|
||||
select dest
|
||||
from "items"
|
||||
where id = ${+id}
|
||||
limit 1
|
||||
`;
|
||||
if(f0ck.length === 0)
|
||||
return false;
|
||||
|
||||
await fs.unlink(`./public/b/${f0ck[0].dest}`).catch(_=>{});
|
||||
await fs.unlink(`./public/t/${id}`).catch(_=>{});
|
||||
|
||||
await sql("items").where("id", id).del().limit(1);
|
||||
await db`
|
||||
delete from "items"
|
||||
where id = ${+id}
|
||||
`;
|
||||
|
||||
return id;
|
||||
}))).filter(d => d);
|
||||
|
||||
Reference in New Issue
Block a user