summaryrefslogtreecommitdiff
path: root/ATRI/plugins/Check.py
diff options
context:
space:
mode:
Diffstat (limited to 'ATRI/plugins/Check.py')
-rw-r--r--ATRI/plugins/Check.py96
1 files changed, 37 insertions, 59 deletions
diff --git a/ATRI/plugins/Check.py b/ATRI/plugins/Check.py
index 9d0bbb2..9a39470 100644
--- a/ATRI/plugins/Check.py
+++ b/ATRI/plugins/Check.py
@@ -1,10 +1,8 @@
import json
import time
import sqlite3
-from nonebot import session
import psutil
from pathlib import Path
-from datetime import datetime
import nonebot
from nonebot import on_command, CommandSession
@@ -19,63 +17,43 @@ file1 = Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobGroup.json'
@on_command('data_list', aliases = ['数据总量'], only_to_me = False)
async def _(session: CommandSession):
- user = session.event.user_id
- group = session.event.group_id
- try:
- with open(file1, 'r') as f:
- data = json.load(f)
- except:
- data = {}
-
- try:
- with open(file, 'r') as f:
- data1 = json.load(f)
- except:
- data1 = {}
-
- if str(group) in data.keys():
- pass
- else:
- if str(user) in data1.keys():
- pass
- else:
- con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'normal.db') # setu-normal
- cur = con.cursor()
- cur.execute("select * from normal")
- data_normal = len(cur.fetchall())
- con.close()
-
- con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'nearR18.db') # setu-nearR18
- cur = con.cursor()
- cur.execute("select * from nearR18")
- data_nearR18 = len(cur.fetchall())
- con.close()
-
- con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'r18.db') # setu-r18
- cur = con.cursor()
- cur.execute("select * from r18")
- data_r18 = len(cur.fetchall())
- con.close()
-
- con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'cloudmusic' / 'cloudmusic.db') # cloudmusic
- cur = con.cursor()
- cur.execute("select * from cloudmusic")
- data_cloudmusic = len(cur.fetchall())
- con.close()
-
- with open(Path('.') / 'ATRI' / 'plugins' / 'LearnRepo' / 'LearnRepo.json', 'r') as f:
- data = json.load(f)
- data_repo = len(data)
-
- await session.send(
- f"""目前螃蟹™数据库收录了:
- 涩图:
- normal: {data_normal}
- nearR18: {data_nearR18}
- r18:{data_r18}
- 网抑云语录:{data_cloudmusic}
- 词汇量:{data_repo}"""
- )
+ con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'normal.db') # setu-normal
+ cur = con.cursor()
+ cur.execute("select * from normal")
+ data_normal = len(cur.fetchall())
+ con.close()
+
+ con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'nearR18.db') # setu-nearR18
+ cur = con.cursor()
+ cur.execute("select * from nearR18")
+ data_nearR18 = len(cur.fetchall())
+ con.close()
+
+ con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'r18.db') # setu-r18
+ cur = con.cursor()
+ cur.execute("select * from r18")
+ data_r18 = len(cur.fetchall())
+ con.close()
+
+ con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'cloudmusic' / 'cloudmusic.db') # cloudmusic
+ cur = con.cursor()
+ cur.execute("select * from cloudmusic")
+ data_cloudmusic = len(cur.fetchall())
+ con.close()
+
+ with open(Path('.') / 'ATRI' / 'plugins' / 'LearnRepo' / 'LearnRepo.json', 'r') as f:
+ data = json.load(f)
+ data_repo = len(data)
+
+ await session.send(
+ f"""目前螃蟹™数据库收录了:
+涩图:
+normal: {data_normal}
+nearR18: {data_nearR18}
+r18:{data_r18}
+网抑云语录:{data_cloudmusic}
+词汇量:{data_repo}"""
+ )
@on_command('look_noobList', aliases = ['查看黑名单'], only_to_me = False)