diff --git a/package.json b/package.json index 451cf41..9124ccb 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ }, "dependencies": { "cheerio": "^1.0.0-rc.12", - "iqdb-client": "^1.1.0", + "iqdb-client": "^3.0.0", "nhentai-api": "^3.4.3" }, "devDependencies": { diff --git a/src/iqdb.ts b/src/iqdb.ts index 84d4d24..1f7910d 100644 --- a/src/iqdb.ts +++ b/src/iqdb.ts @@ -1,4 +1,4 @@ -import { searchPic } from 'iqdb-client' +import { searchPic, IQDB_RESULT_TYPE } from 'iqdb-client' import { Quester, segment, Session } from 'koishi' async function makeSearch(url: string): Promise { @@ -6,8 +6,9 @@ async function makeSearch(url: string): Promise { if ('err' in res) { return '搜图时遇到问题:' + res.err } else if (res.ok || (res.data && res.data.length > 1)) { - const data: any = res.data[1] - const { head, sourceUrl, img, type, source } = data + const data = res.data[1] + const { head, sourceUrl, img, source } = data + const type: IQDB_RESULT_TYPE = (data as any).type return [ segment('image', { url: 'https://iqdb.org' + img }),