Skip to content

Commit

Permalink
🐛 improve result judgement condition
Browse files Browse the repository at this point in the history
  • Loading branch information
wiseCirno committed Jul 28, 2024
1 parent 47ecd8f commit d302472
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bot/CoreFunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async def search_and_reply(url):
_search = AggregationSearch(proxy = self._proxy, cf_proxy = self._cf_proxy)
result = await _search.aggregation_search(url)

if _search.exception:
if len(_search.exception) == 2:
err_message = ''.join([f'{e}\n' for e in _search.exception])
await update.message.reply_text(err_message)
return ConversationHandler.END
Expand Down
4 changes: 2 additions & 2 deletions src/service/Search.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async def _search_with_type(self, url: str, type: str):
search = Ascii2D(base_url = base_url, client = client)
resp = await Ascii2D.search(search, file = self.media)
if not resp.raw:
raise Exception(f"No ascii2d search results for {url}")
raise Exception(f"No ascii2d search results, search url: {resp.url}")

resp_text, resp_url, _ = await search.get(resp.url.replace("/color/", "/bovw/"))
bovw_resp = Ascii2DResponse(resp_text, resp_url)
Expand All @@ -69,7 +69,7 @@ async def _search_with_type(self, url: str, type: str):
search = Iqdb(base_url = base_url, base_url_3d = base_url_3d, client = client)
resp = await Iqdb.search(search, file = self.media)
if not resp.raw:
raise Exception(f"No iqdb search results for {url}")
raise Exception(f"No iqdb search results, search url: {resp.url}")

await self._format_iqdb_result(resp)

Expand Down

0 comments on commit d302472

Please sign in to comment.