diff --git a/package.json b/package.json index 45909ca..8cf8add 100644 --- a/package.json +++ b/package.json @@ -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" } -} +} \ No newline at end of file diff --git a/src/balabola_api.ts b/src/balabola_api.ts index f6ea3ee..7637f48 100644 --- a/src/balabola_api.ts +++ b/src/balabola_api.ts @@ -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 { }) }).then(res => res.json()) as BalabolaResponse; + logger.debug(result); + if (result.bad_query === 1) throw new BalabolaError('bad query'); return result.text;