summaryrefslogtreecommitdiff
path: root/ATRI/plugins
diff options
context:
space:
mode:
authorKyomotoi <[email protected]>2020-08-24 18:09:04 +0800
committerKyomotoi <[email protected]>2020-08-24 18:09:04 +0800
commit27459db32dee5c70756aca40a4dfad8f7f90ad7b (patch)
tree68660052a2b5b3f89745bb12aaa9099aa5245fb7 /ATRI/plugins
parentc413c33b246bb49e31f070d781a8515bb61f7909 (diff)
downloadATRI-27459db32dee5c70756aca40a4dfad8f7f90ad7b.tar.gz
ATRI-27459db32dee5c70756aca40a4dfad8f7f90ad7b.tar.bz2
ATRI-27459db32dee5c70756aca40a4dfad8f7f90ad7b.zip
[Update]
Diffstat (limited to 'ATRI/plugins')
-rw-r--r--ATRI/plugins/AIchangeFace.py145
-rw-r--r--ATRI/plugins/BlackList.py1
-rw-r--r--ATRI/plugins/Chat0.py1103
-rw-r--r--ATRI/plugins/Chat1.py213
-rw-r--r--ATRI/plugins/Check.py96
-rw-r--r--ATRI/plugins/LearnRepo.py53
-rw-r--r--ATRI/plugins/Scheduler.py17
-rw-r--r--ATRI/plugins/animeSearch.py64
-rw-r--r--ATRI/plugins/hbook.py111
-rw-r--r--ATRI/plugins/hitokoto.py60
-rw-r--r--ATRI/plugins/other.py246
-rw-r--r--ATRI/plugins/pixiv.py347
-rw-r--r--ATRI/plugins/richBISS.py167
-rw-r--r--ATRI/plugins/setu.py444
-rw-r--r--ATRI/plugins/switch.py8
-rw-r--r--ATRI/plugins/switch/switch.json2
-rw-r--r--ATRI/plugins/welcome.py10
17 files changed, 1161 insertions, 1926 deletions
diff --git a/ATRI/plugins/AIchangeFace.py b/ATRI/plugins/AIchangeFace.py
index 4b2d76e..9431185 100644
--- a/ATRI/plugins/AIchangeFace.py
+++ b/ATRI/plugins/AIchangeFace.py
@@ -1,5 +1,4 @@
import os
-import json
import requests
import base64
import nonebot
@@ -10,12 +9,14 @@ from pathlib import Path
from nonebot import on_command, CommandSession
import config # type: ignore
+from ATRI.modules.funcControl import checkSwitch, checkNoob # type: ignore
bot = nonebot.get_bot()
master = config.MASTER()
key = config.FACE_KEY()
secret = config.FACE_SECRET()
+__plugin_name__ = "change_face"
def now_time():
@@ -74,94 +75,72 @@ def change_face(image_1, image_2, user, number=99):
async def AIchFace(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:
- await session.send(
- choice(
- [
- 'zzzz......',
- 'zzzzzzzz......',
- 'zzz...好涩哦..zzz....',
- '别...不要..zzz..那..zzz..',
- '嘻嘻..zzz..呐~..zzzz..'
- ]
- )
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
+ await session.send(
+ choice(
+ [
+ 'zzzz......',
+ 'zzzzzzzz......',
+ 'zzz...好涩哦..zzz....',
+ '别...不要..zzz..那..zzz..',
+ '嘻嘻..zzz..呐~..zzzz..'
+ ]
)
- else:
- with open(Path('.') / 'ATRI' / 'plugins' / 'switch' / 'switch.json', 'r') as f:
- data = json.load(f)
+ )
+ else:
+ if checkSwitch(__plugin_name__):
+ img1 = session.get('message1', prompt = '请发送需要换脸的图片')
+ img2 = session.get('message2', prompt = '请发送素材图片')
+
+ # 我承认了,我是取名废!
+ a = img1.split(',')
+ a = a[2].replace(']', '')
+ a = a.replace('url=', '')
+ imgres1 = requests.get(a)
+
+ b = img2.split(',')
+ b = b[2].replace(']', '')
+ b = b.replace('url=', '')
+ imgres2 = requests.get(b)
+
+ try:
+ file1 = f'ATRI/data/temp/face/{user}'
+ if not os.path.exists(file1):
+ os.mkdir(file1)
+ with open(file1 + '/img1.jpg', 'wb') as f:
+ f.write(imgres1.content)
+
+ file2 = f'ATRI/data/temp/face/{user}'
+ if not os.path.exists(file2):
+ os.mkdir(file2)
+ with open(file2 + '/img2.jpg', 'wb') as f:
+ f.write(imgres2.content)
+ except:
+ session.finish('请求数据貌似失败了...')
- if data["change_face"] == "on":
- img1 = session.get('message1', prompt = '请发送需要换脸的图片')
- print(img1)
- img2 = session.get('message2', prompt = '请发送素材图片')
-
- # 我承认了,我是取名废!
- a = img1.split(',')
- a = a[2].replace(']', '')
- a = a.replace('url=', '')
- print(a)
- imgres1 = requests.get(a)
-
- b = img2.split(',')
- b = b[2].replace(']', '')
- b = b.replace('url=', '')
- imgres2 = requests.get(b)
-
- try:
- file1 = f'ATRI/data/temp/face/{user}'
- if not os.path.exists(file1):
- os.mkdir(file1)
- with open(file1 + '/img1.jpg', 'wb') as f:
- f.write(imgres1.content)
-
- file2 = f'ATRI/data/temp/face/{user}'
- if not os.path.exists(file2):
- os.mkdir(file2)
- with open(file2 + '/img2.jpg', 'wb') as f:
- f.write(imgres2.content)
- except:
- session.finish('请求数据貌似失败了...')
-
- img1File = Path('.') / 'ATRI' / 'data' / 'temp' / 'face' / f'{user}' / 'img1.jpg'
- img2File = Path('.') / 'ATRI' / 'data' / 'temp' / 'face' / f'{user}' / 'img2.jpg'
-
- try:
- change_face(img1File, img2File, user, 1)
- except:
- session.finish('emm...貌似失败了呢......')
-
- time.sleep(0.5)
- doneIMG = Path('.') / 'ATRI' / 'data' / 'temp' / 'face' / f'{user}' / 'img3.jpg'
- img = os.path.abspath(doneIMG)
- await session.send(f'[CQ:image,file=file:///{img}]')
- files = f'ATRI/data/temp/face/{user}'
- os.remove(files)
-
- else:
- session.finish('该功能已关闭...')
+ img1File = Path('.') / 'ATRI' / 'data' / 'temp' / 'face' / f'{user}' / 'img1.jpg'
+ img2File = Path('.') / 'ATRI' / 'data' / 'temp' / 'face' / f'{user}' / 'img2.jpg'
+ try:
+ change_face(img1File, img2File, user, 1)
+ except:
+ session.finish('emm...貌似失败了呢......')
+
+ time.sleep(0.5)
+ doneIMG = Path('.') / 'ATRI' / 'data' / 'temp' / 'face' / f'{user}' / 'img3.jpg'
+ img = os.path.abspath(doneIMG)
+ await session.send(f'[CQ:image,file=file:///{img}]')
+ files = f'ATRI/data/temp/face/{user}'
+ os.remove(files)
+
+ else:
+ session.finish('该功能已关闭...')
@AIchFace.args_parser
async def _(session: CommandSession):
- if not session.is_first_run and session.current_arg.startswith('算了,'):
- session.switch(session.current_arg[len('算了,'):])
+ if not session.is_first_run and session.current_arg.startswith('算了'):
+ session.switch(session.current_arg[len('算了'):])
diff --git a/ATRI/plugins/BlackList.py b/ATRI/plugins/BlackList.py
index dd81e6b..202e551 100644
--- a/ATRI/plugins/BlackList.py
+++ b/ATRI/plugins/BlackList.py
@@ -1,4 +1,3 @@
-import time
import json
from pathlib import Path
from nonebot import on_command, CommandSession
diff --git a/ATRI/plugins/Chat0.py b/ATRI/plugins/Chat0.py
index 55b341f..c3be56b 100644
--- a/ATRI/plugins/Chat0.py
+++ b/ATRI/plugins/Chat0.py
@@ -10,10 +10,10 @@ from nonebot import on_command, scheduler
from nonebot import CommandSession
from apscheduler.triggers.date import DateTrigger
-from ATRI.modules import response # type: ignore
import config # type: ignore
+from ATRI.modules.response import request_api # type: ignore
+from ATRI.modules.funcControl import checkNoob # type: ignore
-# 手搓仿生人回复,争取破1MB!
bot = nonebot.get_bot()
master = config.MASTER()
@@ -49,586 +49,381 @@ def rmQQfromNoobLIST(user):
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 5.5 <= now_time() < 9:
- res = randint(1,2)
- if res == 1:
- await session.send(
- choice(
- [
- '啊......早上好...(哈欠)',
- '唔......吧唧...早上...哈啊啊~~~\n早上好......',
- '早上好......',
- '早上好呜......呼啊啊~~~~',
- '啊......早上好。\n昨晚也很激情呢!',
- '吧唧吧唧......怎么了...已经早上了么...',
- '早上好!',
- '......看起来像是傍晚,其实已经早上了吗?',
- '早上好......欸~~~脸好近呢'
- ]
- )
- )
-
- elif res == 2:
- voice = choice(
- [
- '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:
+ if checkNoob(user, group):
+ if 5.5 <= now_time() < 9:
+ res = randint(1,2)
+ if res == 1:
await session.send(
choice(
[
- '哼!这个点还早啥,昨晚干啥去了!?',
- '熬夜了对吧熬夜了对吧熬夜了对吧???!',
- '是不是熬夜是不是熬夜是不是熬夜?!'
+ '啊......早上好...(哈欠)',
+ '唔......吧唧...早上...哈啊啊~~~\n早上好......',
+ '早上好......',
+ '早上好呜......呼啊啊~~~~',
+ '啊......早上好。\n昨晚也很激情呢!',
+ '吧唧吧唧......怎么了...已经早上了么...',
+ '早上好!',
+ '......看起来像是傍晚,其实已经早上了吗?',
+ '早上好......欸~~~脸好近呢'
]
)
)
- elif 18 <= now_time() < 24:
- await session.send(
- choice(
- [
- '早个啥?哼唧!我都准备洗洗睡了!',
- '不是...你看看几点了,哼!',
- '晚上好哇'
- ]
- )
+ elif res == 2:
+ voice = choice(
+ [
+ 'ohayo1.amr', 'ohayo2.amr', 'ohayo3.amr', 'ohayo4.amr'
+ ]
)
-
- elif 0 <= now_time() < 5.5:
- await session.send(
- choice(
- [
- 'zzzz......',
- 'zzzzzzzz......',
- 'zzz...好涩哦..zzz....',
- '别...不要..zzz..那..zzz..',
- '嘻嘻..zzz..呐~..zzzz..',
- '...zzz....哧溜哧溜....'
- ]
- )
+ 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(
+ choice(
+ [
+ '哼!这个点还早啥,昨晚干啥去了!?',
+ '熬夜了对吧熬夜了对吧熬夜了对吧???!',
+ '是不是熬夜是不是熬夜是不是熬夜?!'
+ ]
+ )
+ )
+
+ elif 18 <= now_time() < 24:
+ await session.send(
+ choice(
+ [
+ '早个啥?哼唧!我都准备洗洗睡了!',
+ '不是...你看看几点了,哼!',
+ '晚上好哇'
+ ]
+ )
+ )
+
+ elif 0 <= now_time() < 5.5:
+ await session.send(
+ choice(
+ [
+ 'zzzz......',
+ 'zzzzzzzz......',
+ 'zzz...好涩哦..zzz....',
+ '别...不要..zzz..那..zzz..',
+ '嘻嘻..zzz..呐~..zzzz..',
+ '...zzz....哧溜哧溜....'
+ ]
)
+ )
@on_command('noon', 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 11 <= now_time() <= 15:
- await session.send(
- choice(
- [
- '午安w','午觉要好好睡哦,ATRI会陪伴在你身旁的w',
- '嗯哼哼~睡吧,就像平常一样安眠吧~o(≧▽≦)o',
- '睡你午觉去!哼唧!!'
- ]
- )
+ if checkNoob(user, group):
+ if 11 <= now_time() <= 15:
+ await session.send(
+ choice(
+ [
+ '午安w','午觉要好好睡哦,ATRI会陪伴在你身旁的w',
+ '嗯哼哼~睡吧,就像平常一样安眠吧~o(≧▽≦)o',
+ '睡你午觉去!哼唧!!'
+ ]
)
+ )
@on_command('night', patterns = [r"晚安|oyasuminasai|おやすみなさい"], 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 5.5 <= now_time() < 11:
- await session.send(
- choice(
- [
- '你可猝死算了吧!',
- '?啊这',
- '亲,这边建议赶快去睡觉呢~~~',
- '不可忍不可忍不可忍!!为何这还不猝死!!'
- ]
- )
+ if checkNoob(user, group):
+ if 5.5 <= now_time() < 11:
+ await session.send(
+ choice(
+ [
+ '你可猝死算了吧!',
+ '?啊这',
+ '亲,这边建议赶快去睡觉呢~~~',
+ '不可忍不可忍不可忍!!为何这还不猝死!!'
+ ]
)
-
- elif 11 <= now_time() < 15:
- await session.send(
- choice(
- [
- '午安w','午觉要好好睡哦,ATRI会陪伴在你身旁的w',
- '嗯哼哼~睡吧,就像平常一样安眠吧~o(≧▽≦)o',
- '睡你午觉去!哼唧!!'
- ]
- )
+ )
+
+ elif 11 <= now_time() < 15:
+ await session.send(
+ choice(
+ [
+ '午安w','午觉要好好睡哦,ATRI会陪伴在你身旁的w',
+ '嗯哼哼~睡吧,就像平常一样安眠吧~o(≧▽≦)o',
+ '睡你午觉去!哼唧!!'
+ ]
)
-
- elif 15 <= now_time() < 19:
+ )
+
+ elif 15 <= now_time() < 19:
+ await session.send(
+ choice(
+ [
+ '难不成??晚上不想睡觉??现在休息',
+ '就......挺离谱的...现在睡觉',
+ '现在还是白天哦,睡觉还太早了'
+ ]
+ )
+ )
+
+ elif 19 <= now_time() < 24:
+ res = randint(1,2)
+ if res == 1:
await session.send(
choice(
[
- '难不成??晚上不想睡觉??现在休息',
- '就......挺离谱的...现在睡觉',
- '现在还是白天哦,睡觉还太早了'
+ '嗯哼哼~睡吧,就像平常一样安眠吧~o(≧▽≦)o',
+ '......(打瞌睡)',
+ '呼...呼...已经睡着了哦~...呼......',
+ '......我、我会在这守着你的,请务必好好睡着'
]
)
)
- elif 19 <= now_time() < 24:
- 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(
- choice(
- [
- 'zzzz......',
- 'zzzzzzzz......',
- 'zzz...好涩哦..zzz....',
- '别...不要..zzz..那..zzz..',
- '嘻嘻..zzz..呐~..zzzz..'
- ]
- )
+ 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(
+ choice(
+ [
+ 'zzzz......',
+ 'zzzzzzzz......',
+ 'zzz...好涩哦..zzz....',
+ '别...不要..zzz..那..zzz..',
+ '嘻嘻..zzz..呐~..zzzz..'
+ ]
)
+ )
@on_command('az', patterns = [r"[aA][zZ]|[阿啊]这"], only_to_me = False)
async def az(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():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
pass
else:
- if 0 <= now_time() < 5.5:
- pass
- else:
- res = randint(1,3)
- if res == 1:
- # res = random.randint(1,10)
- img = choice(
- [
- 'AZ.jpg', 'AZ1.jpg'
- ]
- )
- img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}'
- img = os.path.abspath(img)
- await session.send(f'[CQ:image,file=file:///{img}]')
+ res = randint(1,3)
+ if res == 1:
+ # res = random.randint(1,10)
+ img = choice(
+ [
+ 'AZ.jpg', 'AZ1.jpg'
+ ]
+ )
+ img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}'
+ img = os.path.abspath(img)
+ await session.send(f'[CQ:image,file=file:///{img}]')
@on_command('suki', patterns = [r"喜欢|爱你|爱|suki|daisuki|すき|好き|贴贴|老婆|[Mm][Uu][Aa]|亲一个"], only_to_me = True)
async def az(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():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
pass
else:
- if 0 <= now_time() < 5.5:
- pass
- else:
+ res = randint(1,3)
+ if res == 1:
+ # res = random.randint(1,10)
+ img = choice(
+ [
+ '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 res == 2:
+ img = choice(
+ [
+ 'TZ.jpg', 'TZ1.jpg', 'TZ2.jpg'
+ ]
+ )
+ img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}'
+ img = os.path.abspath(img)
+ await session.send(f'[CQ:image,file=file:///{img}]')
+
+ elif res == 3:
+ voice = choice(
+ [
+ 'suki1.amr', 'suki2.amr'
+ ]
+ )
+ 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|给[爷👴]爬|嘴臭"])
+async def _(session: CommandSession):
+ user = session.event.user_id
+ group = session.event.group_id
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
+ pass
+ else:
+ if randint(1,2) == 1:
res = randint(1,3)
if res == 1:
- # res = random.randint(1,10)
- img = choice(
- [
- '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 res == 2:
img = choice(
[
- 'TZ.jpg', 'TZ1.jpg', 'TZ2.jpg'
+ 'WQ.jpg', 'WQ.png', 'WQ1.jpg', 'WQ2.jpg', 'FN.jpg'
]
)
img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}'
img = os.path.abspath(img)
await session.send(f'[CQ:image,file=file:///{img}]')
-
- elif res == 3:
- voice = choice(
- [
- 'suki1.amr', 'suki2.amr'
- ]
- )
- 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|给[爷👴]爬|嘴臭"])
-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:
+ elif res == 2:
res = randint(1,3)
if res == 1:
- img = choice(
- [
- 'WQ.jpg', 'WQ.png', 'WQ1.jpg', 'WQ2.jpg', 'FN.jpg'
- ]
- )
- img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}'
- img = os.path.abspath(img)
- await session.send(f'[CQ:image,file=file:///{img}]')
-
+ 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:
- 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}]')
+ 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(response.request_api(KC_URL))
+ 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(request_api(KC_URL))
@on_command('ciallo', patterns = [r"[Cc][iI][aA][lL][lL][oO]"], 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():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
pass
else:
- if 0 <= now_time() < 5.5:
- pass
- else:
- if randint(1,2) == 1:
- res = randint(1,2)
- if res == 1:
- img = choice(
- [
- 'CIALLO.jpg', 'CIALLO1.jpg', 'CIALLO2.jpg', 'CIALLO3.jpg', 'CIALLO4.jpg', 'CIALLO5.jpg'
- ]
- )
- img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}'
- img = os.path.abspath(img)
- await session.send(f'[CQ:image,file=file:///{img}]')
-
- elif res == 2:
- await session.send('Ciallo~(∠・ω< )⌒★')
+ if randint(1,2) == 1:
+ res = randint(1,2)
+ if res == 1:
+ img = choice(
+ [
+ 'CIALLO.jpg', 'CIALLO1.jpg', 'CIALLO2.jpg', 'CIALLO3.jpg', 'CIALLO4.jpg', 'CIALLO5.jpg'
+ ]
+ )
+ img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}'
+ img = os.path.abspath(img)
+ await session.send(f'[CQ:image,file=file:///{img}]')
+
+ elif res == 2:
+ await session.send('Ciallo~(∠・ω< )⌒★')
@on_command('ne', 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():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
pass
else:
- if 0 <= now_time() < 5.5:
- pass
- else:
- if randint(1,3) == 1:
- await session.send(
- choice(
- [
- '呐', '呐呐呐', 'ねえ', 'ねえねえ'
- ]
- )
+ if randint(1,3) == 1:
+ await session.send(
+ choice(
+ [
+ '呐', '呐呐呐', 'ねえ', 'ねえねえ'
+ ]
)
+ )
@on_command('kani', patterns = [r"螃蟹|🦀|カニ|[kK]ani"], 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():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
pass
else:
- if 0 <= now_time() < 5.5:
- pass
- else:
- if randint(1,2) == 1:
- img = choice(
- [
- 'KN.png', 'KN.jpg', 'KN1.jpg', 'KN2.jpg', 'KN3.png'
- ]
- )
- 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}]')
+ if randint(1,2) == 1:
+ img = choice(
+ [
+ 'KN.png', 'KN.jpg', 'KN1.jpg', 'KN2.jpg', 'KN3.png'
+ ]
+ )
+ 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):
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():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
pass
else:
- if 0 <= now_time() < 5.5:
- pass
- else:
- if randint(1,2) == 1:
- img = Path('.') / 'ATRI' / 'data' / 'emoji' / 'H.jpg'
- img = os.path.abspath(img)
- await session.send(f'[CQ:image,file=file:///{img}]')
+ if randint(1,2) == 1:
+ img = Path('.') / 'ATRI' / 'data' / 'emoji' / 'H.jpg'
+ img = os.path.abspath(img)
+ await session.send(f'[CQ:image,file=file:///{img}]')
@on_command('jz', 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():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
pass
else:
- if 0 <= now_time() < 5.5:
- pass
- else:
- if randint(1,2) == 1:
- img = choice(
- [
- 'JZ.png', 'JZ1.png'
- ]
- )
- img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}'
- img = os.path.abspath(img)
- await session.send(f'[CQ:image,file=file:///{img}]')
+ if randint(1,2) == 1:
+ img = choice(
+ [
+ 'JZ.png', 'JZ1.png'
+ ]
+ )
+ img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}'
+ img = os.path.abspath(img)
+ await session.send(f'[CQ:image,file=file:///{img}]')
@on_command('hai', 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():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
pass
else:
- if 0 <= now_time() < 5.5:
- pass
- else:
- if randint(1,2) == 1:
- img = Path('.') / 'ATRI' / 'data' / 'emoji' / 'H.jpg'
- img = os.path.abspath(img)
- await session.send(f'[CQ:image,file=file:///{img}]')
+ if randint(1,2) == 1:
+ img = Path('.') / 'ATRI' / 'data' / 'emoji' / 'H.jpg'
+ img = os.path.abspath(img)
+ await session.send(f'[CQ:image,file=file:///{img}]')
@on_command('high_per', patterns = [r"高性能|[太最][棒好强猛]|[tT][qQ][lL]|[🐂牛nN][🍺批bB]|すごい|sugoi|[斯死]国一|よかった"])
async def _(session: CommandSession):
user = session.event.user_id
group = session.event.group_id
msg = str(session.event.message)
- 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():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
pass
else:
pat = r"草你妈|操|你妈|脑瘫|废柴|fw|five|废物|战斗|爬|爪巴|sb|SB|啥[b批比逼]|傻b|给[爷👴]爬|嘴臭"
@@ -661,21 +456,8 @@ async def _(session: CommandSession):
user = session.event.user_id
group = session.event.group_id
msg = str(session.event.message)
- 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():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
pass
else:
pat = r"草你妈|操|你妈|脑瘫|废柴|fw|five|废物|战斗|爬|爪巴|sb|SB|啥[b批比逼]|傻b|给[爷👴]爬|嘴臭"
@@ -701,21 +483,8 @@ async def _(session: CommandSession):
user = session.event.user_id
group = session.event.group_id
msg = str(session.event.message)
- 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():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
pass
else:
pat = r"草你妈|操|你妈|脑瘫|废柴|fw|five|废物|战斗|爬|爪巴|sb|SB|啥[b批比逼]|傻b|给[爷👴]爬|嘴臭"
@@ -746,131 +515,83 @@ async def _(session: CommandSession):
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():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
pass
else:
- if 0 <= now_time() < 5.5:
- pass
- else:
- if randint(1,2) == 1:
- await session.send('不许好!憋回去!')
+ 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():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
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 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}]')
+ 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
+ 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
+ if checkNoob(user, group):
+ if user == master:
+ await session.send('那...请主人自己闭上眼!哼唧')
+ return
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,
- )
+ 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)
@@ -878,51 +599,84 @@ async def _(session: CommandSession):
global noobList0
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():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
pass
else:
- if 0 <= now_time() < 5.5:
- pass
- else:
- 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) == 1:
- await session.send('萝卜子是对机器人的蔑称!')
-
- elif countX(noobList0, user) == 2:
+ 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) == 1:
+ await session.send('萝卜子是对机器人的蔑称!')
+
+ elif countX(noobList0, user) == 2:
+ if user == master:
+ await session.send('是主人的话...那算了...呜呜\n即使到达了ATRI的最低忍耐限度......')
+ noobList0 = list(set(noobList0))
+ pass
+
+ 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)
+async def _(session: CommandSession):
+ global noobList1
+ user = session.event.user_id
+ group = session.event.group_id
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
+ pass
+ else:
+ msg = str(session.event.message)
+ 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('你妈的,牛头人,' + request_api(KC_URL))
+ noobList1.append(user)
+ print(noobList1)
+ print(countX(noobList1, user))
+ if countX(noobList1, user) == 5:
if user == master:
await session.send('是主人的话...那算了...呜呜\n即使到达了ATRI的最低忍耐限度......')
- noobList0 = list(set(noobList0))
+ noobList1 = list(set(noobList1))
pass
else:
- await session.send('是亚托莉......萝卜子可是对机器人的蔑称......\n这是第二次警告哦,接下来5分钟我不会再理你了!哼唧!')
+ await session.send(f'[CQ:at,qq={user}]哼!接下来10分钟别想让我理你!')
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)
+ noobList1 = list(set(noobList1))
+ print(noobList1)
+ delta = timedelta(minutes = 10)
trigger = DateTrigger(
run_date = datetime.now() + delta
)
@@ -932,69 +686,4 @@ async def _(session: CommandSession):
trigger = trigger,
args = (session.event.user_id,),
misfire_grace_time = 60,
- )
-
-noobList1 = []
-@on_command('ntr', patterns = [r"[nNηиɴИ][tT][rR]|[牛🐂]头人"], only_to_me = False)
-async def _(session: CommandSession):
- global noobList1
- 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:
- msg = str(session.event.message)
- 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))
- noobList1.append(user)
- print(noobList1)
- print(countX(noobList1, user))
- if countX(noobList1, user) == 5:
- if user == master:
- await session.send('是主人的话...那算了...呜呜\n即使到达了ATRI的最低忍耐限度......')
- noobList1 = list(set(noobList1))
- pass
-
- else:
- await session.send(f'[CQ:at,qq={user}]哼!接下来10分钟别想让我理你!')
- bL[f"{user}"] = f"{user}"
- file = Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json'
- f = open(file, 'w')
- f.write(json.dumps(bL))
- f.close()
- noobList1 = list(set(noobList1))
- print(noobList1)
- delta = timedelta(minutes = 10)
- 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,
- ) \ No newline at end of file
+ ) \ No newline at end of file
diff --git a/ATRI/plugins/Chat1.py b/ATRI/plugins/Chat1.py
index 637ff93..47c8fdf 100644
--- a/ATRI/plugins/Chat1.py
+++ b/ATRI/plugins/Chat1.py
@@ -1,13 +1,12 @@
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
+from ATRI.modules.funcControl import checkNoob # type: ignore
bot = nonebot.get_bot()
@@ -26,180 +25,100 @@ def now_time():
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():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
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}]')
+ 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():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
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(
+ if randint(1,3) == 1:
+ res = randint(1,5)
+ if 1 <= res < 2:
+ await session.send(
+ 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:
+
+ elif 2 <= res <= 5:
img = choice(
[
- 'YIQI_YES.png', 'YIQI_NO.jpg', 'KD.jpg', 'FD.jpg'
+ 'WH.jpg', 'WH1.jpg', 'WH2.jpg', 'WH3.jpg', 'WH4.jpg'
]
)
- img = os.path.abspath(Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}')
+ img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}'
+ img = os.path.abspath(img)
await session.send(f'[CQ:image,file=file:///{img}]')
-@on_command('ysdd', aliases = [r"原声大碟"])
+@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():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
pass
else:
- voice = Path('.') / 'ATRI' / 'data' / 'voice' / 'ysdd.amr'
- voice = os.path.abspath(voice)
- await session.send(f'[CQ:record,file=file:///{voice}]')
+ 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
+ if checkNoob(user, group):
+ voice = Path('.') / 'ATRI' / 'data' / 'voice' / 'ysdd.amr'
+ voice = os.path.abspath(voice)
+ await session.send(f'[CQ:record,file=file:///{voice}]')
@bot.on_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():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
pass
else:
- if 0 <= now_time() < 5.5:
- pass
+ 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:
- 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
+ pass \ No newline at end of file
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)
diff --git a/ATRI/plugins/LearnRepo.py b/ATRI/plugins/LearnRepo.py
index f533655..c87f863 100644
--- a/ATRI/plugins/LearnRepo.py
+++ b/ATRI/plugins/LearnRepo.py
@@ -7,6 +7,7 @@ from nonebot import on_command
from nonebot import CommandSession
import config # type: ignore
+from ATRI.modules.funcControl import checkNoob # type: ignore
bot = nonebot.get_bot()
@@ -54,49 +55,29 @@ async def _(session: CommandSession):
else:
session.finish(f'ATRI貌似没法从记忆中找到关键词[{word}]呢...')
-# @on_command('add_tech', aliases = ['添加'])
-
@bot.on_message("group")
async def repo(context):
user = context["user_id"]
group = context["group_id"]
word = context["message"]
- print(word)
if 0 <= now_time() < 5.5:
pass
else:
- 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:
- try:
- with open(Path('.') / 'ATRI' / 'plugins' / 'LearnRepo' / 'LearnRepo.json', 'r') as f:
- data = json.load(f)
- except:
- data = {}
+ if checkNoob(user, group):
+ try:
+ with open(Path('.') / 'ATRI' / 'plugins' / 'LearnRepo' / 'LearnRepo.json', 'r') as f:
+ data = json.load(f)
+ except:
+ data = {}
- if str(word) in data.keys():
- lt = data[f"{word}"]
- print(lt)
- msg = lt[0]
- prob = int(lt[1])
- res = randint(1,prob)
- if res == 1:
- await bot.send_msg(
- group_id = group,
- message = msg
- ) # type: ignore \ No newline at end of file
+ if str(word) in data.keys():
+ lt = data[f"{word}"]
+ msg = lt[0]
+ prob = int(lt[1])
+ res = randint(1,prob)
+ if res == 1:
+ await bot.send_msg(
+ group_id = group,
+ message = msg
+ ) # type: ignore \ No newline at end of file
diff --git a/ATRI/plugins/Scheduler.py b/ATRI/plugins/Scheduler.py
index 100ee3b..f6f8a1a 100644
--- a/ATRI/plugins/Scheduler.py
+++ b/ATRI/plugins/Scheduler.py
@@ -16,7 +16,7 @@ master = config.MASTER()
@nonebot.scheduler.scheduled_job(
'cron',
hour = 7,
- misfire_grace_time= 600
+ misfire_grace_time= 60
)
async def _():
"""早安"""
@@ -44,7 +44,7 @@ async def _():
try:
for group in groups:
- time.sleep(randint(60,90))
+ time.sleep(randint(1,5))
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
@@ -58,7 +58,7 @@ async def _():
@nonebot.scheduler.scheduled_job(
'cron',
hour = 22,
- misfire_grace_time = 600
+ misfire_grace_time = 60
)
async def _():
"""晚安"""
@@ -82,7 +82,7 @@ async def _():
try:
for group in groups:
- time.sleep(randint(60,90))
+ time.sleep(randint(1,5))
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
@@ -95,8 +95,8 @@ async def _():
@nonebot.scheduler.scheduled_job(
'cron',
- hour = 0,
- misfire_grace_time = 600
+ hour = 24,
+ misfire_grace_time = 60
)
async def _():
"""到 点 了"""
@@ -111,7 +111,7 @@ async def _():
try:
for group in groups:
- time.sleep(randint(60,90))
+ time.sleep(randint(1,5))
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
@@ -128,6 +128,7 @@ async def _():
misfire_grace_time= 10
)
async def _():
+ print('ATRI开始自检...')
cpu = psutil.cpu_percent(interval=1)
memory = psutil.virtual_memory().percent
disk = psutil.disk_usage('/').percent
@@ -152,4 +153,4 @@ async def _():
) # type: ignore
else:
- pass \ No newline at end of file
+ print('ATRI运作正常!') \ No newline at end of file
diff --git a/ATRI/plugins/animeSearch.py b/ATRI/plugins/animeSearch.py
index 5323e53..a237b06 100644
--- a/ATRI/plugins/animeSearch.py
+++ b/ATRI/plugins/animeSearch.py
@@ -1,11 +1,14 @@
import re
import json
-from pathlib import Path
from datetime import datetime
from random import choice
from aiohttp import ClientSession
from nonebot import on_command, CommandSession
+from ATRI.modules.funcControl import checkSwitch, checkNoob # type: ignore
+
+
+__plugin_name__ = "anime_search"
async def get_bytes(url, headers = None):
async with ClientSession() as asyncSession:
@@ -55,42 +58,27 @@ def toSimpleString(str):
return "".join(output_str_list)
-@on_command('anime_search', aliases = ['以图搜番'], only_to_me = False
-)
-async def _(session: CommandSession):
+@on_command('anime_search', aliases = ['以图搜番'], only_to_me = False)
+async def AnimeSearch(session: CommandSession):
user = session.event.user_id
group = session.event.group_id
msg = session.current_arg.strip()
- 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:
- await session.send(
- choice(
- [
- 'zzzz......',
- 'zzzzzzzz......',
- 'zzz...好涩哦..zzz....',
- '别...不要..zzz..那..zzz..',
- '嘻嘻..zzz..呐~..zzzz..'
- ]
- )
+
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
+ await session.send(
+ choice(
+ [
+ 'zzzz......',
+ 'zzzzzzzz......',
+ 'zzz...好涩哦..zzz....',
+ '别...不要..zzz..那..zzz..',
+ '嘻嘻..zzz..呐~..zzzz..'
+ ]
)
- else:
+ )
+ else:
+ if checkSwitch(__plugin_name__):
if not msg:
msg = session.get('message', prompt = "请发送一张图片")
@@ -145,4 +133,12 @@ async def _(session: CommandSession):
await session.send(msg0)
else:
- await session.send("搜索似乎失败了呢...") \ No newline at end of file
+ await session.send("搜索似乎失败了呢...")
+
+ else:
+ session.finish('该功能已关闭...')
+
+async def _(session: CommandSession):
+ if not session.is_first_run and session.current_arg.startswith('算了'):
+ session.switch(session.current_arg[len('算了'):]) \ No newline at end of file
diff --git a/ATRI/plugins/hbook.py b/ATRI/plugins/hbook.py
deleted file mode 100644
index 465d3b1..0000000
--- a/ATRI/plugins/hbook.py
+++ /dev/null
@@ -1,111 +0,0 @@
-import re
-import time
-import json
-from pathlib import Path
-from datetime import datetime
-from random import choice
-from nonebot import on_command, CommandSession
-
-from ATRI.modules import response # type: ignore
-
-
-def now_time():
- now_ = datetime.now()
- hour = now_.hour
- minute = now_.minute
- now = hour + minute / 60
- return now
-
-
-pattern = r"来(.*?)[点丶份张幅](.*?)的?本子"
-
-@on_command('hbook', patterns = pattern, only_to_me = False)
-async def _(session: CommandSession):
- h_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(h_user) in data1.keys():
- pass
- else:
- if 0 <= now_time() < 5.5:
- await session.send(
- choice(
- [
- 'zzzz......',
- 'zzzzzzzz......',
- 'zzz...好涩哦..zzz....',
- '别...不要..zzz..那..zzz..',
- '嘻嘻..zzz..呐~..zzzz..'
- ]
- )
- )
- else:
- with open(Path('.') / 'ATRI' / 'plugins' / 'switch' / 'switch.json', 'r') as f:
- data = json.load(f)
-
- if data["hbook"] == "on":
- num = 1
- tag = ''
- start = time.perf_counter()
- h_msg = str(session.event.message)
-
- info = re.findall(pattern, h_msg)
- if info:
- num = int(info[0][0] or 1)
- tag = str(info[0][1])
- if num > 5:
- await session.send('你是不是涩批啊!要那么多干啥?!我最多发5份!')
- num = 5
-
- h_type = session.event.detail_type
-
- try:
- header = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36'}
- keyword = {'show':'title,titleen,tags','keyboard':tag}
- print(keyword)
-
- res = await response.post_bytes('https://b-upp.com/search/', headers=header, data=keyword)
- res = res.decode()
- except:
- session.finish('貌似请求数据失败了...')
-
- if '没有搜索到相关的内容' in res:
- n_msg = '...似乎没有找到[{}]相关的本子呢'.format(tag)
- await session.send(message=n_msg)
-
- else:
- p = '<a href="(.*?)" target="_blank" title="(.*?)">'
- data = re.findall(p,res)
- n = len(data)
- limit = num
-
- if n > limit: # type: ignore
- n = limit # type: ignore
-
- msg = f'据提供信息,已查询到{n}本关键词为[{tag}]的本子:'
- if h_type == 'group':
- msg = f'[CQ:at,qq={h_user}]\n根据提供信息,已查询到{n}本关键词为[{tag}]的本子:'
- for i in range(n):
- msg0 = ('\n——————————\n本子链接:https://b-upp.com%s \n本子标题:%s '%(data[i]))
- msg += msg0
- end = time.perf_counter()
- msg0 = f'\n——————————\n耗时: {round(end - start, 3)}s'
- msg += msg0
-
- await session.send(msg)
-
- else:
- await session.send('该功能已禁用...') \ No newline at end of file
diff --git a/ATRI/plugins/hitokoto.py b/ATRI/plugins/hitokoto.py
index e72a37e..2da9eef 100644
--- a/ATRI/plugins/hitokoto.py
+++ b/ATRI/plugins/hitokoto.py
@@ -1,11 +1,11 @@
import json
from datetime import datetime
from random import choice
-from pathlib import Path
from nonebot import on_command, on_natural_language, CommandSession
from nonebot import NLPSession, NLPResult
from ATRI.modules import response # type: ignore
+from ATRI.modules.funcControl import checkNoob # type: ignore
def now_time():
@@ -23,44 +23,28 @@ url = 'https://api.imjad.cn/hitokoto/?cat=a&charset=utf-8&length=50&encode=json&
async def hitokoto(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:
- await session.send(
- choice(
- [
- 'zzzz......',
- 'zzzzzzzz......',
- 'zzz...好涩哦..zzz....',
- '别...不要..zzz..那..zzz..',
- '嘻嘻..zzz..呐~..zzzz..'
- ]
- )
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
+ await session.send(
+ choice(
+ [
+ 'zzzz......',
+ 'zzzzzzzz......',
+ 'zzz...好涩哦..zzz....',
+ '别...不要..zzz..那..zzz..',
+ '嘻嘻..zzz..呐~..zzzz..'
+ ]
)
- else:
- rep = response.request_api(url)
-
- if not rep:
- session.finish('获取失败')
-
- dc = json.loads(response.request_api(url))
-
- await session.send(dc["hitokoto"])
+ )
+ else:
+ rep = response.request_api(url)
+
+ if not rep:
+ session.finish('获取失败')
+
+ dc = json.loads(response.request_api(url))
+
+ await session.send(dc["hitokoto"])
@on_natural_language('一言', only_to_me = False)
async def _(session: NLPSession):
diff --git a/ATRI/plugins/other.py b/ATRI/plugins/other.py
index 5946905..c67204f 100644
--- a/ATRI/plugins/other.py
+++ b/ATRI/plugins/other.py
@@ -1,13 +1,13 @@
-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
bot = nonebot.get_bot()
@@ -21,6 +21,14 @@ def now_time():
now = hour + minute / 60
return now
+def countX(lst, x):
+ warnings.simplefilter('ignore', ResourceWarning)
+ count = 0
+ for ele in lst:
+ if (ele == x):
+ count = count + 1
+ return count
+
HELP_REPLY = (
'ええと...让我想想...',
@@ -34,181 +42,93 @@ HELP_REPLY = (
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
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
+ await session.send(
+ choice(
+ [
+ 'zzzz......',
+ 'zzzzzzzz......',
+ 'zzz...好涩哦..zzz....',
+ '别...不要..zzz..那..zzz..',
+ '嘻嘻..zzz..呐~..zzzz..'
+ ]
+ )
+ )
else:
- if 0 <= now_time() < 5.5:
- await session.send(
- choice(
+ await session.send(
+ str(
+ random.choice(
[
- 'zzzz......',
- 'zzzzzzzz......',
- 'zzz...好涩哦..zzz....',
- '别...不要..zzz..那..zzz..',
- '嘻嘻..zzz..呐~..zzzz..'
+ '大凶',
+ '大胸',
+ '小凶',
+ '小胸',
+ '凶',
+ '吉',
+ '中吉',
+ '大吉',
+ '特大吉',
+ '超特大吉'
]
)
)
- else:
- await session.send(
- str(
- random.choice(
- [
- '大凶',
- '大胸',
- '小凶',
- '小胸',
- '凶',
- '吉',
- '中吉',
- '大吉',
- '特大吉',
- '超特大吉'
- ]
- )
- )
- )
+ )
@on_command('掷骰子', 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:
- if 0 <= now_time() < 5.5:
- await session.send(
- choice(
- [
- 'zzzz......',
- 'zzzzzzzz......',
- 'zzz...好涩哦..zzz....',
- '别...不要..zzz..那..zzz..',
- '嘻嘻..zzz..呐~..zzzz..'
- ]
- )
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
+ await session.send(
+ choice(
+ [
+ 'zzzz......',
+ 'zzzzzzzz......',
+ 'zzz...好涩哦..zzz....',
+ '别...不要..zzz..那..zzz..',
+ '嘻嘻..zzz..呐~..zzzz..'
+ ]
)
- else:
- await session.send(
- str(
- random.randint(
- 1,6
- )
+ )
+ else:
+ await session.send(
+ str(
+ random.randint(
+ 1,6
)
)
+ )
@on_command('关于', 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:
- if 0 <= now_time() < 5.5:
- await session.send(
- choice(
- [
- 'zzzz......',
- 'zzzzzzzz......',
- 'zzz...好涩哦..zzz....',
- '别...不要..zzz..那..zzz..',
- '嘻嘻..zzz..呐~..zzzz..'
- ]
- )
- )
- else:
- await session.send(
- """想了解ATRI嘛
- 写出咱的是Kyomotoi
- 他的主页:https://blog.lolihub.icu/
- 项目地址:https://github.com/Kyomotoi/ATRI
- 欢迎star~w!"""
- )
+ if checkNoob(user, group):
+ await session.send(
+ """想了解ATRI嘛
+写出咱的是Kyomotoi
+他的主页:https://blog.lolihub.icu/
+项目地址:https://github.com/Kyomotoi/ATRI
+欢迎star~w!"""
+ )
@on_command('help', aliases = ['帮助', '如何使用ATRI', '机器人帮助'], 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:
- await session.send(
- choice(
- [
- 'zzzz......',
- 'zzzzzzzz......',
- 'zzz...好涩哦..zzz....',
- '别...不要..zzz..那..zzz..',
- '嘻嘻..zzz..呐~..zzzz..'
- ]
- )
- )
- else:
- await session.send(
- f"""{render_expression(HELP_REPLY)}
- 请仔细阅读文档哦~~https://blog.lolihub.icu/#/ATRI/user"""
- )
+ if checkNoob(user, group):
+ await session.send(
+ f"""{render_expression(HELP_REPLY)}
+请仔细阅读文档哦~~https://blog.lolihub.icu/#/ATRI/user"""
+ )
+RepoList = []
@on_command('report', aliases = ['来杯红茶'], only_to_me = True)
-async def _(session: CommandSession):
+async def EMMAAAA(session: CommandSession):
+ global RepoList
h_type = session.event.detail_type
msg = session.current_arg.strip()
user = session.event.user_id
@@ -217,6 +137,11 @@ async def _(session: CommandSession):
if not msg:
msg = session.get('message', prompt='请键入需要反馈的信息')
+ RepoList.append(user)
+
+ if countX(RepoList, user) == 5:
+ session.finish('您今天已经喝了5杯红茶啦!明天再来吧!')
+
if h_type == 'group':
await bot.send_private_msg(
user_id = master,
@@ -227,4 +152,21 @@ async def _(session: CommandSession):
await bot.send_private_msg(
user_id = master,
message = f"来自用户[{user}]的反馈:\n{msg}"
- ) # type: ignore \ No newline at end of file
+ ) # type: ignore
+
+async def _(session: CommandSession):
+ if not session.is_first_run and session.current_arg.startswith('算了'):
+ session.switch(session.current_arg[len('算了'):])
+
+ 'cron',
+ hour = 24,
+ misfire_grace_time = 10
+)
+async def _():
+ global RepoList
+ try:
+ RepoList = []
+ except:
+ await bot.send_private_msg(user_id = master, message = f'红茶重置失败...请手动重启ATRI以重置红茶...') # type: ignore \ No newline at end of file
diff --git a/ATRI/plugins/pixiv.py b/ATRI/plugins/pixiv.py
index 58a2203..0f3f971 100644
--- a/ATRI/plugins/pixiv.py
+++ b/ATRI/plugins/pixiv.py
@@ -7,10 +7,15 @@ import nonebot
from nonebot import on_command, CommandSession
from ATRI.modules import response # type: ignore
+from ATRI.modules.funcControl import checkSwitch, checkNoob # type: ignore
bot = nonebot.get_bot()
master = bot.config.SUPERUSERS
+__plugin_name__ = "pixiv"
+__plugin_name1__ = "pixiv_seach_img"
+__plugin_name2__ = "pixiv_seach_author"
+__plugin_name3__ = "pixiv_daily_rank"
URL_1 = 'https://api.imjad.cn/pixiv/v1/?type=illust&id=' #单图搜索
URL_2 = 'https://api.imjad.cn/pixiv/v1/?type=member_illust&id=' #画师作品搜索
@@ -43,236 +48,178 @@ def now_time():
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
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
+ await session.send(
+ choice(
+ [
+ 'zzzz......',
+ 'zzzzzzzz......',
+ 'zzz...好涩哦..zzz....',
+ '别...不要..zzz..那..zzz..',
+ '嘻嘻..zzz..呐~..zzzz..'
+ ]
+ )
+ )
else:
- if 0 <= now_time() < 5.5:
+ if checkSwitch(__plugin_name1__):
+ pid = session.current_arg.strip()
+
+ if not pid:
+ pid = session.get('message', prompt = '请告诉ATRI需要查询的Pid码')
+
+ start =time.perf_counter()
+ await session.send('开始P站搜图\n如搜索时间过长或许为图片过大上传较慢')
+
+ URL = URL_1 + pid
+
+ dc = json.loads(response.request_api(URL))
+
+ if not dc:
+ session.finish('ATRI在网络上走散了...请重试...')
+
+ img = f'https://pixiv.cat/{pid}.jpg'
+
+
+ end = time.perf_counter()
+
await session.send(
- choice(
- [
- 'zzzz......',
- 'zzzzzzzz......',
- 'zzz...好涩哦..zzz....',
- '别...不要..zzz..那..zzz..',
- '嘻嘻..zzz..呐~..zzzz..'
- ]
+ IMG_SEACH_REPLY.format(
+ user = user,
+ pid = pid,
+ title = dc["response"][0]["title"],
+ width = dc["response"][0]["width"],
+ height = dc["response"][0]["height"],
+ tags = dc["response"][0]["tags"],
+ account = dc["response"][0]["user"]["account"],
+ name = dc["response"][0]["user"]["name"],
+ user_link = f'https://www.pixiv.net/users/' + f'{dc["response"][0]["user"]["id"]}',
+ img = img,
+ time = round(end - start, 3)
)
)
+
else:
- with open(Path('.') / 'ATRI' / 'plugins' / 'switch' / 'switch.json', 'r') as f:
- data = json.load(f)
-
- if data["pixiv_seach_img"] == "on":
- pid = session.current_arg.strip()
-
- if not pid:
- pid = session.get('message', prompt = '请告诉ATRI需要查询的Pid码')
-
- start =time.perf_counter()
- await session.send('开始P站搜图\n如搜索时间过长或许为图片过大上传较慢')
-
- URL = URL_1 + pid
-
- dc = json.loads(response.request_api(URL))
-
- if not dc:
- session.finish('ATRI在网络上走散了...请重试...')
-
- img = f'https://pixiv.cat/{pid}.jpg'
-
-
- end = time.perf_counter()
-
- await session.send(
- IMG_SEACH_REPLY.format(
- user = user,
- pid = pid,
- title = dc["response"][0]["title"],
- width = dc["response"][0]["width"],
- height = dc["response"][0]["height"],
- tags = dc["response"][0]["tags"],
- account = dc["response"][0]["user"]["account"],
- name = dc["response"][0]["user"]["name"],
- user_link = f'https://www.pixiv.net/users/' + f'{dc["response"][0]["user"]["id"]}',
- img = img,
- time = round(end - start, 3)
- )
- )
-
- else:
- await session.send('该功能已被禁用...')
+ await session.send('该功能已关闭...')
@on_command('pixiv_seach_author', 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
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
+ await session.send(
+ choice(
+ [
+ 'zzzz......',
+ 'zzzzzzzz......',
+ 'zzz...好涩哦..zzz....',
+ '别...不要..zzz..那..zzz..',
+ '嘻嘻..zzz..呐~..zzzz..'
+ ]
+ )
+ )
else:
- if 0 <= now_time() < 5.5:
- await session.send(
- choice(
- [
- 'zzzz......',
- 'zzzzzzzz......',
- 'zzz...好涩哦..zzz....',
- '别...不要..zzz..那..zzz..',
- '嘻嘻..zzz..呐~..zzzz..'
- ]
- )
+ if checkSwitch(__plugin_name2__):
+ author_id = session.current_arg.strip()
+
+ if not author_id:
+ author_id = session.get('message', prompt = '请告诉ATRI需要查询的画师ID')
+
+ start =time.perf_counter()
+ await session.send(f'开始获取画师{author_id}的前三项作品\n如获取时间过长或许为图片过大上传较慢')
+
+ URL = URL_2 + author_id
+
+ dc = json.loads(response.request_api(URL))
+
+ if not dc:
+ session.finish('ATRI在网络上走散了...请重试...')
+
+ d ={}
+
+ for i in range(0,3):
+ pid = dc["response"][i]["id"]
+ pidURL = f'https://pixiv.cat/{pid}.jpg'
+ d[i] = [f'{pid}',f'{pidURL}']
+
+ msg0 = (f'[CQ:at,qq={user}]\n画师id:{author_id},接下来展示前三作品')
+
+ result = sorted(
+ d.items(),
+ key = lambda x:x[1],
+ reverse = True
)
- else:
- with open(Path('.') / 'ATRI' / 'plugins' / 'switch' / 'switch.json', 'r') as f:
- data = json.load(f)
-
- if data["pixiv_seach_author"] == "on":
- author_id = session.current_arg.strip()
-
- if not author_id:
- author_id = session.get('message', prompt = '请告诉ATRI需要查询的画师ID')
-
- start =time.perf_counter()
- await session.send(f'开始获取画师{author_id}的前三项作品\n如获取时间过长或许为图片过大上传较慢')
-
- URL = URL_2 + author_id
-
- dc = json.loads(response.request_api(URL))
-
- if not dc:
- session.finish('ATRI在网络上走散了...请重试...')
-
- d ={}
-
- for i in range(0,3):
- pid = dc["response"][i]["id"]
- pidURL = f'https://pixiv.cat/{pid}.jpg'
- d[i] = [f'{pid}',f'{pidURL}']
-
- msg0 = (f'[CQ:at,qq={user}]\n画师id:{author_id},接下来展示前三作品')
-
- result = sorted(
- d.items(),
- key = lambda x:x[1],
- reverse = True
- )
- t = 0
+ t = 0
- for i in result:
- t += 1
- msg = (f'\n---------------\n({t})\nPid: {i[1][0]}\n{i[1][1]}')
- msg0 += msg
- end = time.perf_counter()
+ for i in result:
+ t += 1
+ msg = (f'\n---------------\n({t})\nPid: {i[1][0]}\n{i[1][1]}')
+ msg0 += msg
+ end = time.perf_counter()
- msg1 = (f'\n---------------\n完成时间:{round(end - start, 3)}s')
- msg0 += msg1
-
- await session.send(msg0)
+ msg1 = (f'\n---------------\n完成时间:{round(end - start, 3)}s')
+ msg0 += msg1
- else:
- await session.send('该功能已被禁用...')
+ await session.send(msg0)
+
+ else:
+ await session.send('该功能已关闭...')
@on_command('pixiv_daily_rank', aliases = ['P站排行榜', '批站排行榜', 'p站排行榜'], 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:
- await session.send(
- choice(
- [
- 'zzzz......',
- 'zzzzzzzz......',
- 'zzz...好涩哦..zzz....',
- '别...不要..zzz..那..zzz..',
- '嘻嘻..zzz..呐~..zzzz..'
- ]
- )
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
+ await session.send(
+ choice(
+ [
+ 'zzzz......',
+ 'zzzzzzzz......',
+ 'zzz...好涩哦..zzz....',
+ '别...不要..zzz..那..zzz..',
+ '嘻嘻..zzz..呐~..zzzz..'
+ ]
)
- else:
- with open(Path('.') / 'ATRI' / 'plugins' / 'switch' / 'switch.json', 'r') as f:
- data = json.load(f)
-
- if data["pixiv_daily_rank"] == "on":
-
- await session.send('ATRI正在获取P站每日排行榜前五作品...')
+ )
+ else:
+ if checkSwitch(__plugin_name__):
+ await session.send('ATRI正在获取P站每日排行榜前五作品...')
- start =time.perf_counter()
- dc = json.loads(response.request_api(URL_3))
+ start =time.perf_counter()
+ dc = json.loads(response.request_api(URL_3))
- d = {}
+ d = {}
- for i in range(0,5):
- pid = dc["response"][0]["works"][i]["work"]["id"]
- pidURL = f'https://pixiv.cat/{pid}.jpg'
- d[i] = [f'{pid}',f'{pidURL}']
+ for i in range(0,5):
+ pid = dc["response"][0]["works"][i]["work"]["id"]
+ pidURL = f'https://pixiv.cat/{pid}.jpg'
+ d[i] = [f'{pid}',f'{pidURL}']
- msg0 = (f'[CQ:at,qq={user}]')
+ msg0 = (f'[CQ:at,qq={user}]')
- result = sorted(
- d.items(),
- key = lambda x:x[1],
- reverse = True
- )
+ result = sorted(
+ d.items(),
+ key = lambda x:x[1],
+ reverse = True
+ )
- t = 0
+ t = 0
- for i in result:
- t += 1
- msg = (f'\n---------------\n({t})\nPid: {i[1][0]}\n{i[1][1]}')
- msg0 += msg
- end = time.perf_counter()
+ for i in result:
+ t += 1
+ msg = (f'\n---------------\n({t})\nPid: {i[1][0]}\n{i[1][1]}')
+ msg0 += msg
+ end = time.perf_counter()
- msg1 = (f'\n---------------\n完成时间:{round(end - start, 3)}s')
- msg0 += msg1
+ msg1 = (f'\n---------------\n完成时间:{round(end - start, 3)}s')
+ msg0 += msg1
- await session.send(msg0)
-
- else:
- await session.send('该功能已被禁用...') \ No newline at end of file
+ await session.send(msg0)
+
+ else:
+ await session.send('该功能已关闭...') \ No newline at end of file
diff --git a/ATRI/plugins/richBISS.py b/ATRI/plugins/richBISS.py
index 949bcf0..f60d7d0 100644
--- a/ATRI/plugins/richBISS.py
+++ b/ATRI/plugins/richBISS.py
@@ -5,6 +5,7 @@ from pathlib import Path
from datetime import datetime
from ATRI.modules import response # type: ignore
+from ATRI.modules.funcControl import checkNoob # type: ignore
bot = nonebot.get_bot()
@@ -52,62 +53,46 @@ def enc(x):
async def Fuck_bili_rich(context):
user = str(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 user in data1.keys():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
pass
else:
- if 0 <= now_time() < 5.5:
- pass
- else:
- msg = str(context["message"])
- pattern = re.compile(r"BV\S+\?")
- bv = re.findall(pattern, msg)
- if bv:
- bv = bv[0]
- bv = bv.replace('?', '')
- print(bv)
-
- aid = str(dec(bv))
- ad = 'av' + aid
- URL = f'https://api.imjad.cn/bilibili/v2/?aid={aid}'
-
- try:
- res = response.request_api(URL)
- mg = json.loads(res)
- msg = BILI_REPORT_FORMAT.format(
- title = mg["data"]["title"],
-
- view = mg["data"]["stat"]["view"],
- coin = mg["data"]["stat"]["coin"],
- share = mg["data"]["stat"]["share"],
- like = mg["data"]["stat"]["like"],
-
- bid = mg["data"]["bvid"],
- bid_link = mg["data"]["short_link"],
-
- aid = ad,
- aid_link = f'https://b23.tv/{ad}'
- )
-
- await bot.send_msg( # type: ignore
- group_id = group,
- message = msg
- )
- except:
- pass
+ msg = str(context["message"])
+ pattern = re.compile(r"BV\S+\?")
+ bv = re.findall(pattern, msg)
+ if bv:
+ bv = bv[0]
+ bv = bv.replace('?', '')
+ print(bv)
+
+ aid = str(dec(bv))
+ ad = 'av' + aid
+ URL = f'https://api.imjad.cn/bilibili/v2/?aid={aid}'
+
+ try:
+ res = response.request_api(URL)
+ mg = json.loads(res)
+ msg = BILI_REPORT_FORMAT.format(
+ title = mg["data"]["title"],
+
+ view = mg["data"]["stat"]["view"],
+ coin = mg["data"]["stat"]["coin"],
+ share = mg["data"]["stat"]["share"],
+ like = mg["data"]["stat"]["like"],
+
+ bid = mg["data"]["bvid"],
+ bid_link = mg["data"]["short_link"],
+
+ aid = ad,
+ aid_link = f'https://b23.tv/{ad}'
+ )
+
+ await bot.send_msg( # type: ignore
+ group_id = group,
+ message = msg
+ )
+ except:
+ pass
REPORT_FORMAT = """Status: {status}
@@ -120,50 +105,34 @@ MD5: {md5}"""
async def Fuck_CloudMusic(context):
user = str(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 user in data1.keys():
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
pass
else:
- if 0 <= now_time() < 5.5:
- pass
- else:
- msg = str(context["message"])
- pattern = re.compile(r"song\S+\/|id=\S+\&")
- music_id = re.findall(pattern, msg)
- if 'music.163.com' in msg:
- if music_id:
- music_id = str(music_id[0])
- music_id = re.findall(r"-?[1-9]\d*", music_id)
- URL = f'https://api.imjad.cn/cloudmusic/?type=song&id={music_id[0]}&br=320000'
- print(URL)
-
- try:
- res = response.request_api(URL)
- mg = json.loads(res)
-
- msg = REPORT_FORMAT.format(
- status = mg["code"],
- id = mg["data"][0]["id"],
- br = mg["data"][0]["br"],
- url = mg["data"][0]["url"],
- md5 = mg["data"][0]["md5"],
- )
- await bot.send_msg(
- group_id = group,
- message = msg
- ) # type: ignore
- except:
- pass \ No newline at end of file
+ msg = str(context["message"])
+ pattern = re.compile(r"song\S+\/|id=\S+\&")
+ music_id = re.findall(pattern, msg)
+ if 'music.163.com' in msg:
+ if music_id:
+ music_id = str(music_id[0])
+ music_id = re.findall(r"-?[1-9]\d*", music_id)
+ URL = f'https://api.imjad.cn/cloudmusic/?type=song&id={music_id[0]}&br=320000'
+ print(URL)
+
+ try:
+ res = response.request_api(URL)
+ mg = json.loads(res)
+
+ msg = REPORT_FORMAT.format(
+ status = mg["code"],
+ id = mg["data"][0]["id"],
+ br = mg["data"][0]["br"],
+ url = mg["data"][0]["url"],
+ md5 = mg["data"][0]["md5"],
+ )
+ await bot.send_msg(
+ group_id = group,
+ message = msg
+ ) # type: ignore
+ except:
+ pass \ No newline at end of file
diff --git a/ATRI/plugins/setu.py b/ATRI/plugins/setu.py
index dbc62b7..2aa5c2b 100644
--- a/ATRI/plugins/setu.py
+++ b/ATRI/plugins/setu.py
@@ -13,16 +13,19 @@ import nonebot
from nonebot import on_command, CommandSession
import config # type: ignore
-from ATRI.modules.response import request_api_params # type: ignore
from ATRI.modules.b64 import b64_str_img_url # type: ignore
+from ATRI.modules.response import request_api_params # type: ignore
+from ATRI.modules.funcControl import checkSwitch, checkNoob # type: ignore
bot = nonebot.get_bot()
master = config.MASTER()
-apikey_LOLI = bot.config.LOLICONAPI # type: ignore
+apikey_LOLI = config.LOLICONAPI()
APP_ID = config.BAIDU_APP_ID()
API_KEY = config.BAIDU_API_KEY()
SECRECT_KEY = config.BAIDU_SECRET()
+__plugin_name__ = "setu"
+__plugin_name1__ = "setu_img"
URL = 'https://api.lolicon.app/setu/'
@@ -47,134 +50,115 @@ async def setu(session: CommandSession):
start = time.perf_counter()
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:
- await session.send(
- choice(
- [
- 'zzzz......',
- 'zzzzzzzz......',
- 'zzz...好涩哦..zzz....',
- '别...不要..zzz..那..zzz..',
- '嘻嘻..zzz..呐~..zzzz..'
- ]
- )
+ if checkNoob(user, group):
+ if 0 <= now_time() < 5.5:
+ await session.send(
+ choice(
+ [
+ 'zzzz......',
+ 'zzzzzzzz......',
+ 'zzz...好涩哦..zzz....',
+ '别...不要..zzz..那..zzz..',
+ '嘻嘻..zzz..呐~..zzzz..'
+ ]
)
- else:
- 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)
- 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;')
-
- if 1 <= res < 3:
- for i in msg:
- pid = i[0]
- title = i[1]
- img = i[7]
- end = time.perf_counter()
- await session.send(
- SETU_REPLY.format(
- title = title,
- pid = pid,
- setu = img,
- time = round(end - start, 3)
- )
- )
- elif res == 4:
- for i in msg:
- pid = i[0]
- title = i[1]
- img = i[7]
- end = time.perf_counter()
- await session.send('我找到涩图了!但我发给主人了\nο(=•ω<=)ρ⌒☆')
- 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 session.send('别急!正在找图!')
- 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 session.send('失败了失败了失败了失...')
- return
- if 1 <= res < 3:
+ )
+ else:
+ if checkSwitch(__plugin_name__):
+ res = randint(1,10)
+ if 1 <= res < 9:
+ res = randint(1,4)
+ 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;')
+
+ if 1 <= res < 3:
+ for i in msg:
+ pid = i[0]
+ title = i[1]
+ img = i[7]
end = time.perf_counter()
await session.send(
SETU_REPLY.format(
title = title,
pid = pid,
- setu = dc["data"][0]["url"],
+ setu = img,
time = round(end - start, 3)
)
)
- elif res == 4:
+ elif res == 4:
+ for i in msg:
+ pid = i[0]
+ title = i[1]
+ img = i[7]
end = time.perf_counter()
await session.send('我找到涩图了!但我发给主人了\nο(=•ω<=)ρ⌒☆')
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)}"
+ message = f"主人,从群{group}来的涩图!热乎着!\nTitle: {title}\nPid: {pid}\n{img}\nComplete time: {round(end - start, 3)}"
)
- elif res == 4:
- img = choice(
- [
- 'SP.jpg', 'SP1.jpg', 'SP2.jpg'
- ]
- )
- img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}'
- img = os.path.abspath(img)
- await session.send(f'[CQ:image,file=file:///{img}]')
-
- elif res == 10:
+
+ elif setu_type == 2:
+ res = randint(1,4)
+ await session.send('别急!正在找图!')
+ 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 session.send('失败了失败了失败了失...')
+ return
+ if 1 <= res < 3:
+ end = time.perf_counter()
+ await session.send(
+ SETU_REPLY.format(
+ title = title,
+ pid = pid,
+ setu = dc["data"][0]["url"],
+ time = round(end - start, 3)
+ )
+ )
+ elif res == 4:
+ end = time.perf_counter()
+ await session.send('我找到涩图了!但我发给主人了\nο(=•ω<=)ρ⌒☆')
+ 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:
img = choice(
[
- 'GDZ.png', 'SHZY1.jpg', 'SHZY2.jpg', 'SHZY3.jpg', 'SHZY4.jpg', 'SHZY5.jpg', 'SHZY6.jpg'
+ 'SP.jpg', 'SP1.jpg', 'SP2.jpg'
]
)
- img = Path('.') / 'ATRI' / 'data' / 'img' / 'niceIMG' / f'{img}'
+ img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}'
img = os.path.abspath(img)
await session.send(f'[CQ:image,file=file:///{img}]')
+
+ 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 session.send(f'[CQ:image,file=file:///{img}]')
- else:
- await session.send('该功能已被禁用...')
+ else:
+ await session.send('该功能已关闭...')
@on_command('change_setu_type', aliases = ['涩图导向'], only_to_me = False)
@@ -201,155 +185,133 @@ async def _(context):
start = time.perf_counter()
user = context["user_id"]
group = context["group_id"]
- if 0 <= now_time() < 5.5:
- pass
- else:
- 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:
- with open(Path('.') / 'ATRI' / 'plugins' / 'switch' / 'switch.json', 'r') as f:
- data1 = json.load(f)
+ if checkNoob(user, group):
+ if checkSwitch(__plugin_name1__):
+ 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
- if data1["setu_img"] == "on":
+ img = b64_str_img_url(img)
+ if img:
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)
+ 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
- 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 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:
+ if re.findall(r"[涩色]图|炼铜", words):
+ if checkSwitch(__plugin_name__):
+ 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)
- )
+ 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:
+ 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{setu}\nComplete time: {round(end - start, 3)}"
+ message = f"主人,从群{group}来的涩图!热乎着!\nTitle: {title}\nPid: {pid}\n{img}\nComplete time: {round(end - start, 3)}"
)
- 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:
+
+ 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)
+ )
+ 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:
img = choice(
[
- 'GDZ.png', 'SHZY1.jpg', 'SHZY2.jpg', 'SHZY3.jpg', 'SHZY4.jpg', 'SHZY5.jpg', 'SHZY6.jpg'
+ 'SP.jpg', 'SP1.jpg', 'SP2.jpg'
]
)
- img = Path('.') / 'ATRI' / 'data' / 'img' / 'niceIMG' / f'{img}'
+ 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(
+ [
+ '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
+
+ else:
+ pass \ No newline at end of file
diff --git a/ATRI/plugins/switch.py b/ATRI/plugins/switch.py
index 264b93a..8abb408 100644
--- a/ATRI/plugins/switch.py
+++ b/ATRI/plugins/switch.py
@@ -41,8 +41,8 @@ async def _(session: CommandSession):
elif com == 'SetuIMG':
data["setu_img"] = "on"
- elif com == 'Hbook':
- data["hbook"] = "on"
+ elif com == "AnimeSearch":
+ data["anime_search"] = "on"
elif com == 'AIchFace':
data["change_face"] = "on"
@@ -75,8 +75,8 @@ async def _(session: CommandSession):
elif com == 'SetuIMG':
data["setu_img"] = "off"
- elif com == 'Hbook':
- data["hbook"] = "off"
+ elif com == "AnimeSearch":
+ data["anime_search"] = "off"
elif com == 'AIchFace':
data["change_face"] = "off"
diff --git a/ATRI/plugins/switch/switch.json b/ATRI/plugins/switch/switch.json
index a1954cf..13cdfa0 100644
--- a/ATRI/plugins/switch/switch.json
+++ b/ATRI/plugins/switch/switch.json
@@ -1 +1 @@
-{"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
+{"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", "anime_search": "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 d727e5e..a3a8fd0 100644
--- a/ATRI/plugins/welcome.py
+++ b/ATRI/plugins/welcome.py
@@ -5,6 +5,7 @@ from nonebot.plugin import on_request
from nonebot.helpers import send_to_superusers
import config # type: ignore
+from ATRI.modules.funcControl import checkNoob # type: ignore
bot = nonebot.get_bot()
@@ -24,12 +25,11 @@ async def _(session: NoticeSession):
@on_notice('group_decrease')
async def _(session: NoticeSession):
user = session.event.user_id
+ group = session.event.group_id
now = session.event.operator_id
-
- if now == user:
- inf = await bot.get_stranger_info(user_id = user) # type: ignore
- name = inf['nickname']
- await session.send(f'{name}({user}) 跑了......')
+ if checkNoob(user, group):
+ if now == user:
+ await session.send(f'[{user}]离开了我们......')
@on_request('friend_add')