Skip to content

Commit

Permalink
🐛 add missed worker argument
Browse files Browse the repository at this point in the history
  • Loading branch information
wiseCirno committed Jul 28, 2024
1 parent 74e23ba commit 9993b67
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
9 changes: 2 additions & 7 deletions bot/CoreFunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,13 @@ async def search_and_reply(url):
_search = AggregationSearch(proxy = self._proxy, cf_proxy = self._cf_proxy)
result = await _search.aggregation_search(url)

if len(_search.exception) == 3:
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

if not result:
_url = _search.google_result['url']
_reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("URL", url=_url)]])
await update.message.reply_markdown(
f"没有发现准确搜索结果[😿]({_url}), 此结果并不可靠",
reply_markup = _reply_markup
)
await update.message.reply_text("没有发现准确搜索结果😿")
return ConversationHandler.END

_message = f"[🖼️]({result['url']}) Gacha (>ワ<) [😼]({result['thumbnail']})"
Expand Down
2 changes: 1 addition & 1 deletion bot/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async def error_handler(_, context: ContextTypes.DEFAULT_TYPE):
neko_chan.add_handler(CommandHandler("start", Basic.introduce))
neko_chan.add_handler(CommandHandler("help", Basic.instructions))

pandora = PandoraBox(proxy = proxy)
pandora = PandoraBox(proxy = proxy, cf_proxy = worker_proxy)
auto_parse_reply = CommandHandler(
command = ["hug", "cuddle", "kiss", "snog", "pet"],
callback = pandora.auto_parse_reply,
Expand Down
4 changes: 2 additions & 2 deletions src/service/Search.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ async def google_search(self, url):
self.exception.append(e)

async def aggregation_search(self, url: str) -> Optional[Dict]:
tasks = [self.iqdb_search(url), self.ascii2d_search(url), self.google_search(url)]
tasks = [self.iqdb_search(url), self.ascii2d_search(url)]
await asyncio.gather(*tasks)

return self.ascii2d_result if self.ascii2d_result else self.iqdb_result
return self.iqdb_result if self.iqdb_result else self.ascii2d_result

0 comments on commit 9993b67

Please sign in to comment.