diff options
author | Kyomotoi <[email protected]> | 2020-11-22 01:01:43 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2020-11-22 01:01:43 +0800 |
commit | f7198e8722f310926cf147bd0b218c5d9ef5d6c3 (patch) | |
tree | f4c3d0f2a003695b67e0e2018ec8d88898bcda90 /ATRI/plugins/plugin_sqlite | |
parent | 6c3e4c7f583be0006cd7bb913b7db81b987d2813 (diff) | |
download | ATRI-f7198e8722f310926cf147bd0b218c5d9ef5d6c3.tar.gz ATRI-f7198e8722f310926cf147bd0b218c5d9ef5d6c3.tar.bz2 ATRI-f7198e8722f310926cf147bd0b218c5d9ef5d6c3.zip |
[Update]
新增:
* 舆情检测
* 对涩图加以调用限制
修复:
* Pixiv插件全体
* 储存群聊信息时无法创建文件
优化:
* 部分代码重构,效率up
* 调整插件结构,使其看起来更舒服
Diffstat (limited to 'ATRI/plugins/plugin_sqlite')
-rw-r--r-- | ATRI/plugins/plugin_sqlite/__init__.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/ATRI/plugins/plugin_sqlite/__init__.py b/ATRI/plugins/plugin_sqlite/__init__.py index a1208f1..45c33da 100644 --- a/ATRI/plugins/plugin_sqlite/__init__.py +++ b/ATRI/plugins/plugin_sqlite/__init__.py @@ -14,18 +14,18 @@ import os import json import sqlite3 from pathlib import Path +from nonebot.typing import Bot, Event from aiohttp import client_exceptions from nonebot.plugin import on_command from nonebot.permission import SUPERUSER -from nonebot.adapters.cqhttp import Bot, Event -from utils.utils_error import errorRepo -from utils.utils_request import aio_get_bytes +from ATRI.utils.utils_error import errorRepo +from ATRI.utils.utils_request import aio_get_bytes SetuData = on_command('setu', permission=SUPERUSER) [email protected]() # type: ignore async def _(bot: Bot, event: Event, state: dict) -> None: msg0 = "-==ATRI Setu Data System==-\n" msg0 += "Upload:\n" @@ -39,7 +39,7 @@ async def _(bot: Bot, event: Event, state: dict) -> None: UploadSetu = on_command('setu-upload', permission=SUPERUSER) [email protected]() # type: ignore async def _(bot: Bot, event: Event, state: dict) -> None: msg = str(event.message).strip().split(' ') @@ -72,10 +72,11 @@ async def _(bot: Bot, event: Event, state: dict) -> None: name = info["user"]["name"] u_id = info["user"]["id"] user_link = f'https://www.pixiv.net/users/{u_id}' - img = f'https://pixiv.cat/{pid}.jpg' + IMG = info["iamge_urls"]["large"] + IMG = IMG.replace("i.pximg.net", "i.pixiv.cat") data_setu = (f'{pid}', f'{title}', f'{tags}', f'{account}', f'{name}', - f'{u_id}', f'{user_link}', f'{img}') + f'{u_id}', f'{user_link}', f'{IMG}') if s_type == "nearr18": s_type = "nearR18" @@ -84,6 +85,8 @@ async def _(bot: Bot, event: Event, state: dict) -> None: else: pass + os.makedirs('ATRI/data/data_Sqlite/setu', exist_ok=True) + if os.path.exists(f'ATRI/data/data_Sqlite/setu/{s_type}.db'): print('数据文件存在!') else: @@ -114,7 +117,7 @@ async def _(bot: Bot, event: Event, state: dict) -> None: DeleteSetu = on_command('setu-delete', permission=SUPERUSER) [email protected]() # type: ignore async def _(bot: Bot, event: Event, state: dict) -> None: msg = str(event.message).strip().split(' ') |