debug log balabola output and bundle script
This commit is contained in:
parent
3025421e34
commit
bb8a0eb761
|
@ -6,6 +6,7 @@
|
|||
"scripts": {
|
||||
"dev": "nodemon",
|
||||
"build": "rm -rf ./dist && tsc --noEmit && NODE_ENV=production etsc",
|
||||
"bundle": "npm run build && tar -czvf balabola.tar.gz .env -C dist .",
|
||||
"start": "node dist/index.js"
|
||||
},
|
||||
"keywords": [],
|
||||
|
@ -28,4 +29,4 @@
|
|||
"nodemon": "^2.0.20",
|
||||
"typescript": "^4.8.4"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
import { fetch } from 'undici';
|
||||
import { logger } from './logger';
|
||||
|
||||
interface BalabolaResponse {
|
||||
bad_query: number,
|
||||
|
@ -25,6 +26,8 @@ export async function balabola(query: string, intro: number): Promise<string> {
|
|||
})
|
||||
}).then(res => res.json()) as BalabolaResponse;
|
||||
|
||||
logger.debug(result);
|
||||
|
||||
if (result.bad_query === 1) throw new BalabolaError('bad query');
|
||||
|
||||
return result.text;
|
||||
|
|
Loading…
Reference in New Issue