update 0.0.6.2

This commit is contained in:
HibiKi
2021-11-23 21:44:59 +08:00
parent c802dfda22
commit 3de487fb24
251 changed files with 14413 additions and 14002 deletions
+5 -5
View File
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from typing import Dict
from aiohttp.client_exceptions import ClientError
from nonebot.plugin import on_command, on_message
from nonebot.adapters.cqhttp import Bot, MessageEvent, GroupMessageEvent
from nonebot.typing import T_State
@@ -127,8 +126,8 @@ async def get_setu(bot: Bot, event: MessageEvent, state: T_State):
except IndexError:
# await bot.send(event, traceback.format_exc())
await setu.finish("参数错误")
except ClientError:
await setu.finish("连接失败")
# except ClientError:
# await setu.finish("连接失败")
pic_map: Dict[str, str] = {} # 保存这个群的其阿金一张色图 {"123456":http://xxx"}
@@ -174,7 +173,8 @@ async def handle_previous(bot: Bot, event: GroupMessageEvent, state: T_State):
idx += 1
except IndexError:
await previous.finish("参数错误")
except ClientError:
await previous.finish("连接错误")
except KeyError:
await previous.finish("没有图啊QAQ")
except Exception as e:
logger.error(f"识图未知错误 {type(e)}:{e}")
await previous.finish("未知错误...")
View File
View File
View File
View File
+1 -1
View File
@@ -79,7 +79,7 @@ async def get_pic_from_url(url: str):
data = FormData(boundary="----WebKitFormBoundaryPpuR3EZ1Ap2pXv8W")
data.add_field(name="file", value=content, content_type="image/jpeg",
filename="blob")
async with session.post("https://saucenao.com/search.php", data=data, headers=header) as res:
async with session.post("https://saucenao.com/search.php", proxy=get_local_proxy(), data=data, headers=header) as res:
html = await res.text()
image_data = [each for each in parse_html(html)]
return image_data
View File
View File