summaryrefslogtreecommitdiff
path: root/ATRI/plugins/other.py
diff options
context:
space:
mode:
authorKyomotoi <[email protected]>2020-09-06 16:26:28 +0800
committerKyomotoi <[email protected]>2020-09-06 16:26:28 +0800
commita36b6ecc37491b5cbf8c8750d252fbd53dc301ca (patch)
tree330f6d3a8b85781462b3fc7a912cba68fcccdc35 /ATRI/plugins/other.py
parent0c7bc774e1af9e28c124d5b1a5bab7040e33dbc7 (diff)
downloadATRI-a36b6ecc37491b5cbf8c8750d252fbd53dc301ca.tar.gz
ATRI-a36b6ecc37491b5cbf8c8750d252fbd53dc301ca.tar.bz2
ATRI-a36b6ecc37491b5cbf8c8750d252fbd53dc301ca.zip
[Update]
Diffstat (limited to 'ATRI/plugins/other.py')
-rw-r--r--ATRI/plugins/other.py50
1 files changed, 45 insertions, 5 deletions
diff --git a/ATRI/plugins/other.py b/ATRI/plugins/other.py
index ac99de3..917a5e0 100644
--- a/ATRI/plugins/other.py
+++ b/ATRI/plugins/other.py
@@ -1,13 +1,16 @@
+import os
+import json
import random
import nonebot
import warnings
from datetime import datetime
from random import choice
+from pathlib import Path
from nonebot import on_command, CommandSession
from nonebot.helpers import render_expression
-import config # type: ignore
-from ATRI.modules.funcControl import checkNoob # type: ignore
+import config
+from ATRI.modules.funcControl import checkNoob
bot = nonebot.get_bot()
@@ -101,7 +104,7 @@ async def _(session: CommandSession):
)
)
-@on_command('关于', aliases = ['关于机器人'], only_to_me = False)
+@on_command('关于', aliases = ['关于'])
async def _(session: CommandSession):
user = session.event.user_id
group = session.event.group_id
@@ -114,7 +117,7 @@ async def _(session: CommandSession):
欢迎star~w!"""
)
-@on_command('help', aliases = ['帮助', '如何使用ATRI', '机器人帮助'], only_to_me = False)
+@on_command('help', aliases = ['帮助', '如何使用ATRI', '机器人帮助', '菜单'], only_to_me = False)
async def _(session: CommandSession):
user = session.event.user_id
group = session.event.group_id
@@ -169,4 +172,41 @@ async def _():
try:
RepoList = []
except:
- await bot.send_private_msg(user_id = master, message = f'红茶重置失败...请手动重启ATRI以重置红茶...') # type: ignore \ No newline at end of file
+ await bot.send_private_msg(user_id = master, message = f'红茶重置失败...请手动重启ATRI以重置红茶...') # type: ignore
+ return
+ print('红茶重置成功!')
+
+
+@on_command('switchLoad', aliases=['开关初始化'])
+async def _(session: CommandSession):
+ if session.event.user_id in master:
+ group_list = await session.bot.get_group_list() # type: ignore
+ g_list = len(group_list)
+
+ az = []
+ for group in group_list:
+ g = group['group_id']
+ try:
+ try:
+ os.mkdir(Path('.') / 'ATRI' / 'data' / 'groupData' / f'{g}')
+ except:
+ pass
+ data = {}
+ data["pixiv_seach_img"] = "on"
+ data["pixiv_seach_author"] = "on"
+ data["pixiv_daily_rank"] = "on"
+ data["setu"] = "on"
+ data["setu_img"] = "on"
+ data["anime_search"] = "on"
+ data["change_face"] = "on"
+ data["chouYou"] = "on"
+ data["saucenao_search"] = "on"
+ with open(Path('.') / 'ATRI' / 'data' / 'groupData' / f'{g}' / 'switch.json', 'w') as f:
+ f.write(json.dumps(data))
+ f.close()
+ az.append(group)
+ except:
+ pass
+ az = len(az)
+
+ await session.send(f'已初始化{az}个群,总共{g_list}个群') \ No newline at end of file