diff options
Diffstat (limited to 'ATRI')
94 files changed, 1061 insertions, 538 deletions
diff --git a/ATRI/data/emoji/AZ2.jpg b/ATRI/data/emoji/AZ2.jpg Binary files differdeleted file mode 100644 index e9f1636..0000000 --- a/ATRI/data/emoji/AZ2.jpg +++ /dev/null diff --git a/ATRI/data/emoji/AZ3.png b/ATRI/data/emoji/AZ3.png Binary files differdeleted file mode 100644 index cfc55f8..0000000 --- a/ATRI/data/emoji/AZ3.png +++ /dev/null diff --git a/ATRI/data/emoji/CG.gif b/ATRI/data/emoji/CG.gif Binary files differdeleted file mode 100644 index 5e82252..0000000 --- a/ATRI/data/emoji/CG.gif +++ /dev/null diff --git a/ATRI/data/emoji/CG1.jpg b/ATRI/data/emoji/CG1.jpg Binary files differdeleted file mode 100644 index 058abaa..0000000 --- a/ATRI/data/emoji/CG1.jpg +++ /dev/null diff --git a/ATRI/data/emoji/D.jpg b/ATRI/data/emoji/D.jpg Binary files differdeleted file mode 100644 index a9cf203..0000000 --- a/ATRI/data/emoji/D.jpg +++ /dev/null diff --git a/ATRI/data/emoji/D1.jpg b/ATRI/data/emoji/D1.jpg Binary files differdeleted file mode 100644 index 2ffa1cc..0000000 --- a/ATRI/data/emoji/D1.jpg +++ /dev/null diff --git a/ATRI/data/emoji/HE1.jpg b/ATRI/data/emoji/HE1.jpg Binary files differdeleted file mode 100644 index d5ea243..0000000 --- a/ATRI/data/emoji/HE1.jpg +++ /dev/null diff --git a/ATRI/data/emoji/JC.jpg b/ATRI/data/emoji/JC.jpg Binary files differdeleted file mode 100644 index 3052c34..0000000 --- a/ATRI/data/emoji/JC.jpg +++ /dev/null diff --git a/ATRI/data/emoji/JD.gif b/ATRI/data/emoji/JD.gif Binary files differdeleted file mode 100644 index 707009f..0000000 --- a/ATRI/data/emoji/JD.gif +++ /dev/null diff --git a/ATRI/data/emoji/JW.jpg b/ATRI/data/emoji/JW.jpg Binary files differdeleted file mode 100644 index 57628bd..0000000 --- a/ATRI/data/emoji/JW.jpg +++ /dev/null diff --git a/ATRI/data/emoji/JY.jpg b/ATRI/data/emoji/JY.jpg Binary files differdeleted file mode 100644 index 38a5f5b..0000000 --- a/ATRI/data/emoji/JY.jpg +++ /dev/null diff --git a/ATRI/data/emoji/senren/1.png b/ATRI/data/emoji/senren/1.png Binary files differnew file mode 100644 index 0000000..186969c --- /dev/null +++ b/ATRI/data/emoji/senren/1.png diff --git a/ATRI/data/emoji/senren/10.png b/ATRI/data/emoji/senren/10.png Binary files differnew file mode 100644 index 0000000..7233cf2 --- /dev/null +++ b/ATRI/data/emoji/senren/10.png diff --git a/ATRI/data/emoji/senren/11.png b/ATRI/data/emoji/senren/11.png Binary files differnew file mode 100644 index 0000000..1c07d8c --- /dev/null +++ b/ATRI/data/emoji/senren/11.png diff --git a/ATRI/data/emoji/senren/12.png b/ATRI/data/emoji/senren/12.png Binary files differnew file mode 100644 index 0000000..d5e66d2 --- /dev/null +++ b/ATRI/data/emoji/senren/12.png diff --git a/ATRI/data/emoji/senren/13.png b/ATRI/data/emoji/senren/13.png Binary files differnew file mode 100644 index 0000000..0d79796 --- /dev/null +++ b/ATRI/data/emoji/senren/13.png diff --git a/ATRI/data/emoji/senren/14.png b/ATRI/data/emoji/senren/14.png Binary files differnew file mode 100644 index 0000000..95aa1f7 --- /dev/null +++ b/ATRI/data/emoji/senren/14.png diff --git a/ATRI/data/emoji/senren/15.png b/ATRI/data/emoji/senren/15.png Binary files differnew file mode 100644 index 0000000..01874f7 --- /dev/null +++ b/ATRI/data/emoji/senren/15.png diff --git a/ATRI/data/emoji/senren/16.png b/ATRI/data/emoji/senren/16.png Binary files differnew file mode 100644 index 0000000..9e3568b --- /dev/null +++ b/ATRI/data/emoji/senren/16.png diff --git a/ATRI/data/emoji/senren/17.png b/ATRI/data/emoji/senren/17.png Binary files differnew file mode 100644 index 0000000..0e44175 --- /dev/null +++ b/ATRI/data/emoji/senren/17.png diff --git a/ATRI/data/emoji/senren/18.png b/ATRI/data/emoji/senren/18.png Binary files differnew file mode 100644 index 0000000..a5c1d67 --- /dev/null +++ b/ATRI/data/emoji/senren/18.png diff --git a/ATRI/data/emoji/senren/19.png b/ATRI/data/emoji/senren/19.png Binary files differnew file mode 100644 index 0000000..8cbc05b --- /dev/null +++ b/ATRI/data/emoji/senren/19.png diff --git a/ATRI/data/emoji/senren/2.png b/ATRI/data/emoji/senren/2.png Binary files differnew file mode 100644 index 0000000..aba83eb --- /dev/null +++ b/ATRI/data/emoji/senren/2.png diff --git a/ATRI/data/emoji/senren/20.png b/ATRI/data/emoji/senren/20.png Binary files differnew file mode 100644 index 0000000..d55a88a --- /dev/null +++ b/ATRI/data/emoji/senren/20.png diff --git a/ATRI/data/emoji/senren/21.png b/ATRI/data/emoji/senren/21.png Binary files differnew file mode 100644 index 0000000..ee18a5c --- /dev/null +++ b/ATRI/data/emoji/senren/21.png diff --git a/ATRI/data/emoji/senren/22.png b/ATRI/data/emoji/senren/22.png Binary files differnew file mode 100644 index 0000000..5ae7fb5 --- /dev/null +++ b/ATRI/data/emoji/senren/22.png diff --git a/ATRI/data/emoji/senren/23.png b/ATRI/data/emoji/senren/23.png Binary files differnew file mode 100644 index 0000000..b586ecb --- /dev/null +++ b/ATRI/data/emoji/senren/23.png diff --git a/ATRI/data/emoji/senren/24.png b/ATRI/data/emoji/senren/24.png Binary files differnew file mode 100644 index 0000000..94d338b --- /dev/null +++ b/ATRI/data/emoji/senren/24.png diff --git a/ATRI/data/emoji/senren/25.png b/ATRI/data/emoji/senren/25.png Binary files differnew file mode 100644 index 0000000..5a0f297 --- /dev/null +++ b/ATRI/data/emoji/senren/25.png diff --git a/ATRI/data/emoji/senren/26.png b/ATRI/data/emoji/senren/26.png Binary files differnew file mode 100644 index 0000000..79f2534 --- /dev/null +++ b/ATRI/data/emoji/senren/26.png diff --git a/ATRI/data/emoji/senren/27.png b/ATRI/data/emoji/senren/27.png Binary files differnew file mode 100644 index 0000000..3c9d241 --- /dev/null +++ b/ATRI/data/emoji/senren/27.png diff --git a/ATRI/data/emoji/senren/28.png b/ATRI/data/emoji/senren/28.png Binary files differnew file mode 100644 index 0000000..568b467 --- /dev/null +++ b/ATRI/data/emoji/senren/28.png diff --git a/ATRI/data/emoji/senren/29.png b/ATRI/data/emoji/senren/29.png Binary files differnew file mode 100644 index 0000000..eb213c0 --- /dev/null +++ b/ATRI/data/emoji/senren/29.png diff --git a/ATRI/data/emoji/senren/3.png b/ATRI/data/emoji/senren/3.png Binary files differnew file mode 100644 index 0000000..11ff4a8 --- /dev/null +++ b/ATRI/data/emoji/senren/3.png diff --git a/ATRI/data/emoji/senren/30.png b/ATRI/data/emoji/senren/30.png Binary files differnew file mode 100644 index 0000000..574ecb2 --- /dev/null +++ b/ATRI/data/emoji/senren/30.png diff --git a/ATRI/data/emoji/senren/31.png b/ATRI/data/emoji/senren/31.png Binary files differnew file mode 100644 index 0000000..73a2ccc --- /dev/null +++ b/ATRI/data/emoji/senren/31.png diff --git a/ATRI/data/emoji/senren/32.png b/ATRI/data/emoji/senren/32.png Binary files differnew file mode 100644 index 0000000..73210b1 --- /dev/null +++ b/ATRI/data/emoji/senren/32.png diff --git a/ATRI/data/emoji/senren/33.png b/ATRI/data/emoji/senren/33.png Binary files differnew file mode 100644 index 0000000..f80c10f --- /dev/null +++ b/ATRI/data/emoji/senren/33.png diff --git a/ATRI/data/emoji/senren/34.png b/ATRI/data/emoji/senren/34.png Binary files differnew file mode 100644 index 0000000..9553a5c --- /dev/null +++ b/ATRI/data/emoji/senren/34.png diff --git a/ATRI/data/emoji/senren/35.png b/ATRI/data/emoji/senren/35.png Binary files differnew file mode 100644 index 0000000..4e2003a --- /dev/null +++ b/ATRI/data/emoji/senren/35.png diff --git a/ATRI/data/emoji/senren/36.png b/ATRI/data/emoji/senren/36.png Binary files differnew file mode 100644 index 0000000..78c39c8 --- /dev/null +++ b/ATRI/data/emoji/senren/36.png diff --git a/ATRI/data/emoji/senren/37.png b/ATRI/data/emoji/senren/37.png Binary files differnew file mode 100644 index 0000000..8e7734b --- /dev/null +++ b/ATRI/data/emoji/senren/37.png diff --git a/ATRI/data/emoji/senren/38.png b/ATRI/data/emoji/senren/38.png Binary files differnew file mode 100644 index 0000000..659228a --- /dev/null +++ b/ATRI/data/emoji/senren/38.png diff --git a/ATRI/data/emoji/senren/39.png b/ATRI/data/emoji/senren/39.png Binary files differnew file mode 100644 index 0000000..609cfcb --- /dev/null +++ b/ATRI/data/emoji/senren/39.png diff --git a/ATRI/data/emoji/senren/4.png b/ATRI/data/emoji/senren/4.png Binary files differnew file mode 100644 index 0000000..7f0c88f --- /dev/null +++ b/ATRI/data/emoji/senren/4.png diff --git a/ATRI/data/emoji/senren/40.png b/ATRI/data/emoji/senren/40.png Binary files differnew file mode 100644 index 0000000..30ccfb2 --- /dev/null +++ b/ATRI/data/emoji/senren/40.png diff --git a/ATRI/data/emoji/senren/5.png b/ATRI/data/emoji/senren/5.png Binary files differnew file mode 100644 index 0000000..65a9265 --- /dev/null +++ b/ATRI/data/emoji/senren/5.png diff --git a/ATRI/data/emoji/senren/6.png b/ATRI/data/emoji/senren/6.png Binary files differnew file mode 100644 index 0000000..718ddd4 --- /dev/null +++ b/ATRI/data/emoji/senren/6.png diff --git a/ATRI/data/emoji/senren/7.png b/ATRI/data/emoji/senren/7.png Binary files differnew file mode 100644 index 0000000..3fcafa6 --- /dev/null +++ b/ATRI/data/emoji/senren/7.png diff --git a/ATRI/data/emoji/senren/8.png b/ATRI/data/emoji/senren/8.png Binary files differnew file mode 100644 index 0000000..7e6a0f8 --- /dev/null +++ b/ATRI/data/emoji/senren/8.png diff --git a/ATRI/data/emoji/senren/9.png b/ATRI/data/emoji/senren/9.png Binary files differnew file mode 100644 index 0000000..2701538 --- /dev/null +++ b/ATRI/data/emoji/senren/9.png diff --git a/ATRI/data/sqlite/setu/nearR18.db b/ATRI/data/sqlite/setu/nearR18.db Binary files differindex cb6e128..187d032 100644 --- a/ATRI/data/sqlite/setu/nearR18.db +++ b/ATRI/data/sqlite/setu/nearR18.db diff --git a/ATRI/data/voice/ATR_b402_027.amr b/ATRI/data/voice/ATR_b402_027.amr Binary files differnew file mode 100644 index 0000000..32d17a7 --- /dev/null +++ b/ATRI/data/voice/ATR_b402_027.amr diff --git a/ATRI/data/voice/CombinationTorpedoFist.amr b/ATRI/data/voice/CombinationTorpedoFist.amr Binary files differnew file mode 100644 index 0000000..709abe4 --- /dev/null +++ b/ATRI/data/voice/CombinationTorpedoFist.amr diff --git a/ATRI/data/voice/PX1.amr b/ATRI/data/voice/PX1.amr Binary files differnew file mode 100644 index 0000000..78606d0 --- /dev/null +++ b/ATRI/data/voice/PX1.amr diff --git a/ATRI/data/voice/PX2.amr b/ATRI/data/voice/PX2.amr Binary files differnew file mode 100644 index 0000000..57533a2 --- /dev/null +++ b/ATRI/data/voice/PX2.amr diff --git a/ATRI/data/voice/PX3.amr b/ATRI/data/voice/PX3.amr Binary files differnew file mode 100644 index 0000000..1e46c14 --- /dev/null +++ b/ATRI/data/voice/PX3.amr diff --git a/ATRI/data/voice/PX4.amr b/ATRI/data/voice/PX4.amr Binary files differnew file mode 100644 index 0000000..9e1bbab --- /dev/null +++ b/ATRI/data/voice/PX4.amr diff --git a/ATRI/data/voice/PX5.amr b/ATRI/data/voice/PX5.amr Binary files differnew file mode 100644 index 0000000..c9fee94 --- /dev/null +++ b/ATRI/data/voice/PX5.amr diff --git a/ATRI/data/voice/PX6.amr b/ATRI/data/voice/PX6.amr Binary files differnew file mode 100644 index 0000000..2b01adf --- /dev/null +++ b/ATRI/data/voice/PX6.amr diff --git a/ATRI/data/voice/RocketPunch.amr b/ATRI/data/voice/RocketPunch.amr Binary files differnew file mode 100644 index 0000000..e32116e --- /dev/null +++ b/ATRI/data/voice/RocketPunch.amr diff --git a/ATRI/data/voice/THX.amr b/ATRI/data/voice/THX.amr Binary files differnew file mode 100644 index 0000000..a9c6c8a --- /dev/null +++ b/ATRI/data/voice/THX.amr diff --git a/ATRI/data/voice/THX1.amr b/ATRI/data/voice/THX1.amr Binary files differnew file mode 100644 index 0000000..4fdb763 --- /dev/null +++ b/ATRI/data/voice/THX1.amr diff --git a/ATRI/data/voice/THX2.amr b/ATRI/data/voice/THX2.amr Binary files differnew file mode 100644 index 0000000..0209386 --- /dev/null +++ b/ATRI/data/voice/THX2.amr diff --git a/ATRI/data/voice/THX3.amr b/ATRI/data/voice/THX3.amr Binary files differnew file mode 100644 index 0000000..271f4e1 --- /dev/null +++ b/ATRI/data/voice/THX3.amr diff --git a/ATRI/data/voice/THX4.amr b/ATRI/data/voice/THX4.amr Binary files differnew file mode 100644 index 0000000..749dd1b --- /dev/null +++ b/ATRI/data/voice/THX4.amr diff --git a/ATRI/data/voice/ohayo1.amr b/ATRI/data/voice/ohayo1.amr Binary files differnew file mode 100644 index 0000000..490dc60 --- /dev/null +++ b/ATRI/data/voice/ohayo1.amr diff --git a/ATRI/data/voice/ohayo2.amr b/ATRI/data/voice/ohayo2.amr Binary files differnew file mode 100644 index 0000000..16baa25 --- /dev/null +++ b/ATRI/data/voice/ohayo2.amr diff --git a/ATRI/data/voice/ohayo3.amr b/ATRI/data/voice/ohayo3.amr Binary files differnew file mode 100644 index 0000000..51411b6 --- /dev/null +++ b/ATRI/data/voice/ohayo3.amr diff --git a/ATRI/data/voice/ohayo4.amr b/ATRI/data/voice/ohayo4.amr Binary files differnew file mode 100644 index 0000000..ecc2641 --- /dev/null +++ b/ATRI/data/voice/ohayo4.amr diff --git a/ATRI/data/voice/oyasuminasai.amr b/ATRI/data/voice/oyasuminasai.amr Binary files differnew file mode 100644 index 0000000..425fcf7 --- /dev/null +++ b/ATRI/data/voice/oyasuminasai.amr diff --git a/ATRI/data/voice/suki1.amr b/ATRI/data/voice/suki1.amr Binary files differnew file mode 100644 index 0000000..3ede330 --- /dev/null +++ b/ATRI/data/voice/suki1.amr diff --git a/ATRI/data/voice/suki2.amr b/ATRI/data/voice/suki2.amr Binary files differnew file mode 100644 index 0000000..c5b8f07 --- /dev/null +++ b/ATRI/data/voice/suki2.amr diff --git a/ATRI/data/voice/tip.txt b/ATRI/data/voice/tip.txt new file mode 100644 index 0000000..33a4ce6 --- /dev/null +++ b/ATRI/data/voice/tip.txt @@ -0,0 +1 @@ +ATR_b402_027 对坏人以火箭组合必杀拳,来让他好好喝一壶!哼!
\ No newline at end of file diff --git a/ATRI/data/voice/ysdd.amr b/ATRI/data/voice/ysdd.amr Binary files differnew file mode 100644 index 0000000..e343fee --- /dev/null +++ b/ATRI/data/voice/ysdd.amr diff --git a/ATRI/modules/b64/__init__.py b/ATRI/modules/b64/__init__.py index f54334b..a8a6bb6 100644 --- a/ATRI/modules/b64/__init__.py +++ b/ATRI/modules/b64/__init__.py @@ -11,12 +11,15 @@ path_temp_img = Path('.') / 'ATRI' / 'data' / 'temp' / 'img' def b64_str_img_url(url: str): img_d = requests.get(url) name = 'temp.jpg' - with open(str(path_temp_img) + '/' + name, 'wb') as f: + find_img = Path('.') / 'ATRI' / 'data' / 'temp' / 'img' / f'{name}' + with open(find_img, 'wb') as f: f.write(img_d.content) - find_img = os.path.join(str(path_temp_img) + '/' + name) - with open(find_img, 'rb') as f: - content = f.read() - b64_str = base64.b64encode(content).decode() - time.sleep(1) - os.remove(str(path_temp_img) + '/' + name) - return b64_str
\ No newline at end of file + if find_img.stat().st_size >= 1000000: + print('超过1MB,跳过!') + else: + with open(find_img, 'rb') as f: + content = f.read() + b64_str = base64.b64encode(content).decode() + time.sleep(1) + os.remove(str(path_temp_img) + '/' + name) + return b64_str
\ No newline at end of file diff --git a/ATRI/plugins/BlackList.py b/ATRI/plugins/BlackList.py index ec851b5..dd81e6b 100644 --- a/ATRI/plugins/BlackList.py +++ b/ATRI/plugins/BlackList.py @@ -67,45 +67,4 @@ async def _(session: CommandSession): f = open(file1, 'w') f.write(json.dumps(bL)) f.close() - await session.send(f'将群[{u}]移出黑名单成功~!') - - -@on_command('look_noobList', aliases = ['查看黑名单'], only_to_me = False) -async def _(session: CommandSession): - start = time.perf_counter() - with open(file, 'r') as f: - data = json.load(f) - with open(file1, 'r') as f: - data0 = json.load(f) - - msg = f'被ATRI列入黑名单有以下列表:\n' - try: - msg1 = f'=====[用户]=====\n' - msg += msg1 - for i in data.keys(): - msg0 = f'{i}\n' - msg += msg0 - except: - end = time.perf_counter() - msg0 = f"==============\nDone time: {round(end - start, 3)}s" - msg += msg0 - await session.send(msg) - return - - try: - msg1 = f'======[群]======\n' - msg += msg1 - for i in data0.keys(): - msg0 = f'{i}\n' - msg += msg0 - except: - end = time.perf_counter() - msg0 = f"==============\nDone time: {round(end - start, 3)}s" - msg += msg0 - await session.send(msg) - return - - end = time.perf_counter() - msg0 = f"==============\nDone time: {round(end - start, 3)}s" - msg += msg0 - await session.send(msg)
\ No newline at end of file + await session.send(f'将群[{u}]移出黑名单成功~!')
\ No newline at end of file diff --git a/ATRI/plugins/Chat.py b/ATRI/plugins/Chat0.py index 681e840..55b341f 100644 --- a/ATRI/plugins/Chat.py +++ b/ATRI/plugins/Chat0.py @@ -1,7 +1,6 @@ import os import re import json -import time import nonebot import warnings from pathlib import Path @@ -10,7 +9,6 @@ from datetime import datetime, timedelta from nonebot import on_command, scheduler from nonebot import CommandSession from apscheduler.triggers.date import DateTrigger -from nonebot import session from ATRI.modules import response # type: ignore import config # type: ignore @@ -22,114 +20,6 @@ master = config.MASTER() KC_URL = 'https://nmsl.shadiao.app/api.php?level=min&lang=zh_cn' [email protected]_job( - 'cron', - day_of_week = "mon,tue,wed,thu,fri,sat,sun", - hour = 7, - misfire_grace_time= 300 -) -async def _(): - """早安""" - start = time.perf_counter() - group_list = await bot.get_group_list() #type: ignore - groups = [group['group_id'] for group in group_list] - g_list = len(group_list) - res = randint(1,2) - if res == 1: - msg = choice( - [ - '啊......早上好...(哈欠)', - '唔......吧唧...早上...哈啊啊~~~\n早上好......', - '早上好......', - '早上好呜......呼啊啊~~~~', - '啊......早上好。\n昨晚也很激情呢!', - '吧唧吧唧......怎么了...已经早上了么...', - '早上好!', - '......看起来像是傍晚,其实已经早上了吗?', - '早上好......欸~~~脸好近呢' - '......(打瞌睡)', - ] - ) - - elif res == 2: - img = Path('.') / 'ATRI' / 'data' / 'emoji' / 'SY.jpg' - img = os.path.abspath(img) - msg = f'[CQ:image,file=file:///{os.path.abspath(img)}]' - - for group in groups: - await bot.send_group_msg(group_id = group, message = msg) #type: ignore - - end = time.perf_counter() - await bot.send_private_msg(user_id = master, message = f'已推送到[{g_list}]个群\n耗时:{round(end - start, 3)}') # type: ignore - [email protected]_job( - 'cron', - day_of_week = "mon,tue,wed,thu,fri,sat,sun", - hour = 22, - misfire_grace_time = 300 -) -async def _(): - """晚安""" - start = time.perf_counter() - group_list = await bot.get_group_list() #type: ignore - groups = [group['group_id'] for group in group_list] - g_list = len(group_list) - res = randint(1,2) - if res == 1: - msg = choice( - [ - '忙累了一天,快休息吧', - '辛苦了一天,准备睡觉吧', - '一起睡觉吧~~~~~', - '......该睡觉了', - '还不睡等着猝死?嗯!?' - - ] - ) - - elif res == 2: - img = choice( - [ - 'SJ.jpg', 'SJ1.jpg' - ] - ) - img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}' - img = os.path.abspath(img) - msg = f'[CQ:image,file=file:///{os.path.abspath(img)}]' - - for group in groups: - await bot.send_group_msg(group_id = group, message = msg) #type: ignore - - end = time.perf_counter() - await bot.send_private_msg(user_id = master, message = f'已推送到[{g_list}]个群\n耗时:{round(end - start, 3)}') # type: ignore - [email protected]_job( - 'cron', - day_of_week = "mon,tue,wed,thu,fri,sat,sun", - hour = 0, - misfire_grace_time = 300 -) -async def _(): - """到 点 了""" - start = time.perf_counter() - group_list = await bot.get_group_list() # type: ignore - groups = [group['group_id'] for group in group_list] - g_list = len(group_list) - img = choice( - [ - 'WYY.gif', 'WYY.jpg', 'WYY1.jpg' - ] - ) - img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}' - img = os.path.abspath(img) - msg = f'[CQ:image,file=file:///{os.path.abspath(img)}]' - for group in groups: - await bot.send_group_msg(group_id = group, message = msg) #type: ignore - - end = time.perf_counter() - await bot.send_private_msg(user_id = master, message = f'已推送到[{g_list}]个群\n耗时:{round(end - start, 3)}') # type: ignore - - def now_time(): now_ = datetime.now() hour = now_.hour @@ -177,21 +67,33 @@ async def _(session: CommandSession): pass else: if 5.5 <= now_time() < 9: - await session.send( - choice( + res = randint(1,2) + if res == 1: + await session.send( + choice( + [ + '啊......早上好...(哈欠)', + '唔......吧唧...早上...哈啊啊~~~\n早上好......', + '早上好......', + '早上好呜......呼啊啊~~~~', + '啊......早上好。\n昨晚也很激情呢!', + '吧唧吧唧......怎么了...已经早上了么...', + '早上好!', + '......看起来像是傍晚,其实已经早上了吗?', + '早上好......欸~~~脸好近呢' + ] + ) + ) + + elif res == 2: + voice = choice( [ - '啊......早上好...(哈欠)', - '唔......吧唧...早上...哈啊啊~~~\n早上好......', - '早上好......', - '早上好呜......呼啊啊~~~~', - '啊......早上好。\n昨晚也很激情呢!', - '吧唧吧唧......怎么了...已经早上了么...', - '早上好!', - '......看起来像是傍晚,其实已经早上了吗?', - '早上好......欸~~~脸好近呢' + 'ohayo1.amr', 'ohayo2.amr', 'ohayo3.amr', 'ohayo4.amr' ] ) - ) + voice = Path('.') / 'ATRI' / 'data' / 'voice' / f'{voice}' + voice = os.path.abspath(voice) + await session.send(f'[CQ:record,file=:///{voice}]') elif 9 <= now_time() < 18: await session.send( @@ -229,6 +131,7 @@ async def _(session: CommandSession): ) ) + @on_command('noon', patterns = [r"中午好|午安"], only_to_me = False) async def _(session: CommandSession): user = session.event.user_id @@ -318,16 +221,23 @@ async def _(session: CommandSession): ) elif 19 <= now_time() < 24: - await session.send( - choice( - [ - '嗯哼哼~睡吧,就像平常一样安眠吧~o(≧▽≦)o', - '......(打瞌睡)', - '呼...呼...已经睡着了哦~...呼......', - '......我、我会在这守着你的,请务必好好睡着' - ] + res = randint(1,2) + if res == 1: + await session.send( + choice( + [ + '嗯哼哼~睡吧,就像平常一样安眠吧~o(≧▽≦)o', + '......(打瞌睡)', + '呼...呼...已经睡着了哦~...呼......', + '......我、我会在这守着你的,请务必好好睡着' + ] + ) ) - ) + + elif res == 2: + voice = Path('.') / 'ATRI' / 'data' / 'voice' / 'oyasuminasai.amr' + voice = os.path.abspath(voice) + await session.send(f'[CQ:record,file=:///{voice}]') elif 0 <= now_time() < 5.5: await session.send( @@ -372,7 +282,7 @@ async def az(session: CommandSession): # res = random.randint(1,10) img = choice( [ - 'AZ.jpg', 'AZ1.jpg', 'AZ2.jpg', 'AZ3.png', 'ZN.jpg' + 'AZ.jpg', 'AZ1.jpg' ] ) img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}' @@ -408,14 +318,14 @@ async def az(session: CommandSession): # res = random.randint(1,10) img = choice( [ - 'SUKI.jpg', 'SUKI1.jpg', 'SUKI2.png', 'HE1.jpg' + 'SUKI.jpg', 'SUKI1.jpg', 'SUKI2.png' ] ) img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}' img = os.path.abspath(img) await session.send(f'[CQ:image,file=file:///{img}]') - elif 2 <= res <= 3: + elif res == 2: img = choice( [ 'TZ.jpg', 'TZ1.jpg', 'TZ2.jpg' @@ -424,91 +334,18 @@ async def az(session: CommandSession): img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}' img = os.path.abspath(img) await session.send(f'[CQ:image,file=file:///{img}]') - - -@on_command('wenhao', patterns = [r"'?'|?|¿"], only_to_me = False) -async def _(session: CommandSession): - user = session.event.user_id - group = session.event.group_id - try: - with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobGroup.json', 'r') as f: - data = json.load(f) - except: - data = {} - try: - with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', '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: - if 0 <= now_time() < 5.5: - pass - else: - res = randint(1,3) - if res == 1: - res = randint(1,5) - if 1 <= res < 2: - await session.send( - choice( - [ - '?', '?', '嗯?', '(。´・ω・)ん?', 'ん?' - ] - ) - ) - - elif 2 <= res <= 5: - img = choice( - [ - 'WH.jpg', 'WH1.jpg', 'WH2.jpg', 'WH3.jpg', 'WH4.jpg' - ] - ) - img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}' - img = os.path.abspath(img) - await session.send(f'[CQ:image,file=file:///{img}]') - -@on_command('yn', patterns = [r"是[吗]|是否"], only_to_me = False) -async def _(session: CommandSession): - user = session.event.user_id - group = session.event.group_id - try: - with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobGroup.json', 'r') as f: - data = json.load(f) - except: - data = {} - try: - with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', '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: - if 0 <= now_time() < 5.5: - pass - else: - if randint(1,3) == 1: - img = choice( + + elif res == 3: + voice = choice( [ - 'YIQI_YES.png', 'YIQI_NO.jpg', 'KD.jpg', 'FD.jpg' + 'suki1.amr', 'suki2.amr' ] ) - img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}' - img = os.path.abspath(img) - await session.send(f'[CQ:image,file=file:///{img}]') + voice = Path('.') / 'ATRI' / 'data' / 'voice' / f'{voice}' + voice = os.path.abspath(voice) + await session.send(f'[CQ:record,file=file:///{voice}]') - - -@on_command('kouchou', patterns = [r"草你妈|操|你妈|脑瘫|废柴|fw|five|废物|战斗|爬|爪巴|sb|SB|啥[b批比逼]|傻b|给[爷👴]爬|嘴臭"], only_to_me = False) +@on_command('kouchou', patterns = [r"草你妈|操|你妈|脑瘫|废柴|fw|five|废物|战斗|爬|爪巴|sb|SB|啥[b批比逼]|傻b|给[爷👴]爬|嘴臭"]) async def _(session: CommandSession): user = session.event.user_id group = session.event.group_id @@ -548,12 +385,18 @@ async def _(session: CommandSession): res = randint(1,3) if res == 1: await session.send('对嘴臭人以火箭组合必杀拳,来让他好好喝一壶!哼!') + voice = os.path.abspath(Path('.') / 'ATRI' / 'data' / 'voice' / 'ATR_b402_027.amr') + await session.send(f'[CQ:record,file=file:///{voice}]') elif res == 2: await session.send('鱼雷组合拳——————————————————啊————!!!') + voice = os.path.abspath(Path('.') / 'ATRI' / 'data' / 'voice' / 'CombinationTorpedoFist.amr') + await session.send(f'[CQ:record,file=file:///{voice}]') elif res == 3: await session.send('火箭拳——————————————————————————!!!') + voice = os.path.abspath(Path('.') / 'ATRI' / 'data' / 'voice' / 'RocketPunch.amr') + await session.send(f'[CQ:record,file=file:///{voice}]') elif res == 3: await session.send(response.request_api(KC_URL)) @@ -663,6 +506,16 @@ async def _(session: CommandSession): img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}' img = os.path.abspath(img) await session.send(f'[CQ:image,file=file:///{img}]') + + elif randint(1,2) == 2: + voice = choice( + [ + 'PX1.amr', 'PX2.amr', 'PX3.amr', 'PX4.amr', 'PX5.amr', 'PX6.amr' + ] + ) + voice = Path('.') / 'ATRI' / 'data' / 'voice' / f'{voice}' + voice = os.path.abspath(voice) + await session.send(f'[CQ:record,file=file:///{voice}]') @on_command('qingjie', patterns = [r"青[洁结]"], only_to_me = False) async def _(session: CommandSession): @@ -889,6 +742,136 @@ async def _(session: CommandSession): ) await session.send(msg) +@on_command('whl', patterns = [r"我好了|[wW][hH[lL]"], only_to_me = False) +async def _(session: CommandSession): + user = session.event.user_id + group = session.event.group_id + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobGroup.json', 'r') as f: + data = json.load(f) + except: + data = {} + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', '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: + if 0 <= now_time() < 5.5: + pass + else: + if randint(1,2) == 1: + await session.send('不许好!憋回去!') + +@on_command('birthday', patterns = [r"生日快乐|生快|[bB]irthday|誕生日|tanjobi"]) +async def _(session: CommandSession): + user = session.event.user_id + group = session.event.group_id + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobGroup.json', 'r') as f: + data = json.load(f) + except: + data = {} + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', '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: + if 0 <= now_time() < 5.5: + pass + else: + if datetime.date.today().strftime('%y%m%d') == 200828: + res = randint(1,3) + if res == 1: + msg = choice( + [ + '谢谢,谢谢你!', + '感谢...15551', + '谢谢你们orz...' + ] + ) + await session.send(msg) + + elif 2 <= res <= 3: + voice = choice( + [ + 'THX.amr', 'THX1.amr', 'THX2.amr', 'THX3.amr', 'THX4.amr' + ] + ) + voice = Path('.') / 'ATRI' / 'data' / 'voice' / f'{voice}' + voice = os.path.abspath(voice) + await session.send(f'[CQ:record,file=file:///{voice}]') + + if randint(1,3) == 2: + img = Path('.') / 'ATRI' / 'data' / 'emoji' / 'SUKI.jpg' + img = os.path.abspath(img) + await session.send(f'[CQ:image,file=file:///{img}]') + + else: + pass + + +@on_command('nicesleep', patterns = [r"精致睡眠"]) +async def _(session: CommandSession): + user = session.event.user_id + group = session.event.group_id + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobGroup.json', 'r') as f: + data = json.load(f) + except: + data = {} + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', '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: + if user == master: + await session.send('那...请主人自己闭上眼!哼唧') + return + else: + await session.send('恭喜!您已被ATRI屏蔽7小时') + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', 'r') as f: + bL = json.load(f) + except: + bL = {} + bL[f"{user}"] = f"{user}" + file = Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json' + f = open(file, 'w') + f.write(json.dumps(bL)) + f.close() + delta = timedelta(hours = 7) + trigger = DateTrigger( + run_date = datetime.now() + delta + ) + + scheduler.add_job( #type: ignore + func = rmQQfromNoobLIST, + trigger = trigger, + args = (session.event.user_id,), + misfire_grace_time = 60, + ) + noobList0 = [] @on_command('robozi', patterns = [r"萝卜子"], only_to_me = False) async def _(session: CommandSession): @@ -915,35 +898,41 @@ async def _(session: CommandSession): if 0 <= now_time() < 5.5: pass else: - bL = {} - await session.send('萝卜子是对机器人的蔑称!') + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', 'r') as f: + bL = json.load(f) + except: + bL = {} noobList0.append(user) - if countX(noobList0, user) == 2: + if countX(noobList0, user) == 1: + await session.send('萝卜子是对机器人的蔑称!') + + elif countX(noobList0, user) == 2: if user == master: await session.send('是主人的话...那算了...呜呜\n即使到达了ATRI的最低忍耐限度......') noobList0 = list(set(noobList0)) pass - await session.send('是亚托莉......萝卜子可是对机器人的蔑称......\n这是第二次警告哦,接下来5分钟我不会再理你了!哼唧!') - bL[f"{user}"] = f"{user}" - file = Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json' - f = open(file, 'w') - f.write(json.dumps(bL)) - f.close() - noobList0 = list(set(noobList0)) - print(noobList0) - delta = timedelta(minutes = 5) - trigger = DateTrigger( - run_date = datetime.now() + delta - ) - - scheduler.add_job( #type: ignore - func = rmQQfromNoobLIST, - trigger = trigger, - args = (user), - misfire_grace_time = 60, - ) + else: + await session.send('是亚托莉......萝卜子可是对机器人的蔑称......\n这是第二次警告哦,接下来5分钟我不会再理你了!哼唧!') + bL[f"{user}"] = f"{user}" + file = Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json' + f = open(file, 'w') + f.write(json.dumps(bL)) + f.close() + noobList0 = list(set(noobList0)) + print(noobList0) + delta = timedelta(minutes = 5) + trigger = DateTrigger( + run_date = datetime.now() + delta + ) + scheduler.add_job( #type: ignore + func = rmQQfromNoobLIST, + trigger = trigger, + args = (session.event.user_id,), + misfire_grace_time = 60, + ) noobList1 = [] @on_command('ntr', patterns = [r"[nNηиɴИ][tT][rR]|[牛🐂]头人"], only_to_me = False) @@ -972,7 +961,11 @@ async def _(session: CommandSession): pass else: msg = str(session.event.message) - bL = {} + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', 'r') as f: + bL = json.load(f) + except: + bL = {} pattern = r"[nNηиɴИ][tT][rR]|[牛🐂]头人" if re.findall(pattern, msg): await session.send('你妈的,牛头人,' + response.request_api(KC_URL)) @@ -1002,6 +995,6 @@ async def _(session: CommandSession): scheduler.add_job( #type: ignore func = rmQQfromNoobLIST, trigger = trigger, - args = (user), + args = (session.event.user_id,), misfire_grace_time = 60, )
\ No newline at end of file diff --git a/ATRI/plugins/Chat1.py b/ATRI/plugins/Chat1.py new file mode 100644 index 0000000..637ff93 --- /dev/null +++ b/ATRI/plugins/Chat1.py @@ -0,0 +1,205 @@ +import os +import json +import nonebot +from pathlib import Path +from random import choice, randint +from datetime import datetime +from nonebot import on_command, CommandSession +from nonebot import session + +import config # type: ignore + + +bot = nonebot.get_bot() +master = config.MASTER() + + +def now_time(): + now_ = datetime.now() + hour = now_.hour + minute = now_.minute + now = hour + minute / 60 + return now + + +@on_command('nanjya', patterns = [r"なんじゃ|何[がで]|どうして|为什么|为何|多[洗西]跌"], only_to_me = False) +async def _(session: CommandSession): + user = session.event.user_id + group = session.event.group_id + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobGroup.json', 'r') as f: + data = json.load(f) + except: + data = {} + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', '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: + if 0 <= now_time() < 5.5: + pass + else: + if randint(1,2) == 1: + img = choice( + [ + '1.jpg', '8.jpg', '14.jpg', '21.jpg' + ] + ) + img = os.path.abspath(Path('.') / 'ATRI' / 'data' / 'emoji' / 'senren' / f'{img}') + await session.send(f'[CQ:image,file=file:///{img}]') + +@on_command('wenhao', patterns = [r"'?'|?|¿"], only_to_me = False) +async def _(session: CommandSession): + user = session.event.user_id + group = session.event.group_id + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobGroup.json', 'r') as f: + data = json.load(f) + except: + data = {} + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', '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: + if 0 <= now_time() < 5.5: + pass + else: + if randint(1,3) == 1: + res = randint(1,5) + if 1 <= res < 2: + await session.send( + choice( + [ + '?', '?', '嗯?', '(。´・ω・)ん?', 'ん?' + ] + ) + ) + + elif 2 <= res <= 5: + img = choice( + [ + 'WH.jpg', 'WH1.jpg', 'WH2.jpg', 'WH3.jpg', 'WH4.jpg' + ] + ) + img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}' + img = os.path.abspath(img) + await session.send(f'[CQ:image,file=file:///{img}]') + +@on_command('yesorno', patterns = [r"[好是]吗|[行能]不[行能]|彳亍不彳亍|可不可以"], only_to_me = False) +async def _(session: CommandSession): + user = session.event.user_id + group = session.event.group_id + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobGroup.json', 'r') as f: + data = json.load(f) + except: + data = {} + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', '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: + if 0 <= now_time() < 5.5: + pass + else: + res = randint(1,2) + if res == 1: + img = choice( + [ + '2.png', '39.png' + ] + ) + img = os.path.abspath(Path('.') / 'ATRI' / 'data' / 'emoji' / 'senren' / f'{img}') + await session.send(f'[CQ:image,file=file:///{img}]') + + elif res == 2: + img = choice( + [ + 'YIQI_YES.png', 'YIQI_NO.jpg', 'KD.jpg', 'FD.jpg' + ] + ) + img = os.path.abspath(Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}') + await session.send(f'[CQ:image,file=file:///{img}]') + +@on_command('ysdd', aliases = [r"原声大碟"]) +async def _(session: CommandSession): + user = session.event.user_id + group = session.event.group_id + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobGroup.json', 'r') as f: + data = json.load(f) + except: + data = {} + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', '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: + voice = Path('.') / 'ATRI' / 'data' / 'voice' / 'ysdd.amr' + voice = os.path.abspath(voice) + await session.send(f'[CQ:record,file=file:///{voice}]') + [email protected]_message('group') +async def _(context): + user = context["user_id"] + group = context["group_id"] + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobGroup.json', 'r') as f: + data = json.load(f) + except: + data = {} + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', '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: + if 0 <= now_time() < 5.5: + pass + else: + if randint(1,20) == 4: + img = choice( + [ + '11.jpg', '12.jpg', '23.jpg' + ] + ) + img = os.path.abspath(Path('.') / 'ATRI' / 'data' / 'emoji' / 'senren' / f'{img}') + await bot.send_msg(message = f'[CQ:image,file=file:///{img}]', auto_escape = False) # type: ignore + + else: + pass
\ No newline at end of file diff --git a/ATRI/plugins/Check.py b/ATRI/plugins/Check.py new file mode 100644 index 0000000..9d0bbb2 --- /dev/null +++ b/ATRI/plugins/Check.py @@ -0,0 +1,222 @@ +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 + +import config # type: ignore + + +bot = nonebot.get_bot() +master = config.MASTER() +file = Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json' +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}""" + ) + + +@on_command('look_noobList', aliases = ['查看黑名单'], only_to_me = False) +async def _(session: CommandSession): + start = time.perf_counter() + try: + with open(file, 'r') as f: + data = json.load(f) + except: + data = {} + + try: + with open(file1, 'r') as f: + data0 = json.load(f) + except: + data0 = {} + + msg = f'被ATRI列入黑名单有以下列表:\n' + try: + msg1 = f'=====[用户]=====\n' + msg += msg1 + for i in data.keys(): + msg0 = f'{i}\n' + msg += msg0 + except: + end = time.perf_counter() + msg0 = f"==============\nDone time: {round(end - start, 3)}s" + msg += msg0 + await session.send(msg) + return + + try: + msg1 = f'======[群]======\n' + msg += msg1 + for i in data0.keys(): + msg0 = f'{i}\n' + msg += msg0 + except: + end = time.perf_counter() + msg0 = f"==============\nDone time: {round(end - start, 3)}s" + msg += msg0 + await session.send(msg) + return + + end = time.perf_counter() + msg0 = f"==============\nDone time: {round(end - start, 3)}s" + msg += msg0 + await session.send(msg) + + +@on_command('look_power', aliases = ['查看权限组'], only_to_me = False) +async def _(session: CommandSession): + start = time.perf_counter() + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'UploadSqlite' / 'sepi.json', 'r') as f: + data = json.load(f) + except: + data = {} + + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'UploadSqlite' / 'cloudmusic.json', 'r') as f: + data0 = json.load(f) + except: + data0 = {} + + msg = f'主人: {master}\n' + try: + msg1 = f'=====[涩批]=====\n' + msg += msg1 + for i in data.keys(): + msg0 = f'{i}\n' + msg += msg0 + except: + end = time.perf_counter() + msg0 = f"==============\nDone time: {round(end - start, 3)}s" + msg += msg0 + await session.send(msg) + return + + try: + msg1 = f'====[网抑云]====\n' + msg += msg1 + for i in data0.keys(): + msg0 = f'{i}\n' + msg += msg0 + except: + end = time.perf_counter() + msg0 = f"==============\nDone time: {round(end - start, 3)}s" + msg += msg0 + await session.send(msg) + return + + end = time.perf_counter() + msg0 = f"==============\nDone time: {round(end - start, 3)}s" + msg += msg0 + await session.send(msg) + + + +@on_command('check_status', patterns = [r"检查状态|检查运行|检查身体"]) +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: + cpu = psutil.cpu_percent(interval=1) + memory = psutil.virtual_memory().percent + disk = psutil.disk_usage('/').percent + inteSENT = psutil.net_io_counters().bytes_sent # type: ignore + inteRECV = psutil.net_io_counters().bytes_recv # type: ignore + + status = 'アトリは、高性能ですから!' + + if cpu > 80: + status = 'ATRI感觉头有点晕...' + if memory > 80: + status = 'ATRI感觉有点头晕并且有点累...' + + elif disk > 80: + status = 'ATRI感觉身体要被塞满了...' + + await session.send(f"""ATRI Status: +* cpu: {cpu}% +* mem: {memory}% +* disk: {disk}% +* BytesSENT: {inteSENT} +* BytesRECV: {inteRECV} +{status}""".strip())
\ No newline at end of file diff --git a/ATRI/plugins/LearnRepo.py b/ATRI/plugins/LearnRepo.py index 36f4374..f533655 100644 --- a/ATRI/plugins/LearnRepo.py +++ b/ATRI/plugins/LearnRepo.py @@ -54,6 +54,8 @@ async def _(session: CommandSession): else: session.finish(f'ATRI貌似没法从记忆中找到关键词[{word}]呢...') +# @on_command('add_tech', aliases = ['添加']) + @bot.on_message("group") async def repo(context): diff --git a/ATRI/plugins/LearnRepo/LearnRepo.json b/ATRI/plugins/LearnRepo/LearnRepo.json index fb478b5..18a45e8 100644 --- a/ATRI/plugins/LearnRepo/LearnRepo.json +++ b/ATRI/plugins/LearnRepo/LearnRepo.json @@ -1 +1 @@ -{"test": ["TesT is SuccEss!", 1]}
\ No newline at end of file +{"test": ["TesT is SuccEss!", 1], "\ud83d\udd28": ["\ud83d\udd28", 2]}
\ No newline at end of file diff --git a/ATRI/plugins/Scheduler.py b/ATRI/plugins/Scheduler.py new file mode 100644 index 0000000..100ee3b --- /dev/null +++ b/ATRI/plugins/Scheduler.py @@ -0,0 +1,155 @@ +import os +import time +import nonebot +import psutil +from datetime import datetime +from random import randint, choice +from pathlib import Path + +import config # type: ignore + + +bot = nonebot.get_bot() +master = config.MASTER() + + [email protected]_job( + 'cron', + hour = 7, + misfire_grace_time= 600 +) +async def _(): + """早安""" + try: + await bot.send_private_msg(user_id = master, message = f'ATRI将在三秒后开始执行定时任务:早安') # type: ignore + time.sleep(3) + start = time.perf_counter() + group_list = await bot.get_group_list() #type: ignore + groups = [group['group_id'] for group in group_list] + g_list = len(group_list) + msg = choice( + [ + '啊......早上好...(哈欠)', + '唔......吧唧...早上...哈啊啊~~~\n早上好......', + '早上好......', + '早上好呜......呼啊啊~~~~', + '啊......早上好。\n昨晚也很激情呢!', + '吧唧吧唧......怎么了...已经早上了么...', + '早上好!', + '......看起来像是傍晚,其实已经早上了吗?', + '早上好......欸~~~脸好近呢' + '......(打瞌睡)', + ] + ) + + try: + for group in groups: + time.sleep(randint(60,90)) + await bot.send_group_msg(group_id = group, message = msg) #type: ignore + except: + await bot.send_private_msg(user_id = master, message = f'在推送[早安]到某些群的时候貌似失败了呢') # type: ignore + + end = time.perf_counter() + await bot.send_private_msg(user_id = master, message = f'已推送到[{g_list}]个群\n耗时:{round(end - start, 3)}') # type: ignore + + except: + pass + [email protected]_job( + 'cron', + hour = 22, + misfire_grace_time = 600 +) +async def _(): + """晚安""" + try: + await bot.send_private_msg(user_id = master, message = f'ATRI将在三秒后开始执行定时任务:晚安') # type: ignore + time.sleep(3) + start = time.perf_counter() + group_list = await bot.get_group_list() #type: ignore + groups = [group['group_id'] for group in group_list] + g_list = len(group_list) + msg = choice( + [ + '忙累了一天,快休息吧', + '辛苦了一天,准备睡觉吧', + '一起睡觉吧~~~~~', + '......该睡觉了', + '还不睡等着猝死?嗯!?' + + ] + ) + + try: + for group in groups: + time.sleep(randint(60,90)) + await bot.send_group_msg(group_id = group, message = msg) #type: ignore + except: + await bot.send_private_msg(user_id = master, message = f'在推送[晚安]到某些群的时候貌似失败了呢') # type: ignore + + end = time.perf_counter() + await bot.send_private_msg(user_id = master, message = f'已推送到[{g_list}]个群\n耗时:{round(end - start, 3)}') # type: ignore + + except: + pass + [email protected]_job( + 'cron', + hour = 0, + misfire_grace_time = 600 +) +async def _(): + """到 点 了""" + try: + await bot.send_private_msg(user_id = master, message = f'ATRI将在三秒后开始执行定时任务:网抑云') # type: ignore + time.sleep(3) + start = time.perf_counter() + group_list = await bot.get_group_list() # type: ignore + groups = [group['group_id'] for group in group_list] + g_list = len(group_list) + msg = f'到点了叻~!' + + try: + for group in groups: + time.sleep(randint(60,90)) + await bot.send_group_msg(group_id = group, message = msg) #type: ignore + except: + await bot.send_private_msg(user_id = master, message = f'在推送[网抑云]到某些群的时候貌似失败了呢') # type: ignore + + end = time.perf_counter() + await bot.send_private_msg(user_id = master, message = f'已推送到[{g_list}]个群\n耗时:{round(end - start, 3)}') # type: ignore + + except: + pass + [email protected]_job( + 'interval', + minutes = 5, + misfire_grace_time= 10 +) +async def _(): + cpu = psutil.cpu_percent(interval=1) + memory = psutil.virtual_memory().percent + disk = psutil.disk_usage('/').percent + today = datetime.now() + + if cpu > 80: + await bot.send_private_msg( + user_id = master, + message = f'ATRI感觉头有点晕...\n(cpu:{cpu}% mem:{memory}% disk:{disk}%)\n{today}' + ) # type: ignore + + elif memory > 80: + await bot.send_private_msg( + user_id = master, + message = f'ATRI感觉身体有点累...\n(cpu:{cpu}% mem:{memory}% disk:{disk}%)\n{today}' + ) # type: ignore + + elif disk > 80: + await bot.send_private_msg( + user_id = master, + message = f'ATRI感觉身体要被塞满了...\n(cpu:{cpu}% mem:{memory}% disk:{disk}%)\n{today}' + ) # type: ignore + + else: + pass
\ No newline at end of file diff --git a/ATRI/plugins/UploadSqlite.py b/ATRI/plugins/UploadSqlite.py index f1dc602..6488ed4 100644 --- a/ATRI/plugins/UploadSqlite.py +++ b/ATRI/plugins/UploadSqlite.py @@ -1,11 +1,13 @@ import os import time import json +import asyncio import sqlite3 import nonebot from pathlib import Path from nonebot import on_command, CommandSession +from nonebot import session from ATRI.modules import response # type: ignore @@ -15,9 +17,26 @@ master = bot.config.SUPERUSERS # type: ignore url = f'https://api.imjad.cn/pixiv/v1/?type=illust&id=' +try: + with open(Path('.') / 'ATRI' / 'plugins' / 'UploadSqlite' / 'sepi.json', 'r') as f: + sP = json.load(f) +except: + sP = {} +sepi = list(sP.keys()) + +try: + with open(Path('.') / 'ATRI' / 'plugins' / 'UploadSqlite' / 'cloudmusic.json', 'r') as f: + cD = json.load(f) +except: + cD = {} +cloudmusic = list(cD.keys()) + + + @on_command('upload_setu', aliases = ['上传涩图'], only_to_me = False) async def _(session: CommandSession): - if session.event.user_id in master: + user = session.event.user_id + if user in master or user in sepi: start = time.perf_counter() msg = session.event.raw_message.split(' ', 2) print(msg) @@ -37,12 +56,14 @@ async def _(session: CommandSession): user_link = f'https://www.pixiv.net/users/' + f'{u_id}' img = f'https://pixiv.cat/{pid}.jpg' + dataSETU = (f'{pid}', f'{title}', f'{tags}', f'{account}', f'{name}', f'{u_id}', f'{user_link}', f'{img}') + if i_tpye == '正常': if os.path.exists('ATRI/data/sqlite/setu/normal.db'): print('数据文件存在!') else: await session.send('数据库不存在,将在3秒后开始构建...') - time.sleep(3) + await asyncio.sleep(3) await session.send('开始构建数据库!') con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'normal.db') cur = con.cursor() @@ -54,7 +75,7 @@ async def _(session: CommandSession): con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'normal.db') cur = con.cursor() - cur.execute('INSERT INTO normal VALUES ("%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s")'%(pid, title, tags, account, name, u_id, user_link, img)) + cur.execute('INSERT INTO normal(pid, title, tags, account, name, u_id, user_link, img) VALUES(?, ?, ?, ?, ?, ?, ?, ?)', dataSETU) con.commit() con.close() @@ -63,7 +84,7 @@ async def _(session: CommandSession): print('数据文件存在!') else: await session.send('数据库不存在,将在3秒后开始构建...') - time.sleep(3) + await asyncio.sleep(3) await session.send('开始构建数据库!') con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'nearR18.db') cur = con.cursor() @@ -75,7 +96,7 @@ async def _(session: CommandSession): con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'nearR18.db') cur = con.cursor() - cur.execute('INSERT INTO nearR18 VALUES ("%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s")'%(pid, title, tags, account, name, u_id, user_link, img)) + cur.execute('INSERT INTO nearR18(pid, title, tags, account, name, u_id, user_link, img) VALUES(?, ?, ?, ?, ?, ?, ?, ?)', dataSETU) con.commit() con.close() @@ -84,7 +105,7 @@ async def _(session: CommandSession): print('数据文件存在!') else: await session.send('数据库不存在,将在3秒后开始构建...') - time.sleep(3) + await asyncio.sleep(3) await session.send('开始构建数据库!') con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'r18.db') cur = con.cursor() @@ -96,7 +117,7 @@ async def _(session: CommandSession): con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'r18.db') cur = con.cursor() - cur.execute('INSERT INTO r18 VALUES ("%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s")'%(pid, title, tags, account, name, u_id, user_link, img)) + cur.execute('INSERT INTO r18(pid, title, tags, account, name, u_id, user_link, img) VALUES(?, ?, ?, ?, ?, ?, ?, ?)', dataSETU) con.commit() con.close() @@ -106,7 +127,8 @@ async def _(session: CommandSession): @on_command('upload_cloudmusic', aliases = ['上传网抑语', '网抑云', '网易云'], only_to_me = False) async def _(session: CommandSession): - if session.event.user_id in master: + user = session.event.user_id + if user in master or user in cloudmusic: start = time.perf_counter() msg = session.event.raw_message.split(' ', 1) msg = msg[1] @@ -115,7 +137,7 @@ async def _(session: CommandSession): print('数据文件存在!') else: await session.send('数据库不存在,将在3秒后开始构建...') - time.sleep(3) + await asyncio.sleep(3) await session.send('开始构建数据库!') con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'cloudmusic' / 'cloudmusic.db') cur = con.cursor() @@ -127,10 +149,77 @@ async def _(session: CommandSession): con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'cloudmusic' / 'cloudmusic.db') cur = con.cursor() - cur.execute('INSERT INTO cloudmusic VALUES ("%s")'%(msg)) + cur.execute('INSERT INTO cloudmusic(msg) VALUES (?)', msg) con.commit() con.close() end = time.perf_counter() - await session.send(f'数据上传完成!\n耗时: {round(end - start, 3)}s')
\ No newline at end of file + await session.send(f'数据上传完成!\n耗时: {round(end - start, 3)}s') + + +@on_command('add_check_sepi', aliases=['添加涩批', '移除涩批'], only_to_me = False) +async def _(session: CommandSession): + if session.event.user_id in master: + msg = session.event.raw_message.split(' ', 1) + m_type = msg[0] + u = msg[1] + + if m_type == '添加涩批': + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'UploadSqlite' / 'sepi.json', 'r') as f: + data = json.load(f) + except: + data = {} + + data[f"{u}"] = f"{u}" + f = open(Path('.') / 'ATRI' / 'plugins' / 'UploadSqlite' / 'sepi.json', 'w') + f.write(json.dumps(data)) + f.close() + await session.send(f'成功添加涩批[{u}]!') + + elif m_type == '移除涩批': + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'UploadSqlite' / 'sepi.json', 'r') as f: + data = json.load(f) + except: + data = {} + + data.pop(f"{u}") + f = open(Path('.') / 'ATRI' / 'plugins' / 'UploadSqlite' / 'sepi.json', 'w') + f.write(json.dumps(data)) + f.close() + await session.send(f'成功移除涩批[{u}]!') + +@on_command('add_check_cd', aliases = ['添加抑郁', '移除抑郁'], only_to_me = False) +async def _(session: CommandSession): + if session.event.user_id in master: + msg = session.event.raw_message.split(' ', 1) + m_type = msg[0] + u = msg[1] + + if m_type == '添加抑郁': + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'UploadSqlite' / 'cloudmusic.json', 'r') as f: + data = json.load(f) + except: + data = {} + + data[f"{u}"] = f"{u}" + f = open(Path('.') / 'ATRI' / 'plugins' / 'UploadSqlite' / 'cloudmusic.json', 'w') + f.write(json.dumps(data)) + f.close() + await session.send(f'成功添加抑郁[{u}]!') + + elif m_type == '移除抑郁': + try: + with open(Path('.') / 'ATRI' / 'plugins' / 'UploadSqlite' / 'cloudmusic.json', 'r') as f: + data = json.load(f) + except: + data = {} + + data.pop(f"{u}") + f = open(Path('.') / 'ATRI' / 'plugins' / 'UploadSqlite' / 'cloudmusic.json', 'w') + f.write(json.dumps(data)) + f.close() + await session.send(f'成功移除抑郁[{u}]!')
\ No newline at end of file diff --git a/ATRI/plugins/UploadSqlite/cloudmusic.json b/ATRI/plugins/UploadSqlite/cloudmusic.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/ATRI/plugins/UploadSqlite/cloudmusic.json @@ -0,0 +1 @@ +{}
\ No newline at end of file diff --git a/ATRI/plugins/UploadSqlite/sepi.json b/ATRI/plugins/UploadSqlite/sepi.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/ATRI/plugins/UploadSqlite/sepi.json @@ -0,0 +1 @@ +{}
\ No newline at end of file diff --git a/ATRI/plugins/checkData.py b/ATRI/plugins/checkData.py deleted file mode 100644 index 6e4925b..0000000 --- a/ATRI/plugins/checkData.py +++ /dev/null @@ -1,66 +0,0 @@ -import json -import sqlite3 -from pathlib import Path -from nonebot import on_command, CommandSession - - - -@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(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobGroup.json', 'r') as f: - data = json.load(f) - except: - data = {} - - try: - with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', '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}""" - )
\ No newline at end of file diff --git a/ATRI/plugins/noobList/noobGroup.json b/ATRI/plugins/noobList/noobGroup.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/ATRI/plugins/noobList/noobGroup.json @@ -0,0 +1 @@ +{}
\ No newline at end of file diff --git a/ATRI/plugins/noobList/noobList.json b/ATRI/plugins/noobList/noobList.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/ATRI/plugins/noobList/noobList.json @@ -0,0 +1 @@ +{}
\ No newline at end of file diff --git a/ATRI/plugins/richBISS.py b/ATRI/plugins/richBISS.py index bea06af..949bcf0 100644 --- a/ATRI/plugins/richBISS.py +++ b/ATRI/plugins/richBISS.py @@ -78,6 +78,7 @@ async def Fuck_bili_rich(context): if bv: bv = bv[0] bv = bv.replace('?', '') + print(bv) aid = str(dec(bv)) ad = 'av' + aid diff --git a/ATRI/plugins/setu.py b/ATRI/plugins/setu.py index 3a667fb..dbc62b7 100644 --- a/ATRI/plugins/setu.py +++ b/ATRI/plugins/setu.py @@ -87,6 +87,7 @@ async def setu(session: CommandSession): if 1 <= res < 3: if setu_type == 1: res = randint(1,4) + await session.send('别急!正在找图!') con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'nearR18.db') cur = con.cursor() msg = cur.execute('SELECT * FROM nearR18 ORDER BY RANDOM() limit 1;') @@ -220,127 +221,135 @@ async def _(context): if str(user) in data1.keys(): pass else: - try: - img = str(context["message"]) - pattern = re.compile(r"url=(.*)]") - img = re.findall(pattern, img) - img = img[0].replace('url=', '') - img = img.replace(']', '') - print(img) - except: - return - img = b64_str_img_url(img) - if img: - host = f'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id={API_KEY}&client_secret={SECRECT_KEY}' - headers = { - 'Content-Type': 'application/json;charset=UTF-8' - } - res = json.loads(request_api_params(host, headers)) - access_token=res['access_token'] - url = f'https://aip.baidubce.com/rest/2.0/ocr/v1/general?access_token={access_token}' - headers = {'Content-Type': 'application/x-www-form-urlencoded'} - data = urlencode({'image': img}) - res = requests.post(url=url, headers=headers, data=data) - + with open(Path('.') / 'ATRI' / 'plugins' / 'switch' / 'switch.json', 'r') as f: + data1 = json.load(f) + + if data1["setu_img"] == "on": try: - words = json.loads(res.content)['words_result'][0]['words'] - print(words) + img = str(context["message"]) + pattern = re.compile(r"url=(.*)]") + img = re.findall(pattern, img) + img = img[0].replace('url=', '') + img = img.replace(']', '') + print(img) except: return - if re.findall(r"[涩色]图", words): - with open(Path('.') / 'ATRI' / 'plugins' / 'switch' / 'switch.json', 'r') as f: - data1 = json.load(f) + img = b64_str_img_url(img) + if img: + try: + host = f'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id={API_KEY}&client_secret={SECRECT_KEY}' + headers = { + 'Content-Type': 'application/json;charset=UTF-8' + } + res = json.loads(request_api_params(host, headers)) + access_token=res['access_token'] + url = f'https://aip.baidubce.com/rest/2.0/ocr/v1/general?access_token={access_token}' + headers = {'Content-Type': 'application/x-www-form-urlencoded'} + data = urlencode({'image': img}) + res = requests.post(url=url, headers=headers, data=data) + except: + return + + try: + words = json.loads(res.content)['words_result'][0]['words'] + print(words) + except: + return - if data1["setu"] == "on": - res = randint(1,10) - if 1 <= res < 9: - res = randint(1,4) - if 1 <= res < 3: - if setu_type == 1: - res = randint(1,4) - con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'nearR18.db') - cur = con.cursor() - msg = cur.execute('SELECT * FROM nearR18 ORDER BY RANDOM() limit 1;') - - if 1 <= res < 3: - for i in msg: - pid = i[0] - title = i[1] - img = i[7] + if re.findall(r"[涩色]图|炼铜", words): + with open(Path('.') / 'ATRI' / 'plugins' / 'switch' / 'switch.json', 'r') as f: + data1 = json.load(f) + + if data1["setu"] == "on": + res = randint(1,10) + if 1 <= res < 9: + res = randint(1,4) + if 1 <= res < 3: + if setu_type == 1: + res = randint(1,4) + con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'nearR18.db') + cur = con.cursor() + msg = cur.execute('SELECT * FROM nearR18 ORDER BY RANDOM() limit 1;') + + if 1 <= res < 3: + for i in msg: + pid = i[0] + title = i[1] + img = i[7] + end = time.perf_counter() + msg = SETU_REPLY.format( + title = title, + pid = pid, + setu = img, + time = round(end - start, 3) + ) + await bot.send_group_msg(group_id = group, message = msg) # type: ignore + elif res == 4: + for i in msg: + pid = i[0] + title = i[1] + img = i[7] + end = time.perf_counter() + await bot.send_group_msg(group_id = group, message = '我找到涩图了!但我发给主人了\nο(=•ω<=)ρ⌒☆') # type: ignore + await bot.send_private_msg( # type: ignore + user_id = master, + message = f"主人,从群{group}来的涩图!热乎着!\nTitle: {title}\nPid: {pid}\n{img}\nComplete time: {round(end - start, 3)}" + ) + + elif setu_type == 2: + res = randint(1,4) + await bot.send_group_msg(group_id = group, message = '别急!正在找图!') # type: ignore + start = time.perf_counter() + values = { + "apikey": apikey_LOLI, + "r18": "0", + "num": "1" + } + + try: + dc = json.loads(request_api_params(URL, values)) + title = dc["data"][0]["title"] + pid = dc["data"][0]["pid"] + setu = dc["data"][0]["url"] #b64.b64_str_img_url(dc["data"][0]["url"]) + except: + await bot.send_group_msg(group_id = group, message = '失败了失败了失...') # type: ignore + return + if 1 <= res < 3: end = time.perf_counter() msg = SETU_REPLY.format( - title = title, - pid = pid, - setu = img, - time = round(end - start, 3) - ) + title = title, + pid = pid, + setu = img, + time = round(end - start, 3) + ) await bot.send_group_msg(group_id = group, message = msg) # type: ignore - elif res == 4: - for i in msg: - pid = i[0] - title = i[1] - img = i[7] + elif res == 4: end = time.perf_counter() await bot.send_group_msg(group_id = group, message = '我找到涩图了!但我发给主人了\nο(=•ω<=)ρ⌒☆') # type: ignore await bot.send_private_msg( # type: ignore user_id = master, - message = f"主人,从群{group}来的涩图!热乎着!\nTitle: {title}\nPid: {pid}\n{img}\nComplete time: {round(end - start, 3)}" - ) - - elif setu_type == 2: - res = randint(1,4) - await bot.send_group_msg(group_id = group, message = '别急!正在找图!') # type: ignore - start = time.perf_counter() - values = { - "apikey": apikey_LOLI, - "r18": "0", - "num": "1" - } - - try: - dc = json.loads(request_api_params(URL, values)) - title = dc["data"][0]["title"] - pid = dc["data"][0]["pid"] - setu = dc["data"][0]["url"] #b64.b64_str_img_url(dc["data"][0]["url"]) - except: - await bot.send_group_msg(group_id = group, message = '失败了失败了失...') # type: ignore - return - if 1 <= res < 3: - end = time.perf_counter() - msg = SETU_REPLY.format( - title = title, - pid = pid, - setu = img, - time = round(end - start, 3) + message = f"主人,从群{group}来的涩图!热乎着!\nTitle: {title}\nPid: {pid}\n{setu}\nComplete time: {round(end - start, 3)}" ) - await bot.send_group_msg(group_id = group, message = msg) # type: ignore - elif res == 4: - end = time.perf_counter() - await bot.send_group_msg(group_id = group, message = '我找到涩图了!但我发给主人了\nο(=•ω<=)ρ⌒☆') # type: ignore - await bot.send_private_msg( # type: ignore - user_id = master, - message = f"主人,从群{group}来的涩图!热乎着!\nTitle: {title}\nPid: {pid}\n{setu}\nComplete time: {round(end - start, 3)}" - ) - elif res == 4: + elif res == 4: + img = choice( + [ + 'SP.jpg', 'SP1.jpg', 'SP2.jpg' + ] + ) + img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}' + img = os.path.abspath(img) + await bot.send_group_msg(group_id = group, message = f'[CQ:image,file=file:///{img}]') # type: ignore + + elif res == 10: img = choice( [ - 'SP.jpg', 'SP1.jpg', 'SP2.jpg' + 'GDZ.png', 'SHZY1.jpg', 'SHZY2.jpg', 'SHZY3.jpg', 'SHZY4.jpg', 'SHZY5.jpg', 'SHZY6.jpg' ] ) - img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}' + img = Path('.') / 'ATRI' / 'data' / 'img' / 'niceIMG' / f'{img}' img = os.path.abspath(img) await bot.send_group_msg(group_id = group, message = f'[CQ:image,file=file:///{img}]') # type: ignore - - elif res == 10: - img = choice( - [ - 'GDZ.png', 'SHZY1.jpg', 'SHZY2.jpg', 'SHZY3.jpg', 'SHZY4.jpg', 'SHZY5.jpg', 'SHZY6.jpg' - ] - ) - img = Path('.') / 'ATRI' / 'data' / 'img' / 'niceIMG' / f'{img}' - img = os.path.abspath(img) - await bot.send_group_msg(group_id = group, message = f'[CQ:image,file=file:///{img}]') # type: ignore - else: - pass
\ No newline at end of file + else: + pass
\ No newline at end of file diff --git a/ATRI/plugins/switch.py b/ATRI/plugins/switch.py index c92b5aa..264b93a 100644 --- a/ATRI/plugins/switch.py +++ b/ATRI/plugins/switch.py @@ -38,6 +38,9 @@ async def _(session: CommandSession): elif com == 'Setu': data["setu"] = "on" + elif com == 'SetuIMG': + data["setu_img"] = "on" + elif com == 'Hbook': data["hbook"] = "on" @@ -69,6 +72,9 @@ async def _(session: CommandSession): elif com == 'Setu': data["setu"] = "off" + elif com == 'SetuIMG': + data["setu_img"] = "off" + elif com == 'Hbook': data["hbook"] = "off" diff --git a/ATRI/plugins/switch/switch.json b/ATRI/plugins/switch/switch.json index 3f0c66a..a1954cf 100644 --- a/ATRI/plugins/switch/switch.json +++ b/ATRI/plugins/switch/switch.json @@ -1 +1 @@ -{"pixiv_seach_img": "on", "pixiv_seach_author": "on", "pixiv_daily_rank": "on", "approve_friend_add": "on", "approve_invite_join_group": "on", "setu": "on", "hbook": "on", "change_face": "on", "chouYou": "off"}
\ No newline at end of file +{"pixiv_seach_img": "on", "pixiv_seach_author": "off", "pixiv_daily_rank": "on", "approve_friend_add": "on", "approve_invite_join_group": "on", "setu": "on", "setu_img": "on", "hbook": "on", "change_face": "on", "chouYou": "off"}
\ No newline at end of file diff --git a/ATRI/plugins/welcome.py b/ATRI/plugins/welcome.py index b61c5bf..d727e5e 100644 --- a/ATRI/plugins/welcome.py +++ b/ATRI/plugins/welcome.py @@ -1,10 +1,8 @@ -import json import nonebot -from pathlib import Path from nonebot import on_notice from nonebot.notice_request import NoticeSession, RequestSession from nonebot.plugin import on_request -from aiocqhttp.exceptions import ActionFailed +from nonebot.helpers import send_to_superusers import config # type: ignore @@ -37,69 +35,11 @@ async def _(session: NoticeSession): @on_request('friend_add') async def _(session: RequestSession): user = session.event.user_id - await bot.send_private_msg( - user_id = master, # type: ignore - message = f'{user}\n想认识ATRI欸欸欸!!' - ) - - with open(Path('.') / 'ATRI' / 'plugins' / 'switch' / 'switch.json', 'r') as f: - data = json.load(f) - - if data["approve_friend_add"] == 0: - try: - await session.approve() - except ActionFailed as e: - print(e.retcode) - await bot.send_private_msg( - user_id = master, # type: ignore - message = '由于主人已同意ATRI接近陌生人,故请求已同意!' - ) - await bot.send_private_msg( - user_id = user, # type: ignore - message = f'初次见面,我是アトリ!咱可是高性能ですから~!\nATRI的使用方法(恁可少想有的没的8,老涩批):https://lolihub.icu/#/robot/user' - ) - - else: - await bot.send_private_msg( - user_id = master, # type: ignore - message = '由于主人不同意ATRI接近陌生人,故请求已回拒...' - ) - await bot.send_private_msg( - user_id = user, # type: ignore - message = f'主人似乎不想让ATRI接触陌生人呢...' - ) + await send_to_superusers(bot, f'{user}\n想认识ATRI欸欸欸!!') @on_request('group') async def _(session: RequestSession): - group = session.event.group_id - user = session.event.user_id - - with open(Path('.') / 'ATRI' / 'plugins' / 'switch' / 'switch.json', 'r') as f: - data = json.load(f) - - if session.event.sub_type == 'invite': - - if data["approve_invite_join_group"] == 0: - await session.bot.send_private_msg( - user_id = user, # type: ignore - message = '嗯哼?想邀请ATRI入群嘛,正好!咱主人想让咱出去看看大世界!' - ) - await session.bot.send_private_msg( - user_id = master, # type: ignore - message = f'ATRI收到一个新邀请:\n裙: {group}\n邀请人: {user}\n已同意' - ) - - try: - await session.approve() - except ActionFailed as e: - print(e.retcode) - - else: - await session.bot.send_private_msg( - user_id = user, # type: ignore - message = '主人告诉咱不能随便乱跑...\n作者联系方式:https://lolihub.icu/#/about' - ) - await session.bot.send_private_msg( - user_id = master, # type: ignore - message = f'ATRI收到一个新邀请:裙: {group}\n邀请人: {user}\n已拒绝' - )
\ No newline at end of file + if session.event.user_id == master: + await session.approve() + else: + await session.send(f'邀请入群请联系ATRI的主人[{master}]')
\ No newline at end of file |