debug log balabola output and bundle script

This commit is contained in:
2022-10-20 20:12:31 +03:00
parent 3025421e34
commit bb8a0eb761
2 changed files with 5 additions and 1 deletions

View File

@ -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;