async def az(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 0 <= GetFavoIMP(user) < 250: 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 250 <= GetFavoIMP(user): res = randint(1, 2) if res == 1: 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: 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}]')
async def _(session: NoticeSession): user = session.event.user_id group = session.event.group_id now = session.event.operator_id if checkNoob(user, group): if now == user: await session.send(f'[{user}]离开了我们......')
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 datetime.date.today().strftime('%y%m%d') == '200828': AddFavoIMP(user, 50, True) res = randint(1, 3) if res == 1: msg = choice(['谢谢,谢谢你!', '感谢...15551', '谢谢你们orz...']) await session.send(msg) elif 2 <= res <= 3: voice = choice([ 'THX.amr', 'THX1.amr', 'THX2.amr', 'THX3.amr', 'THX4.amr' ]) voice = Path('.') / 'ATRI' / 'data' / 'voice' / f'{voice}' voice = os.path.abspath(voice) await session.send(f'[CQ:record,file=file:///{voice}]') if randint(1, 3) == 2: img = Path('.') / 'ATRI' / 'data' / 'emoji' / 'SUKI.jpg' img = os.path.abspath(img) await session.send(f'[CQ:image,file=file:///{img}]') else: pass
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}]')
async def Fuck_CloudMusic(context): user = str(context["user_id"]) group = context["group_id"] if checkNoob(user, group): 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 = 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
async def _(session: CommandSession): user = session.event.user_id group = session.event.group_id if checkNoob(user, group): 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, )
async def _(session: CommandSession): user = session.event.user_id group = session.event.group_id if checkNoob(user, group): if 0 <= now_time() < 5.5: await session.send( choice( [ 'zzzz......', 'zzzzzzzz......', 'zzz...好涩哦..zzz....', '别...不要..zzz..那..zzz..', '嘻嘻..zzz..呐~..zzzz..' ] ) ) else: if checkSwitch(__plugin_name__, group): await session.send('ATRI正在获取P站每日排行榜前五作品...') start =time.perf_counter() try: dc = json.loads(request_api(URL_3)) except: session.finish(errorBack('请求数据失败')) d = {} try: 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}'] except: session.finish('处理数据失败') msg0 = (f'[CQ:at,qq={user}]') result = sorted( d.items(), key = lambda x:x[1], reverse = True ) 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() msg1 = (f'\n---------------\n完成时间:{round(end - start, 3)}s') msg0 += msg1 await session.send(msg0) else: await session.send('该功能已关闭...')
async def _(session: CommandSession): user = session.event.user_id group = session.event.group_id if checkNoob(user, group): if 0 <= now_time() < 5.5: await session.send( choice( [ 'zzzz......', 'zzzzzzzz......', 'zzz...好涩哦..zzz....', '别...不要..zzz..那..zzz..', '嘻嘻..zzz..呐~..zzzz..' ] ) ) else: if checkSwitch(__plugin_name1__, group): pid = session.current_arg.strip() if not pid: pid = session.get('message', prompt = '请告诉ATRI需要查询的Pid码') start =time.perf_counter() await session.send('开始P站搜图') URL = URL_1 + pid try: dc = json.loads(request_api(URL)) except: session.finish(errorBack('请求数据失败')) img = f'https://pixiv.cat/{pid}.jpg' end = time.perf_counter() try: 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) ) ) except: session.finish(errorBack('处理数据失败')) else: await session.send('该功能已关闭...')
async def _(session: CommandSession): user = session.event.user_id group = session.event.group_id if checkNoob(user, group): if sleepTime(): await session.send(sleepTime()) else: await session.send(str(random.randint(1, 6)))
async def _(session: CommandSession): group = session.event.group_id user = session.event.user_id if sleepTime(): await session.send(sleepTime()) else: if checkNoob(user, group): try: with open(Path('.') / 'ATRI' / 'modules' / 'favoIMP' / 'user.json', 'r') as f: data = json.load(f) except: data = {} try: if data[f"{user}"][1] == datetime.date.today().strftime('%y%m%d'): await session.send('咱今天签到过啦~明天再来吧!') return except: pass favoIMP = randint(1,5) try: with open(Path('.') / 'ATRI' / 'modules' / 'favoIMP' / 'user.json', 'r') as f: data = json.load(f) data[f"{user}"] = [f"{int(data[f'{user}'][0]) + favoIMP}", f"{datetime.date.today().strftime('%y%m%d')}"] with open(Path('.') / 'ATRI' / 'modules' / 'favoIMP' / 'user.json', 'w') as f: f.write(json.dumps(data)) f.close() except: data = {} data[f"{user}"] = [f"{favoIMP}", f"{datetime.date.today().strftime('%y%m%d')}"] with open(Path('.') / 'ATRI' / 'modules' / 'favoIMP' / 'user.json', 'w') as f: f.write(json.dumps(data)) f.close() IMP = int(data[f"{user}"][0]) msg0 = f'[CQ:at,qq={user}]\n' msg0 += '签到成功ヾ(≧∇≦*)ゝ\n' msg0 += f'+ 好感度 {favoIMP}|{IMP}\n' if 0 <= IMP < 100: msg0 += '今日もいい日ですよ!~頑張ってください!' elif 100 <= IMP < 250: msg0 += 'アトリが心から応援します!' elif 250 <= IMP < 350: msg0 += 'アトリはあなたを待ちます' elif 350 <= IMP < 400: msg0 += 'わ...わたし...えと...す...' elif 400 <= IMP: msg0 += '好きだあなた好きだ!永遠!' await session.send(msg0)
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, 3) == 1: await session.send(choice(['呐', '呐呐呐', 'ねえ', 'ねえねえ']))
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: await session.send('不许好!憋回去!')
async def _(session: CommandSession): user = session.event.user_id group = session.event.group_id if checkNoob(user, group): await session.send("""想了解ATRI嘛 写出咱的是Kyomotoi 他的主页:https://blog.lolihub.icu/ 项目地址:https://github.com/Kyomotoi/ATRI 欢迎star~w!""")
async def _(session: CommandSession): user = session.event.user_id group = session.event.group_id if checkNoob(user, group): if 0 <= now_time() < 5.5: await session.send( choice([ 'zzzz......', 'zzzzzzzz......', 'zzz...好涩哦..zzz....', '别...不要..zzz..那..zzz..', '嘻嘻..zzz..呐~..zzzz..' ])) else: 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) 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() msg1 = (f'\n---------------\n完成时间:{round(end - start, 3)}s') msg0 += msg1 await session.send(msg0) else: await session.send('该功能已关闭...')
async def _(session: CommandSession): user = session.event.user_id group = session.event.group_id if checkNoob(user, group): if 11 <= now_time() <= 15: await session.send( choice([ '午安w', '午觉要好好睡哦,ATRI会陪伴在你身旁的w', '嗯哼哼~睡吧,就像平常一样安眠吧~o(≧▽≦)o', '睡你午觉去!哼唧!!' ]))
async def _(session: NoticeSession): user = session.event.user_id group = session.event.group_id me = session.event.self_id if checkNoob(group): if user == me: await session.send('在下アトリ,今后请多指教呐❤') else: await session.send( f'[CQ:at,qq={user}]\nねえ❤...是新人欸!\nここでは遠慮はいらないのだからね❤')
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: img = Path('.') / 'ATRI' / 'data' / 'emoji' / 'H.jpg' img = os.path.abspath(img) await session.send(f'[CQ:image,file=file:///{img}]')
async def _(session: CommandSession): user = session.event.user_id group = session.event.group_id 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)))
async def SaucenaoSearch(session: CommandSession): user = session.event.user_id group = session.event.group_id msg = session.current_arg.strip() if checkNoob(user, group): if sleepTime(): await session.send(sleepTime()) else: if checkSwitch(__plugin_name__, group): if not msg: msg = session.get('message', prompt="请发送一张图片") await session.send("开始以图识图") try: p = '\\[CQ\\:image\\,file\\=.*?\\,url\\=(.*?)\\]' img = re.findall(p, msg) task = SauceNAO(api_key=API_KEY) data = task.search(url=img) msg0 = '' try: data = json.loads(data)['results'][0] title = data['data']['title'] pixiv_id = data['data']['pixiv_id'] member_name = data['data']['member_name'] member_id = data['data']['member_id'] similarity = data['header']['similarity'] mini_url = data['header']['thumbnail'] msg0 = f'[CQ:at,qq={user}]' msg0 += f'SauceNAO结果:' msg0 += f'[CQ:image,file={mini_url}]\n' msg0 += f'相似度:{similarity}%\n' msg0 += f'标题:{title}\n' msg0 += f'插画ID:{pixiv_id}\n' msg0 += f'画师:{member_name}\n' msg0 += f'画师ID:{member_id}\n' msg0 += f'直链:https://pixiv.cat/{pixiv_id}.jpg' except: msg = '数据处理失败' if float(similarity) > 70: await session.send(msg0) else: await session.send("找不到相似的图呢...") except Exception: session.finish(errorBack(msg)) else: session.finish('该功能已关闭...')
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: 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}]')
async def _(session: CommandSession): user = session.event.user_id group = session.event.group_id if checkNoob(user, group): if sleepTime(): await session.send(sleepTime()) else: await session.send( str( random.choice([ '大凶', '大胸', '小凶', '小胸', '凶', '吉', '中吉', '大吉', '特大吉', '超特大吉' ])))
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): noobList1.append(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}]哼!接下来30分钟别想让我理你!\n(好感度-2)') DelFavoIMP(user, 2, False) 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=30) 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, ) else: await session.send('你妈的,牛头人,' + request_api(KC_URL))
async def az(session: CommandSession): user = session.event.user_id group = session.event.group_id if checkNoob(user, group): 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}]')
async def _(session: CommandSession): global noobList0 user = session.event.user_id group = session.event.group_id if checkNoob(user, group): 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: if user == master: await session.send( '是主人的话...那算了...呜呜\n即使到达了ATRI的最低忍耐限度......') noobList0 = list(set(noobList0)) pass else: await session.send( '是亚托莉......萝卜子可是对机器人的蔑称......\n这是第二次警告哦,接下来10分钟我不会再理你了!哼唧!\n(好感度-1)' ) DelFavoIMP(user, 1, False) 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=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, )
async def _(context): user = context["user_id"] group = context["group_id"] if checkNoob(user, group): if sleepTime(): pass else: if randint(1, 20) == 4: img = choice(['11.jpg', '12.jpg', '23.jpg']) img = os.path.abspath( Path('.') / 'ATRI' / 'data' / 'emoji' / 'senren' / f'{img}') await bot.send_msg(message=f'[CQ:image,file=file:///{img}]', auto_escape=False) # type: ignore else: pass
async def _(session: CommandSession): user = session.event.user_id group = session.event.group_id 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 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 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..' ]))
async def _(session: CommandSession): user = session.event.user_id group = session.event.group_id msg = str(session.event.message) if checkNoob(user, group): if 0 <= now_time() < 5.5: pass else: pat = r"草你妈|操|你妈|脑瘫|废柴|fw|five|废物|战斗|爬|爪巴|sb|SB|啥[b批比逼]|傻b|给[爷👴]爬|嘴臭" if re.findall(pat, msg): pass else: msg = choice([ '当然,我是高性能的嘛~!', '没事没事,因为我是高性能的嘛!嗯哼!', '没事的,因为我是高性能的呢!', '正是,因为我是高性能的', '是的。我是高性能的嘛♪', '毕竟我可是高性能的!', '那种程度的事不算什么的。\n别看我这样,我可是高性能的', '没问题的,我可是高性能的' ]) await session.send(msg)
async def hitokoto(session: CommandSession): user = session.event.user_id group = session.event.group_id 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"])
async def Fuck_bili_rich(context): user = str(context["user_id"]) group = context["group_id"] if checkNoob(user, group): 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 = 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
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, 3) == 1: res = randint(1, 5) if 1 <= res < 2: await session.send( choice(['?', '?', '嗯?', '(。´・ω・)ん?', 'ん?'])) elif 2 <= res <= 5: img = choice( ['WH.jpg', 'WH1.jpg', 'WH2.jpg', 'WH3.jpg', 'WH4.jpg']) img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}' img = os.path.abspath(img) await session.send(f'[CQ:image,file=file:///{img}]')