summaryrefslogtreecommitdiff
path: root/ATRI/plugins/setu/__init__.py
diff options
context:
space:
mode:
authorKyomotoi <[email protected]>2021-10-01 08:56:42 +0800
committerKyomotoi <[email protected]>2021-10-01 08:56:42 +0800
commit844bd56a5bed1293329299c8b0562558a0d2d907 (patch)
tree0b121b4e85b42e9a83dd65639013215272bb6527 /ATRI/plugins/setu/__init__.py
parenta00308d801a0ce13f0f19f6c3984bbbe2e09f57b (diff)
downloadATRI-844bd56a5bed1293329299c8b0562558a0d2d907.tar.gz
ATRI-844bd56a5bed1293329299c8b0562558a0d2d907.tar.bz2
ATRI-844bd56a5bed1293329299c8b0562558a0d2d907.zip
🐛⚡️🔥 更新
修复: - `setu`、`saucenao`搜图时失败报错 更新: - 弃用`aiohttp`,改用`httpx` 删除: - 临时删除暂未完成的`console`
Diffstat (limited to 'ATRI/plugins/setu/__init__.py')
-rw-r--r--ATRI/plugins/setu/__init__.py33
1 files changed, 23 insertions, 10 deletions
diff --git a/ATRI/plugins/setu/__init__.py b/ATRI/plugins/setu/__init__.py
index d67d75b..eec5281 100644
--- a/ATRI/plugins/setu/__init__.py
+++ b/ATRI/plugins/setu/__init__.py
@@ -25,10 +25,15 @@ async def _random_setu(bot: Bot, event: MessageEvent):
if not _setu_dlmt.check(user_id):
await random_setu.finish()
- setu, title, p_id = await Setu().random_setu()
- repo = f"Title: {title}\n" f"Pid: {p_id}"
+ repo, setu = await Setu().random_setu()
await bot.send(event, repo)
- msg_1 = await bot.send(event, Message(setu))
+
+ msg_1 = dict()
+ try:
+ msg_1 = await bot.send(event, Message(setu))
+ except Exception:
+ await random_setu.finish("hso(发不出")
+
event_id = msg_1["message_id"]
_setu_flmt.start_cd(user_id)
_setu_dlmt.increase(user_id)
@@ -50,13 +55,18 @@ async def _tag_setu(bot: Bot, event: MessageEvent):
msg = str(event.message).strip()
pattern = r"来[张点丶份](.*?)的[涩色🐍]图"
tag = re.findall(pattern, msg)[0]
- setu, title, p_id, is_ok = await Setu().tag_setu(tag)
- if not is_ok:
- await tag_setu.finish(f"没有 {tag} 的涩图呢...")
- repo_0 = f"Title: {title}\n" f"Pid: {p_id}"
+ repo, setu = await Setu().tag_setu(tag)
+ if not setu:
+ await tag_setu.finish(repo)
+
+ await bot.send(event, repo)
+
+ msg_1 = dict()
+ try:
+ msg_1 = await bot.send(event, Message(setu))
+ except Exception:
+ await random_setu.finish("hso(发不出")
- await bot.send(event, repo_0)
- msg_1 = await bot.send(event, Message(setu))
event_id = msg_1["message_id"]
_setu_flmt.start_cd(user_id)
_setu_dlmt.increase(user_id)
@@ -71,10 +81,13 @@ async def _scheduler_setu(bot):
lucky_group = choice(group_list)
group_id = lucky_group["group_id"]
setu = await Setu().scheduler()
+ if not setu:
+ return
+
msg_0 = await bot.send_group_msg(group_id=int(group_id), message=Message(setu))
message_id = msg_0["message_id"]
await asyncio.sleep(60)
await bot.delete_msg(message_id=message_id)
- except BaseException:
+ except Exception:
pass