diff options
| author | Kyomotoi <1172294279@qq.com> | 2020-08-15 20:53:45 +0800 | 
|---|---|---|
| committer | Kyomotoi <1172294279@qq.com> | 2020-08-15 20:53:45 +0800 | 
| commit | 33654fb0c8fa357acd3e340d733c470b0f94f359 (patch) | |
| tree | 6104509cd11369f788d9762e7b6053faf4e80973 /ATRI/plugins | |
| parent | ddfd27492056bb08dda49c1538e0aa3e89580c5a (diff) | |
| download | ATRI-33654fb0c8fa357acd3e340d733c470b0f94f359.tar.gz ATRI-33654fb0c8fa357acd3e340d733c470b0f94f359.tar.bz2 ATRI-33654fb0c8fa357acd3e340d733c470b0f94f359.zip | |
[Fix]
Diffstat (limited to 'ATRI/plugins')
| -rw-r--r-- | ATRI/plugins/AIchangeFace.py | 139 | ||||
| -rw-r--r-- | ATRI/plugins/BlackList.py | 52 | ||||
| -rw-r--r-- | ATRI/plugins/UploadSqlite.py | 136 | ||||
| -rw-r--r-- | ATRI/plugins/__pycache__/AIchangeFace.cpython-38.pyc | bin | 5412 -> 3655 bytes | |||
| -rw-r--r-- | ATRI/plugins/__pycache__/chat.cpython-38.pyc | bin | 14336 -> 13616 bytes | |||
| -rw-r--r-- | ATRI/plugins/__pycache__/hbook.cpython-38.pyc | bin | 2343 -> 2337 bytes | |||
| -rw-r--r-- | ATRI/plugins/__pycache__/richBISS.cpython-38.pyc | bin | 0 -> 3303 bytes | |||
| -rw-r--r-- | ATRI/plugins/animeSearch.py | 123 | ||||
| -rw-r--r-- | ATRI/plugins/chat.py | 153 | ||||
| -rw-r--r-- | ATRI/plugins/hbook.py | 124 | ||||
| -rw-r--r-- | ATRI/plugins/hitokoto.py | 51 | ||||
| -rw-r--r-- | ATRI/plugins/noobList/banGroup.json | 0 | ||||
| -rw-r--r-- | ATRI/plugins/other.py | 153 | ||||
| -rw-r--r-- | ATRI/plugins/pixiv.py | 304 | ||||
| -rw-r--r-- | ATRI/plugins/richBISS.py | 147 | ||||
| -rw-r--r-- | ATRI/plugins/send.py | 1 | ||||
| -rw-r--r-- | ATRI/plugins/setu.py | 189 | ||||
| -rw-r--r-- | ATRI/plugins/switch.py | 1 | ||||
| -rw-r--r-- | ATRI/plugins/welcome.py | 1 | ||||
| -rw-r--r-- | ATRI/plugins/wordcloud.py | 48 | 
20 files changed, 991 insertions, 631 deletions
| diff --git a/ATRI/plugins/AIchangeFace.py b/ATRI/plugins/AIchangeFace.py index fa984fb..786a65d 100644 --- a/ATRI/plugins/AIchangeFace.py +++ b/ATRI/plugins/AIchangeFace.py @@ -4,6 +4,8 @@ import requests  import base64  import nonebot  import time +from datetime import datetime +from random import choice  from pathlib import Path  from nonebot import on_command, CommandSession @@ -14,7 +16,14 @@ bot = nonebot.get_bot()  master = config.MASTER()  key = config.FACE_KEY()  secret = config.FACE_SECRET() -SCALE_FACTOR = 1 # 图像的放缩比 + + +def now_time(): +    now_ = datetime.now() +    hour = now_.hour +    minute = now_.minute +    now = hour + minute / 60 +    return now  #获取图片的人脸特征参数 @@ -29,7 +38,7 @@ def find_face(imgpath):  #换脸,函数传参中number表示两张脸的相似度为99% -def change_face(image_1, image_2, user, kyaru, number=99): +def change_face(image_1, image_2, user, number=99):      url = "https://api-cn.faceplusplus.com/imagepp/v1/mergeface"      find_p1 = find_face(image_1)      find_p2 = find_face(image_2) @@ -50,12 +59,7 @@ def change_face(image_1, image_2, user, kyaru, number=99):      results = response['result']      image = base64.b64decode(results)      files = 'test' -    if int(kyaru) == 1: -        files = f'ATRI/data/temp/face/{user}' -    elif int(kyaru) == 2: -        files = f'ATRI/data/temp/head/{user}' -    print(files) - +    files = f'ATRI/data/temp/face/{user}'      if not os.path.exists(files):          os.mkdir(files)      with open(files + '/img3.jpg','wb') as file: @@ -69,61 +73,74 @@ def change_face(image_1, image_2, user, kyaru, number=99):  @on_command('ai_ch_face', aliases = ['AI换脸', 'ai换脸'], only_to_me = False)  async def _(session: CommandSession):      user = session.event.user_id -    with open(Path('.') / 'ATRI' / 'plugins' / 'switch' / 'switch.json', 'r') as f: -        data = json.load(f) -     -    if data["change_face"] == 0: -        with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', 'r') as f: -            data0 = json.load(f) +    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 str(user) in data0.keys(): -            pass -        else: -            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...貌似失败了呢......') +        if data["change_face"] == 0: +            with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', 'r') as f: +                data0 = json.load(f) -            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) +            if str(user) in data0.keys(): +                pass +            else: +                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)  # def f_1(x, A, B): diff --git a/ATRI/plugins/BlackList.py b/ATRI/plugins/BlackList.py new file mode 100644 index 0000000..d1a50d3 --- /dev/null +++ b/ATRI/plugins/BlackList.py @@ -0,0 +1,52 @@ +import time +import json +from pathlib import Path +from nonebot import on_command, CommandSession + +import config # type: ignore + + +master = config.MASTER() + + +@on_command('add_noobList', aliases = ['屏蔽', '移除'], only_to_me = False) +async def _(session: CommandSession): +    if session.event.user_id in master: +        msg = session.event.raw_message.split(' ', 1) +        b_type = msg[0] +        user = msg[1] + +        if b_type == '屏蔽': +            bL = {} +            bL[f"{user}"] = f"{user}" +            file = Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json' +            f = open(file, 'w') +            f.write(json.dumps(bL)) +            f.close() +            await session.send(f'正义执行!![{user}]已被ATRI屏蔽!') +         +        elif b_type == '移除': +            file = Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json' +            with open(file, 'r') as f: +                bL = json.load(f) +            bL.pop(f"{user}") +            f = open(file, 'w') +            f.write(json.dumps(bL)) +            f.close() +            await session.send('将[{user}]移出黑名单成功~!') + + +@on_command('look_noobList', aliases = ['查看黑名单'], only_to_me = False) +async def _(session: CommandSession): +    start = time.perf_counter() +    with open('ATRI/plugins/noobList/noobList.json', 'r') as f: +        data = json.load(f) +     +    msg = f'被ATRI列入黑名单有以下账号:\n=============\n' +    for i in data.keys(): +        msg0 = f'{i}\n' +        msg += msg0 +    end = time.perf_counter() +    msg0 = f"=============\nDone time: {round(end - start, 3)}s" +    msg += msg0 +    await session.send(msg)
\ No newline at end of file diff --git a/ATRI/plugins/UploadSqlite.py b/ATRI/plugins/UploadSqlite.py new file mode 100644 index 0000000..f1dc602 --- /dev/null +++ b/ATRI/plugins/UploadSqlite.py @@ -0,0 +1,136 @@ +import os +import time +import json +import sqlite3 +import nonebot + +from pathlib import Path +from nonebot import on_command, CommandSession + +from ATRI.modules import response # type: ignore + + +bot = nonebot.get_bot() +master = bot.config.SUPERUSERS # type: ignore +url = f'https://api.imjad.cn/pixiv/v1/?type=illust&id=' + + +@on_command('upload_setu', aliases = ['上传涩图'], only_to_me = False) +async def _(session: CommandSession): +    if session.event.user_id in master: +        start = time.perf_counter() +        msg = session.event.raw_message.split(' ', 2) +        print(msg) +        i_tpye = msg[1] +        pid = msg[2]  + +        URL = url + pid + +        dc = json.loads(response.request_api(URL)) +        if not dc: +            session.finish('ATRI在尝试解析数据时出问题...等会再试试吧...') +        title = dc["response"][0]["title"] +        tags = dc["response"][0]["tags"] +        account = dc["response"][0]["user"]["account"] +        name = dc["response"][0]["user"]["name"] +        u_id = dc["response"][0]["user"]["id"] +        user_link = f'https://www.pixiv.net/users/' + f'{u_id}' +        img = f'https://pixiv.cat/{pid}.jpg' + +        if i_tpye == '正常': +            if os.path.exists('ATRI/data/sqlite/setu/normal.db'): +                print('数据文件存在!') +            else: +                await session.send('数据库不存在,将在3秒后开始构建...') +                time.sleep(3) +                await session.send('开始构建数据库!') +                con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'normal.db') +                cur = con.cursor() +                cur.execute('CREATE TABLE normal(pid PID, title TITLE, tags TAGS, account ACCOUNT, name NAME, u_id UID, user_link USERLINK, img IMG, UNIQUE(pid, title, tags, account, name, u_id, user_link, img))') +                con.commit() +                cur.close() +                con.close() +                await session.send('完成') +      +            con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'normal.db') +            cur = con.cursor() +            cur.execute('INSERT INTO normal VALUES ("%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s")'%(pid, title, tags, account, name, u_id, user_link, img)) +            con.commit() +            con.close() + +        elif i_tpye == '擦边球': +            if os.path.exists('ATRI/data/sqlite/setu/nearR18.db'): +                print('数据文件存在!') +            else: +                await session.send('数据库不存在,将在3秒后开始构建...') +                time.sleep(3) +                await session.send('开始构建数据库!') +                con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'nearR18.db') +                cur = con.cursor() +                cur.execute('CREATE TABLE nearR18(pid PID, title TITLE, tags TAGS, account ACCOUNT, name NAME, u_id UID, user_link USERLINK, img IMG, UNIQUE(pid, title, tags, account, name, u_id, user_link, img))') +                con.commit() +                cur.close() +                con.close() +                await session.send('完成') +  +            con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'nearR18.db') +            cur = con.cursor() +            cur.execute('INSERT INTO nearR18 VALUES ("%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s")'%(pid, title, tags, account, name, u_id, user_link, img)) +            con.commit() +            con.close() + +        elif i_tpye == 'r18': +            if os.path.exists('ATRI/data/sqlite/cloudmusic/cloudmusic.db'): +                print('数据文件存在!') +            else: +                await session.send('数据库不存在,将在3秒后开始构建...') +                time.sleep(3) +                await session.send('开始构建数据库!') +                con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'r18.db') +                cur = con.cursor() +                cur.execute('CREATE TABLE r18(pid PID, title TITLE, tags TAGS, account ACCOUNT, name NAME, u_id UID, user_link USERLINK, img IMG, UNIQUE(pid, title, tags, account, name, u_id, user_link, img))') +                con.commit() +                cur.close() +                con.close() +                await session.send('完成') + +            con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'setu' / 'r18.db') +            cur = con.cursor() +            cur.execute('INSERT INTO r18 VALUES ("%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s")'%(pid, title, tags, account, name, u_id, user_link, img)) +            con.commit() +            con.close() +         +        end = time.perf_counter() +         +        await session.send(f'数据上传完成!\n耗时: {round(end - start, 3)}s') + +@on_command('upload_cloudmusic', aliases = ['上传网抑语', '网抑云', '网易云'], only_to_me = False) +async def _(session: CommandSession): +    if session.event.user_id in master: +        start = time.perf_counter() +        msg = session.event.raw_message.split(' ', 1) +        msg = msg[1] + +        if os.path.exists('ATRI/data/sqlite/cloudmusic/cloudmusic.db'): +                print('数据文件存在!') +        else: +            await session.send('数据库不存在,将在3秒后开始构建...') +            time.sleep(3) +            await session.send('开始构建数据库!') +            con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'cloudmusic' / 'cloudmusic.db') +            cur = con.cursor() +            cur.execute('CREATE TABLE cloudmusic(msg MSG, UNIQUE(msg))') +            con.commit() +            cur.close() +            con.close() +            await session.send('完成') +  +        con = sqlite3.connect(Path('.') / 'ATRI' / 'data' / 'sqlite' / 'cloudmusic' / 'cloudmusic.db') +        cur = con.cursor() +        cur.execute('INSERT INTO cloudmusic VALUES ("%s")'%(msg)) +        con.commit() +        con.close() + +        end = time.perf_counter() + +        await session.send(f'数据上传完成!\n耗时: {round(end - start, 3)}s')
\ No newline at end of file diff --git a/ATRI/plugins/__pycache__/AIchangeFace.cpython-38.pyc b/ATRI/plugins/__pycache__/AIchangeFace.cpython-38.pycBinary files differ index bb2e1bb..6d580a7 100644 --- a/ATRI/plugins/__pycache__/AIchangeFace.cpython-38.pyc +++ b/ATRI/plugins/__pycache__/AIchangeFace.cpython-38.pyc diff --git a/ATRI/plugins/__pycache__/chat.cpython-38.pyc b/ATRI/plugins/__pycache__/chat.cpython-38.pycBinary files differ index c514c22..c458680 100644 --- a/ATRI/plugins/__pycache__/chat.cpython-38.pyc +++ b/ATRI/plugins/__pycache__/chat.cpython-38.pyc diff --git a/ATRI/plugins/__pycache__/hbook.cpython-38.pyc b/ATRI/plugins/__pycache__/hbook.cpython-38.pycBinary files differ index 0a2d194..a5b647d 100644 --- a/ATRI/plugins/__pycache__/hbook.cpython-38.pyc +++ b/ATRI/plugins/__pycache__/hbook.cpython-38.pyc diff --git a/ATRI/plugins/__pycache__/richBISS.cpython-38.pyc b/ATRI/plugins/__pycache__/richBISS.cpython-38.pycBinary files differ new file mode 100644 index 0000000..c0df9d6 --- /dev/null +++ b/ATRI/plugins/__pycache__/richBISS.cpython-38.pyc diff --git a/ATRI/plugins/animeSearch.py b/ATRI/plugins/animeSearch.py index 0ef3388..c8f0007 100644 --- a/ATRI/plugins/animeSearch.py +++ b/ATRI/plugins/animeSearch.py @@ -1,6 +1,7 @@ -# -*- coding:utf-8 -*-  import re  import json +from datetime import datetime +from random import choice  from aiohttp import ClientSession  from nonebot import on_command, CommandSession @@ -11,6 +12,13 @@ async def get_bytes(url, headers = None):              a = await response.read()      return a +def now_time(): +    now_ = datetime.now() +    hour = now_.hour +    minute = now_.minute +    now = hour + minute / 60 +    return now +  SIMPLE     = "万与丑专业丛东丝丢两严丧个丬丰临为丽举么义乌乐乔习乡书买乱争于亏云亘亚产亩亲亵亸亿仅从仑仓仪们价众优伙会伛伞伟传伤伥伦伧伪伫体余佣佥侠侣侥侦侧侨侩侪侬俣俦俨俩俪俭债倾偬偻偾偿傥傧储傩儿兑兖党兰关兴兹养兽冁内冈册写军农冢冯冲决况冻净凄凉凌减凑凛几凤凫凭凯击凼凿刍划刘则刚创删别刬刭刽刿剀剂剐剑剥剧劝办务劢动励劲劳势勋勐勚匀匦匮区医华协单卖卢卤卧卫却卺厂厅历厉压厌厍厕厢厣厦厨厩厮县参叆叇双发变叙叠叶号叹叽吁后吓吕吗吣吨听启吴呒呓呕呖呗员呙呛呜咏咔咙咛咝咤咴咸哌响哑哒哓哔哕哗哙哜哝哟唛唝唠唡唢唣唤唿啧啬啭啮啰啴啸喷喽喾嗫呵嗳嘘嘤嘱噜噼嚣嚯团园囱围囵国图圆圣圹场坂坏块坚坛坜坝坞坟坠垄垅垆垒垦垧垩垫垭垯垱垲垴埘埙埚埝埯堑堕塆墙壮声壳壶壸处备复够头夸夹夺奁奂奋奖奥妆妇妈妩妪妫姗姜娄娅娆娇娈娱娲娴婳婴婵婶媪嫒嫔嫱嬷孙学孪宁宝实宠审宪宫宽宾寝对寻导寿将尔尘尧尴尸尽层屃屉届属屡屦屿岁岂岖岗岘岙岚岛岭岳岽岿峃峄峡峣峤峥峦崂崃崄崭嵘嵚嵛嵝嵴巅巩巯币帅师帏帐帘帜带帧帮帱帻帼幂幞干并广庄庆庐庑库应庙庞废庼廪开异弃张弥弪弯弹强归当录彟彦彻径徕御忆忏忧忾怀态怂怃怄怅怆怜总怼怿恋恳恶恸恹恺恻恼恽悦悫悬悭悯惊惧惨惩惫惬惭惮惯愍愠愤愦愿慑慭憷懑懒懔戆戋戏戗战戬户扎扑扦执扩扪扫扬扰抚抛抟抠抡抢护报担拟拢拣拥拦拧拨择挂挚挛挜挝挞挟挠挡挢挣挤挥挦捞损捡换捣据捻掳掴掷掸掺掼揸揽揿搀搁搂搅携摄摅摆摇摈摊撄撑撵撷撸撺擞攒敌敛数斋斓斗斩断无旧时旷旸昙昼昽显晋晒晓晔晕晖暂暧札术朴机杀杂权条来杨杩杰极构枞枢枣枥枧枨枪枫枭柜柠柽栀栅标栈栉栊栋栌栎栏树栖样栾桊桠桡桢档桤桥桦桧桨桩梦梼梾检棂椁椟椠椤椭楼榄榇榈榉槚槛槟槠横樯樱橥橱橹橼檐檩欢欤欧歼殁殇残殒殓殚殡殴毁毂毕毙毡毵氇气氢氩氲汇汉污汤汹沓沟没沣沤沥沦沧沨沩沪沵泞泪泶泷泸泺泻泼泽泾洁洒洼浃浅浆浇浈浉浊测浍济浏浐浑浒浓浔浕涂涌涛涝涞涟涠涡涢涣涤润涧涨涩淀渊渌渍渎渐渑渔渖渗温游湾湿溃溅溆溇滗滚滞滟滠满滢滤滥滦滨滩滪漤潆潇潋潍潜潴澜濑濒灏灭灯灵灾灿炀炉炖炜炝点炼炽烁烂烃烛烟烦烧烨烩烫烬热焕焖焘煅煳熘爱爷牍牦牵牺犊犟状犷犸犹狈狍狝狞独狭狮狯狰狱狲猃猎猕猡猪猫猬献獭玑玙玚玛玮环现玱玺珉珏珐珑珰珲琎琏琐琼瑶瑷璇璎瓒瓮瓯电画畅畲畴疖疗疟疠疡疬疮疯疱疴痈痉痒痖痨痪痫痴瘅瘆瘗瘘瘪瘫瘾瘿癞癣癫癯皑皱皲盏盐监盖盗盘眍眦眬着睁睐睑瞒瞩矫矶矾矿砀码砖砗砚砜砺砻砾础硁硅硕硖硗硙硚确硷碍碛碜碱碹磙礼祎祢祯祷祸禀禄禅离秃秆种积称秽秾稆税稣稳穑穷窃窍窑窜窝窥窦窭竖竞笃笋笔笕笺笼笾筑筚筛筜筝筹签简箓箦箧箨箩箪箫篑篓篮篱簖籁籴类籼粜粝粤粪粮糁糇紧絷纟纠纡红纣纤纥约级纨纩纪纫纬纭纮纯纰纱纲纳纴纵纶纷纸纹纺纻纼纽纾线绀绁绂练组绅细织终绉绊绋绌绍绎经绐绑绒结绔绕绖绗绘给绚绛络绝绞统绠绡绢绣绤绥绦继绨绩绪绫绬续绮绯绰绱绲绳维绵绶绷绸绹绺绻综绽绾绿缀缁缂缃缄缅缆缇缈缉缊缋缌缍缎缏缐缑缒缓缔缕编缗缘缙缚缛缜缝缞缟缠缡缢缣缤缥缦缧缨缩缪缫缬缭缮缯缰缱缲缳缴缵罂网罗罚罢罴羁羟羡翘翙翚耢耧耸耻聂聋职聍联聩聪肃肠肤肷肾肿胀胁胆胜胧胨胪胫胶脉脍脏脐脑脓脔脚脱脶脸腊腌腘腭腻腼腽腾膑臜舆舣舰舱舻艰艳艹艺节芈芗芜芦苁苇苈苋苌苍苎苏苘苹茎茏茑茔茕茧荆荐荙荚荛荜荞荟荠荡荣荤荥荦荧荨荩荪荫荬荭荮药莅莜莱莲莳莴莶获莸莹莺莼萚萝萤营萦萧萨葱蒇蒉蒋蒌蓝蓟蓠蓣蓥蓦蔷蔹蔺蔼蕲蕴薮藁藓虏虑虚虫虬虮虽虾虿蚀蚁蚂蚕蚝蚬蛊蛎蛏蛮蛰蛱蛲蛳蛴蜕蜗蜡蝇蝈蝉蝎蝼蝾螀螨蟏衅衔补衬衮袄袅袆袜袭袯装裆裈裢裣裤裥褛褴襁襕见观觃规觅视觇览觉觊觋觌觍觎觏觐觑觞触觯詟誉誊讠计订讣认讥讦讧讨让讪讫训议讯记讱讲讳讴讵讶讷许讹论讻讼讽设访诀证诂诃评诅识诇诈诉诊诋诌词诎诏诐译诒诓诔试诖诗诘诙诚诛诜话诞诟诠诡询诣诤该详诧诨诩诪诫诬语诮误诰诱诲诳说诵诶请诸诹诺读诼诽课诿谀谁谂调谄谅谆谇谈谊谋谌谍谎谏谐谑谒谓谔谕谖谗谘谙谚谛谜谝谞谟谠谡谢谣谤谥谦谧谨谩谪谫谬谭谮谯谰谱谲谳谴谵谶谷豮贝贞负贠贡财责贤败账货质贩贪贫贬购贮贯贰贱贲贳贴贵贶贷贸费贺贻贼贽贾贿赀赁赂赃资赅赆赇赈赉赊赋赌赍赎赏赐赑赒赓赔赕赖赗赘赙赚赛赜赝赞赟赠赡赢赣赪赵赶趋趱趸跃跄跖跞践跶跷跸跹跻踊踌踪踬踯蹑蹒蹰蹿躏躜躯车轧轨轩轪轫转轭轮软轰轱轲轳轴轵轶轷轸轹轺轻轼载轾轿辀辁辂较辄辅辆辇辈辉辊辋辌辍辎辏辐辑辒输辔辕辖辗辘辙辚辞辩辫边辽达迁过迈运还这进远违连迟迩迳迹适选逊递逦逻遗遥邓邝邬邮邹邺邻郁郄郏郐郑郓郦郧郸酝酦酱酽酾酿释里鉅鉴銮錾钆钇针钉钊钋钌钍钎钏钐钑钒钓钔钕钖钗钘钙钚钛钝钞钟钠钡钢钣钤钥钦钧钨钩钪钫钬钭钮钯钰钱钲钳钴钵钶钷钸钹钺钻钼钽钾钿铀铁铂铃铄铅铆铈铉铊铋铍铎铏铐铑铒铕铗铘铙铚铛铜铝铞铟铠铡铢铣铤铥铦铧铨铪铫铬铭铮铯铰铱铲铳铴铵银铷铸铹铺铻铼铽链铿销锁锂锃锄锅锆锇锈锉锊锋锌锍锎锏锐锑锒锓锔锕锖锗错锚锜锞锟锠锡锢锣锤锥锦锨锩锫锬锭键锯锰锱锲锳锴锵锶锷锸锹锺锻锼锽锾锿镀镁镂镃镆镇镈镉镊镌镍镎镏镐镑镒镕镖镗镙镚镛镜镝镞镟镠镡镢镣镤镥镦镧镨镩镪镫镬镭镮镯镰镱镲镳镴镶长门闩闪闫闬闭问闯闰闱闲闳间闵闶闷闸闹闺闻闼闽闾闿阀阁阂阃阄阅阆阇阈阉阊阋阌阍阎阏阐阑阒阓阔阕阖阗阘阙阚阛队阳阴阵阶际陆陇陈陉陕陧陨险随隐隶隽难雏雠雳雾霁霉霭靓静靥鞑鞒鞯鞴韦韧韨韩韪韫韬韵页顶顷顸项顺须顼顽顾顿颀颁颂颃预颅领颇颈颉颊颋颌颍颎颏颐频颒颓颔颕颖颗题颙颚颛颜额颞颟颠颡颢颣颤颥颦颧风飏飐飑飒飓飔飕飖飗飘飙飚飞飨餍饤饥饦饧饨饩饪饫饬饭饮饯饰饱饲饳饴饵饶饷饸饹饺饻饼饽饾饿馀馁馂馃馄馅馆馇馈馉馊馋馌馍馎馏馐馑馒馓馔馕马驭驮驯驰驱驲驳驴驵驶驷驸驹驺驻驼驽驾驿骀骁骂骃骄骅骆骇骈骉骊骋验骍骎骏骐骑骒骓骔骕骖骗骘骙骚骛骜骝骞骟骠骡骢骣骤骥骦骧髅髋髌鬓魇魉鱼鱽鱾鱿鲀鲁鲂鲄鲅鲆鲇鲈鲉鲊鲋鲌鲍鲎鲏鲐鲑鲒鲓鲔鲕鲖鲗鲘鲙鲚鲛鲜鲝鲞鲟鲠鲡鲢鲣鲤鲥鲦鲧鲨鲩鲪鲫鲬鲭鲮鲯鲰鲱鲲鲳鲴鲵鲶鲷鲸鲹鲺鲻鲼鲽鲾鲿鳀鳁鳂鳃鳄鳅鳆鳇鳈鳉鳊鳋鳌鳍鳎鳏鳐鳑鳒鳓鳔鳕鳖鳗鳘鳙鳛鳜鳝鳞鳟鳠鳡鳢鳣鸟鸠鸡鸢鸣鸤鸥鸦鸧鸨鸩鸪鸫鸬鸭鸮鸯鸰鸱鸲鸳鸴鸵鸶鸷鸸鸹鸺鸻鸼鸽鸾鸿鹀鹁鹂鹃鹄鹅鹆鹇鹈鹉鹊鹋鹌鹍鹎鹏鹐鹑鹒鹓鹔鹕鹖鹗鹘鹚鹛鹜鹝鹞鹟鹠鹡鹢鹣鹤鹥鹦鹧鹨鹩鹪鹫鹬鹭鹯鹰鹱鹲鹳鹴鹾麦麸黄黉黡黩黪黾鼋鼌鼍鼗鼹齄齐齑齿龀龁龂龃龄龅龆龇龈龉龊龋龌龙龚龛龟志制咨只里系范松没尝尝闹面准钟别闲干尽脏拼"  TRADITION  = "萬與醜專業叢東絲丟兩嚴喪個爿豐臨為麗舉麼義烏樂喬習鄉書買亂爭於虧雲亙亞產畝親褻嚲億僅從侖倉儀們價眾優夥會傴傘偉傳傷倀倫傖偽佇體餘傭僉俠侶僥偵側僑儈儕儂俁儔儼倆儷儉債傾傯僂僨償儻儐儲儺兒兌兗黨蘭關興茲養獸囅內岡冊寫軍農塚馮衝決況凍淨淒涼淩減湊凜幾鳳鳧憑凱擊氹鑿芻劃劉則剛創刪別剗剄劊劌剴劑剮劍剝劇勸辦務勱動勵勁勞勢勳猛勩勻匭匱區醫華協單賣盧鹵臥衛卻巹廠廳曆厲壓厭厙廁廂厴廈廚廄廝縣參靉靆雙發變敘疊葉號歎嘰籲後嚇呂嗎唚噸聽啟吳嘸囈嘔嚦唄員咼嗆嗚詠哢嚨嚀噝吒噅鹹呱響啞噠嘵嗶噦嘩噲嚌噥喲嘜嗊嘮啢嗩唕喚呼嘖嗇囀齧囉嘽嘯噴嘍嚳囁嗬噯噓嚶囑嚕劈囂謔團園囪圍圇國圖圓聖壙場阪壞塊堅壇壢壩塢墳墜壟壟壚壘墾坰堊墊埡墶壋塏堖塒塤堝墊垵塹墮壪牆壯聲殼壺壼處備復夠頭誇夾奪奩奐奮獎奧妝婦媽嫵嫗媯姍薑婁婭嬈嬌孌娛媧嫻嫿嬰嬋嬸媼嬡嬪嬙嬤孫學孿寧寶實寵審憲宮寬賓寢對尋導壽將爾塵堯尷屍盡層屭屜屆屬屢屨嶼歲豈嶇崗峴嶴嵐島嶺嶽崠巋嶨嶧峽嶢嶠崢巒嶗崍嶮嶄嶸嶔崳嶁脊巔鞏巰幣帥師幃帳簾幟帶幀幫幬幘幗冪襆幹並廣莊慶廬廡庫應廟龐廢廎廩開異棄張彌弳彎彈強歸當錄彠彥徹徑徠禦憶懺憂愾懷態慫憮慪悵愴憐總懟懌戀懇惡慟懨愷惻惱惲悅愨懸慳憫驚懼慘懲憊愜慚憚慣湣慍憤憒願懾憖怵懣懶懍戇戔戲戧戰戩戶紮撲扡執擴捫掃揚擾撫拋摶摳掄搶護報擔擬攏揀擁攔擰撥擇掛摯攣掗撾撻挾撓擋撟掙擠揮撏撈損撿換搗據撚擄摑擲撣摻摜摣攬撳攙擱摟攪攜攝攄擺搖擯攤攖撐攆擷擼攛擻攢敵斂數齋斕鬥斬斷無舊時曠暘曇晝曨顯晉曬曉曄暈暉暫曖劄術樸機殺雜權條來楊榪傑極構樅樞棗櫪梘棖槍楓梟櫃檸檉梔柵標棧櫛櫳棟櫨櫟欄樹棲樣欒棬椏橈楨檔榿橋樺檜槳樁夢檮棶檢欞槨櫝槧欏橢樓欖櫬櫚櫸檟檻檳櫧橫檣櫻櫫櫥櫓櫞簷檁歡歟歐殲歿殤殘殞殮殫殯毆毀轂畢斃氈毿氌氣氫氬氳彙漢汙湯洶遝溝沒灃漚瀝淪滄渢溈滬濔濘淚澩瀧瀘濼瀉潑澤涇潔灑窪浹淺漿澆湞溮濁測澮濟瀏滻渾滸濃潯濜塗湧濤澇淶漣潿渦溳渙滌潤澗漲澀澱淵淥漬瀆漸澠漁瀋滲溫遊灣濕潰濺漵漊潷滾滯灩灄滿瀅濾濫灤濱灘澦濫瀠瀟瀲濰潛瀦瀾瀨瀕灝滅燈靈災燦煬爐燉煒熗點煉熾爍爛烴燭煙煩燒燁燴燙燼熱煥燜燾煆糊溜愛爺牘犛牽犧犢強狀獷獁猶狽麅獮獰獨狹獅獪猙獄猻獫獵獼玀豬貓蝟獻獺璣璵瑒瑪瑋環現瑲璽瑉玨琺瓏璫琿璡璉瑣瓊瑤璦璿瓔瓚甕甌電畫暢佘疇癤療瘧癘瘍鬁瘡瘋皰屙癰痙癢瘂癆瘓癇癡癉瘮瘞瘺癟癱癮癭癩癬癲臒皚皺皸盞鹽監蓋盜盤瞘眥矓著睜睞瞼瞞矚矯磯礬礦碭碼磚硨硯碸礪礱礫礎硜矽碩硤磽磑礄確鹼礙磧磣堿镟滾禮禕禰禎禱禍稟祿禪離禿稈種積稱穢穠穭稅穌穩穡窮竊竅窯竄窩窺竇窶豎競篤筍筆筧箋籠籩築篳篩簹箏籌簽簡籙簀篋籜籮簞簫簣簍籃籬籪籟糴類秈糶糲粵糞糧糝餱緊縶糸糾紆紅紂纖紇約級紈纊紀紉緯紜紘純紕紗綱納紝縱綸紛紙紋紡紵紖紐紓線紺絏紱練組紳細織終縐絆紼絀紹繹經紿綁絨結絝繞絰絎繪給絢絳絡絕絞統綆綃絹繡綌綏絛繼綈績緒綾緓續綺緋綽緔緄繩維綿綬繃綢綯綹綣綜綻綰綠綴緇緙緗緘緬纜緹緲緝縕繢緦綞緞緶線緱縋緩締縷編緡緣縉縛縟縝縫縗縞纏縭縊縑繽縹縵縲纓縮繆繅纈繚繕繒韁繾繰繯繳纘罌網羅罰罷羆羈羥羨翹翽翬耮耬聳恥聶聾職聹聯聵聰肅腸膚膁腎腫脹脅膽勝朧腖臚脛膠脈膾髒臍腦膿臠腳脫腡臉臘醃膕齶膩靦膃騰臏臢輿艤艦艙艫艱豔艸藝節羋薌蕪蘆蓯葦藶莧萇蒼苧蘇檾蘋莖蘢蔦塋煢繭荊薦薘莢蕘蓽蕎薈薺蕩榮葷滎犖熒蕁藎蓀蔭蕒葒葤藥蒞蓧萊蓮蒔萵薟獲蕕瑩鶯蓴蘀蘿螢營縈蕭薩蔥蕆蕢蔣蔞藍薊蘺蕷鎣驀薔蘞藺藹蘄蘊藪槁蘚虜慮虛蟲虯蟣雖蝦蠆蝕蟻螞蠶蠔蜆蠱蠣蟶蠻蟄蛺蟯螄蠐蛻蝸蠟蠅蟈蟬蠍螻蠑螿蟎蠨釁銜補襯袞襖嫋褘襪襲襏裝襠褌褳襝褲襇褸襤繈襴見觀覎規覓視覘覽覺覬覡覿覥覦覯覲覷觴觸觶讋譽謄訁計訂訃認譏訐訌討讓訕訖訓議訊記訒講諱謳詎訝訥許訛論訩訟諷設訪訣證詁訶評詛識詗詐訴診詆謅詞詘詔詖譯詒誆誄試詿詩詰詼誠誅詵話誕詬詮詭詢詣諍該詳詫諢詡譸誡誣語誚誤誥誘誨誑說誦誒請諸諏諾讀諑誹課諉諛誰諗調諂諒諄誶談誼謀諶諜謊諫諧謔謁謂諤諭諼讒諮諳諺諦謎諞諝謨讜謖謝謠謗諡謙謐謹謾謫譾謬譚譖譙讕譜譎讞譴譫讖穀豶貝貞負貟貢財責賢敗賬貨質販貪貧貶購貯貫貳賤賁貰貼貴貺貸貿費賀貽賊贄賈賄貲賃賂贓資賅贐賕賑賚賒賦賭齎贖賞賜贔賙賡賠賧賴賵贅賻賺賽賾贗讚贇贈贍贏贛赬趙趕趨趲躉躍蹌蹠躒踐躂蹺蹕躚躋踴躊蹤躓躑躡蹣躕躥躪躦軀車軋軌軒軑軔轉軛輪軟轟軲軻轤軸軹軼軤軫轢軺輕軾載輊轎輈輇輅較輒輔輛輦輩輝輥輞輬輟輜輳輻輯轀輸轡轅轄輾轆轍轔辭辯辮邊遼達遷過邁運還這進遠違連遲邇逕跡適選遜遞邐邏遺遙鄧鄺鄔郵鄒鄴鄰鬱郤郟鄶鄭鄆酈鄖鄲醞醱醬釅釃釀釋裏钜鑒鑾鏨釓釔針釘釗釙釕釷釺釧釤鈒釩釣鍆釹鍚釵鈃鈣鈈鈦鈍鈔鍾鈉鋇鋼鈑鈐鑰欽鈞鎢鉤鈧鈁鈥鈄鈕鈀鈺錢鉦鉗鈷缽鈳鉕鈽鈸鉞鑽鉬鉭鉀鈿鈾鐵鉑鈴鑠鉛鉚鈰鉉鉈鉍鈹鐸鉶銬銠鉺銪鋏鋣鐃銍鐺銅鋁銱銦鎧鍘銖銑鋌銩銛鏵銓鉿銚鉻銘錚銫鉸銥鏟銃鐋銨銀銣鑄鐒鋪鋙錸鋱鏈鏗銷鎖鋰鋥鋤鍋鋯鋨鏽銼鋝鋒鋅鋶鐦鐧銳銻鋃鋟鋦錒錆鍺錯錨錡錁錕錩錫錮鑼錘錐錦鍁錈錇錟錠鍵鋸錳錙鍥鍈鍇鏘鍶鍔鍤鍬鍾鍛鎪鍠鍰鎄鍍鎂鏤鎡鏌鎮鎛鎘鑷鐫鎳鎿鎦鎬鎊鎰鎔鏢鏜鏍鏰鏞鏡鏑鏃鏇鏐鐔钁鐐鏷鑥鐓鑭鐠鑹鏹鐙鑊鐳鐶鐲鐮鐿鑔鑣鑞鑲長門閂閃閆閈閉問闖閏闈閑閎間閔閌悶閘鬧閨聞闥閩閭闓閥閣閡閫鬮閱閬闍閾閹閶鬩閿閽閻閼闡闌闃闠闊闋闔闐闒闕闞闤隊陽陰陣階際陸隴陳陘陝隉隕險隨隱隸雋難雛讎靂霧霽黴靄靚靜靨韃鞽韉韝韋韌韍韓韙韞韜韻頁頂頃頇項順須頊頑顧頓頎頒頌頏預顱領頗頸頡頰頲頜潁熲頦頤頻頮頹頷頴穎顆題顒顎顓顏額顳顢顛顙顥纇顫顬顰顴風颺颭颮颯颶颸颼颻飀飄飆飆飛饗饜飣饑飥餳飩餼飪飫飭飯飲餞飾飽飼飿飴餌饒餉餄餎餃餏餅餑餖餓餘餒餕餜餛餡館餷饋餶餿饞饁饃餺餾饈饉饅饊饌饢馬馭馱馴馳驅馹駁驢駔駛駟駙駒騶駐駝駑駕驛駘驍罵駰驕驊駱駭駢驫驪騁驗騂駸駿騏騎騍騅騌驌驂騙騭騤騷騖驁騮騫騸驃騾驄驏驟驥驦驤髏髖髕鬢魘魎魚魛魢魷魨魯魴魺鮁鮃鯰鱸鮋鮓鮒鮊鮑鱟鮍鮐鮭鮚鮳鮪鮞鮦鰂鮜鱠鱭鮫鮮鮺鯗鱘鯁鱺鰱鰹鯉鰣鰷鯀鯊鯇鮶鯽鯒鯖鯪鯕鯫鯡鯤鯧鯝鯢鯰鯛鯨鯵鯴鯔鱝鰈鰏鱨鯷鰮鰃鰓鱷鰍鰒鰉鰁鱂鯿鰠鼇鰭鰨鰥鰩鰟鰜鰳鰾鱈鱉鰻鰵鱅鰼鱖鱔鱗鱒鱯鱤鱧鱣鳥鳩雞鳶鳴鳲鷗鴉鶬鴇鴆鴣鶇鸕鴨鴞鴦鴒鴟鴝鴛鴬鴕鷥鷙鴯鴰鵂鴴鵃鴿鸞鴻鵐鵓鸝鵑鵠鵝鵒鷳鵜鵡鵲鶓鵪鶤鵯鵬鵮鶉鶊鵷鷫鶘鶡鶚鶻鶿鶥鶩鷊鷂鶲鶹鶺鷁鶼鶴鷖鸚鷓鷚鷯鷦鷲鷸鷺鸇鷹鸌鸏鸛鸘鹺麥麩黃黌黶黷黲黽黿鼂鼉鞀鼴齇齊齏齒齔齕齗齟齡齙齠齜齦齬齪齲齷龍龔龕龜誌製谘隻裡係範鬆冇嚐嘗鬨麵準鐘彆閒乾儘臟拚" @@ -51,64 +59,77 @@ def toSimpleString(str):  async def _(session: CommandSession):      user = session.event.user_id      msg = session.current_arg.strip() -    with open('ATRI/plugins/noobList/noobList.json', 'r') as f: -        data = json.load(f) - -    if str(user) in data.keys(): -        pass +    if 0 <= now_time() < 5.5: +        await session.send( +            choice( +                [ +                    'zzzz......', +                    'zzzzzzzz......', +                    'zzz...好涩哦..zzz....', +                    '别...不要..zzz..那..zzz..', +                    '嘻嘻..zzz..呐~..zzzz..' +                ] +            ) +        )      else: -        if not msg: -            msg = session.get('message', prompt = "请发送一张图片") -         -        await session.send("开始以图搜番\n(如搜索时间过长或无反应则为图片格式有问题)") +        with open('ATRI/plugins/noobList/noobList.json', 'r') as f: +            data = json.load(f) -        p = '\\[CQ\\:image\\,file\\=.*?\\,url\\=(.*?)\\]' +        if str(user) in data.keys(): +            pass +        else: +            if not msg: +                msg = session.get('message', prompt = "请发送一张图片") +             +            await session.send("开始以图搜番\n(如搜索时间过长或无反应则为图片格式有问题)") -        img = re.findall(p, msg) +            p = '\\[CQ\\:image\\,file\\=.*?\\,url\\=(.*?)\\]' -        if img: -            URL = f'https://trace.moe/api/search?url={img[0]}' +            img = re.findall(p, msg) -            req = await get_bytes(URL) +            if img: +                URL = f'https://trace.moe/api/search?url={img[0]}' -            if req: -                data = json.loads(req.decode()) +                req = await get_bytes(URL) -                d = {} +                if req: +                    data = json.loads(req.decode()) -                for i in range(len(data['docs'])): -                    if data['docs'][i]['title_chinese'] in d.keys(): -                        d[data['docs'][i]['title_chinese']][0] += data['docs'][i]['similarity'] -                 -                    else: -                        m = data['docs'][i]['at']/60 -                        s = data['docs'][i]['at']%60 +                    d = {} -                        if data['docs'][i]['episode'] == '': -                            n = 1 -                         +                    for i in range(len(data['docs'])): +                        if data['docs'][i]['title_chinese'] in d.keys(): +                            d[data['docs'][i]['title_chinese']][0] += data['docs'][i]['similarity'] +                                              else: -                            n = data['docs'][i]['episode'] -                         -                        d[toSimpleString(data['docs'][i]['title_chinese'])] = [data['docs'][i]['similarity'],f'第{n}集',f'{int(m)}分{int(s)}秒处'] - -                result = sorted( -                    d.items(), -                    key = lambda x:x[1], -                    reverse = True -                ) - -                t = 0 - -                msg0 = f'[CQ:at,qq={user}]\n根据所提供的图片按照相似度找到{len(d)}个结果:' - -                for i in result: -                    t +=1 -                    lk = ('%.2f%%' % (i[1][0] * 100)) -                    msg = (f'\n——————————\n({t})\n相似度:{lk}\n动漫名:《{i[0]}》\n时间点:{i[1][1]} {i[1][2]}') -                    msg0 += msg +                            m = data['docs'][i]['at']/60 +                            s = data['docs'][i]['at']%60 + +                            if data['docs'][i]['episode'] == '': +                                n = 1 +                             +                            else: +                                n = data['docs'][i]['episode'] +                             +                            d[toSimpleString(data['docs'][i]['title_chinese'])] = [data['docs'][i]['similarity'],f'第{n}集',f'{int(m)}分{int(s)}秒处'] + +                    result = sorted( +                        d.items(), +                        key = lambda x:x[1], +                        reverse = True +                    ) + +                    t = 0 + +                    msg0 = f'[CQ:at,qq={user}]\n根据所提供的图片按照相似度找到{len(d)}个结果:' + +                    for i in result: +                        t +=1 +                        lk = ('%.2f%%' % (i[1][0] * 100)) +                        msg = (f'\n——————————\n({t})\n相似度:{lk}\n动漫名:《{i[0]}》\n时间点:{i[1][1]} {i[1][2]}') +                        msg0 += msg +                     +                    await session.send(msg0) -                await session.send(msg0) -             -            else: -                await session.send("搜索似乎失败了呢...")
\ No newline at end of file +                else: +                    await session.send("搜索似乎失败了呢...")
\ No newline at end of file diff --git a/ATRI/plugins/chat.py b/ATRI/plugins/chat.py index 846694f..6baacdc 100644 --- a/ATRI/plugins/chat.py +++ b/ATRI/plugins/chat.py @@ -4,7 +4,6 @@ import json  import nonebot  import warnings  from pathlib import Path -import numpy as np  from random import randint, choice  from datetime import datetime, timedelta  from nonebot import on_command, scheduler @@ -49,7 +48,8 @@ async def _():              )          elif res == 2: -            img = Path('.') / 'ATRI' / 'data' / 'voice' / 'SY.jpg' +            img = Path('.') / 'ATRI' / 'data' / 'emoji' / 'SY.jpg' +            img = os.path.abspath(img)              msg = f'[CQ:image,file=file:///{os.path.abspath(img)}]'          for group in groups: @@ -87,7 +87,8 @@ async def _():                      'SJ.jpg', 'SJ1.jpg'                  ]              ) -            img = Path('.') / 'ATRI' / 'data' / 'voice' / f'{img}' +            img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}' +            img = os.path.abspath(img)              msg = f'[CQ:image,file=file:///{os.path.abspath(img)}]'          for group in groups: @@ -284,17 +285,7 @@ async def az(session: CommandSession):          pass      else:          if 0 <= now_time() < 5.5: -            await session.send( -                choice( -                    [ -                        'zzzz......', -                        'zzzzzzzz......', -                        'zzz...好涩哦..zzz....', -                        '别...不要..zzz..那..zzz..', -                        '嘻嘻..zzz..呐~..zzzz..' -                    ] -                ) -            ) +            pass          else:              res = randint(1,3)              if res == 1: @@ -318,17 +309,7 @@ async def az(session: CommandSession):          pass      else:          if 0 <= now_time() < 5.5: -            await session.send( -                choice( -                    [ -                        'zzzz......', -                        'zzzzzzzz......', -                        'zzz...好涩哦..zzz....', -                        '别...不要..zzz..那..zzz..', -                        '嘻嘻..zzz..呐~..zzzz..' -                    ] -                ) -            ) +            pass          else:              res = randint(1,3)              if res == 1: @@ -363,17 +344,7 @@ async def _(session: CommandSession):          pass      else:          if 0 <= now_time() < 5.5: -            await session.send( -                choice( -                    [ -                        'zzzz......', -                        'zzzzzzzz......', -                        'zzz...好涩哦..zzz....', -                        '别...不要..zzz..那..zzz..', -                        '嘻嘻..zzz..呐~..zzzz..' -                    ] -                ) -            ) +            pass          else:              res = randint(1,3)              if res == 1: @@ -407,17 +378,7 @@ async def _(session: CommandSession):          pass      else:          if 0 <= now_time() < 5.5: -            await session.send( -                choice( -                    [ -                        'zzzz......', -                        'zzzzzzzz......', -                        'zzz...好涩哦..zzz....', -                        '别...不要..zzz..那..zzz..', -                        '嘻嘻..zzz..呐~..zzzz..' -                    ] -                ) -            ) +            pass          else:              if randint(1,3) == 1:                  img = choice( @@ -431,7 +392,7 @@ async def _(session: CommandSession): -@on_command('kouchou', patterns = [r"草你妈|操|你妈|脑瘫|废柴|fw|five|废物|战斗|爬|爪巴|sb|SB|啥[b批比逼]|傻b|2b|给👴爬|嘴臭"], only_to_me = False) +@on_command('kouchou', patterns = [r"草你妈|操|你妈|脑瘫|废柴|fw|five|废物|战斗|爬|爪巴|sb|SB|啥[b批比逼]|傻b|给[爷👴]爬|嘴臭"], only_to_me = False)  async def _(session: CommandSession):      user = session.event.user_id      with open('ATRI/plugins/noobList/noobList.json', 'r') as f: @@ -441,17 +402,7 @@ async def _(session: CommandSession):          pass      else:          if 0 <= now_time() < 5.5: -            await session.send( -                choice( -                    [ -                        'zzzz......', -                        'zzzzzzzz......', -                        'zzz...好涩哦..zzz....', -                        '别...不要..zzz..那..zzz..', -                        '嘻嘻..zzz..呐~..zzzz..' -                    ] -                ) -            ) +            pass          else:              if randint(1,2) == 1:                  res = randint(1,3) @@ -489,17 +440,7 @@ async def _(session: CommandSession):          pass      else:          if 0 <= now_time() < 5.5: -            await session.send( -                choice( -                    [ -                        'zzzz......', -                        'zzzzzzzz......', -                        'zzz...好涩哦..zzz....', -                        '别...不要..zzz..那..zzz..', -                        '嘻嘻..zzz..呐~..zzzz..' -                    ] -                ) -            ) +            pass          else:              if randint(1,2) == 1:                  res = randint(1,2) @@ -526,17 +467,7 @@ async def _(session: CommandSession):          pass      else:          if 0 <= now_time() < 5.5: -            await session.send( -                choice( -                    [ -                        'zzzz......', -                        'zzzzzzzz......', -                        'zzz...好涩哦..zzz....', -                        '别...不要..zzz..那..zzz..', -                        '嘻嘻..zzz..呐~..zzzz..' -                    ] -                ) -            ) +            pass          else:              if randint(1,3) == 1:                  await session.send( @@ -557,17 +488,7 @@ async def _(session: CommandSession):          pass      else:          if 0 <= now_time() < 5.5: -            await session.send( -                choice( -                    [ -                        'zzzz......', -                        'zzzzzzzz......', -                        'zzz...好涩哦..zzz....', -                        '别...不要..zzz..那..zzz..', -                        '嘻嘻..zzz..呐~..zzzz..' -                    ] -                ) -            ) +            pass          else:              if randint(1,2) == 1:                  img = choice( @@ -589,17 +510,7 @@ async def _(session: CommandSession):          pass      else:          if 0 <= now_time() < 5.5: -            await session.send( -                choice( -                    [ -                        'zzzz......', -                        'zzzzzzzz......', -                        'zzz...好涩哦..zzz....', -                        '别...不要..zzz..那..zzz..', -                        '嘻嘻..zzz..呐~..zzzz..' -                    ] -                ) -            ) +            pass          else:              if randint(1,2) == 1:                  img = Path('.') / 'ATRI' / 'data' / 'emoji' / 'H.jpg' @@ -616,17 +527,7 @@ async def _(session: CommandSession):          pass      else:          if 0 <= now_time() < 5.5: -            await session.send( -                choice( -                    [ -                        'zzzz......', -                        'zzzzzzzz......', -                        'zzz...好涩哦..zzz....', -                        '别...不要..zzz..那..zzz..', -                        '嘻嘻..zzz..呐~..zzzz..' -                    ] -                ) -            ) +            pass          else:              if randint(1,2) == 1:                  img = choice( @@ -648,17 +549,7 @@ async def _(session: CommandSession):          pass      else:          if 0 <= now_time() < 5.5: -            await session.send( -                choice( -                    [ -                        'zzzz......', -                        'zzzzzzzz......', -                        'zzz...好涩哦..zzz....', -                        '别...不要..zzz..那..zzz..', -                        '嘻嘻..zzz..呐~..zzzz..' -                    ] -                ) -            ) +            pass          else:              if randint(1,2) == 1:                  img = Path('.') / 'ATRI' / 'data' / 'emoji' / 'H.jpg' @@ -677,17 +568,7 @@ async def _(session: CommandSession):          pass      else:          if 0 <= now_time() < 5.5: -            await session.send( -                choice( -                    [ -                        'zzzz......', -                        'zzzzzzzz......', -                        'zzz...好涩哦..zzz....', -                        '别...不要..zzz..那..zzz..', -                        '嘻嘻..zzz..呐~..zzzz..' -                    ] -                ) -            ) +            pass          else:              msg = str(session.event.message)              bL = {} diff --git a/ATRI/plugins/hbook.py b/ATRI/plugins/hbook.py index d12eeb3..0a6d7b5 100644 --- a/ATRI/plugins/hbook.py +++ b/ATRI/plugins/hbook.py @@ -1,76 +1,98 @@ -# -*- coding:utf-8 -*-  import re  import time  import json +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 -    with open('ATRI/plugins/noobList/noobList.json', 'r') as f: -        data = json.load(f) - -    if str(user) in data.keys(): -        pass +    if 0 <= now_time() < 5.5: +        await session.send( +            choice( +                [ +                    'zzzz......', +                    'zzzzzzzz......', +                    'zzz...好涩哦..zzz....', +                    '别...不要..zzz..那..zzz..', +                    '嘻嘻..zzz..呐~..zzzz..' +                ] +            ) +        )      else: -        with open('ATRI/plugins/switch/switch.json', 'r') as f: +        with open('ATRI/plugins/noobList/noobList.json', 'r') as f:              data = json.load(f) -         -        if data["hbook"] == 0: -            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 +        if str(h_user) in data.keys(): +            pass +        else: +            with open('ATRI/plugins/switch/switch.json', 'r') as f: +                data = json.load(f) -            h_type = session.event.detail_type +            if data["hbook"] == 0: +                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) +                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('貌似请求数据失败了...') +                    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 '没有搜索到相关的内容' in res: +                    n_msg = '...似乎没有找到[{}]相关的本子呢'.format(tag) +                    await session.send(message=n_msg) -                if n > limit: # type: ignore -                    n = limit # type: ignore +                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 = 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 -                end = time.perf_counter() -                msg0 = f'\n——————————\n耗时: {round(end - start, 3)}s' -                msg += msg0 -                await session.send(message=msg) +                    await session.send(msg) -        else: -            await session.send('该功能已禁用...')
\ No newline at end of file +            else: +                await session.send('该功能已禁用...')
\ No newline at end of file diff --git a/ATRI/plugins/hitokoto.py b/ATRI/plugins/hitokoto.py index 725ddc7..e5fbe36 100644 --- a/ATRI/plugins/hitokoto.py +++ b/ATRI/plugins/hitokoto.py @@ -1,30 +1,53 @@ -# -*- coding:utf-8 -*-  import json +from datetime import datetime +from random import choice  from nonebot import on_command, on_natural_language, CommandSession  from nonebot import NLPSession, NLPResult +  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 + +  url = 'https://api.imjad.cn/hitokoto/?cat=a&charset=utf-8&length=50&encode=json&fun=sync&source='  @on_command('hitokoto', aliases = ['一言'], only_to_me = False)  async def hitokoto(session: CommandSession):      user = session.event.user_id -    with open('ATRI/plugins/noobList/noobList.json', 'r') as f: -        data = json.load(f) - -    if str(user) in data.keys(): -        pass +    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"]) +        with open('ATRI/plugins/noobList/noobList.json', 'r') as f: +            data = json.load(f) + +        if str(user) in data.keys(): +            pass +        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/noobList/banGroup.json b/ATRI/plugins/noobList/banGroup.json new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/ATRI/plugins/noobList/banGroup.json diff --git a/ATRI/plugins/other.py b/ATRI/plugins/other.py index 9b96ed2..dd34dda 100644 --- a/ATRI/plugins/other.py +++ b/ATRI/plugins/other.py @@ -1,8 +1,8 @@ -# -*- coding:utf-8 -*- -import time  import json  import random  import nonebot +from datetime import datetime +from random import choice  from nonebot import on_command, CommandSession  from nonebot.helpers import render_expression @@ -13,6 +13,14 @@ bot = nonebot.get_bot()  master = config.MASTER() +def now_time(): +    now_ = datetime.now() +    hour = now_.hour +    minute = now_.minute +    now = hour + minute / 60 +    return now + +  HELP_REPLY = (      'ええと...让我想想...',      '嗯...', @@ -21,87 +29,76 @@ HELP_REPLY = (  ) -MENU_REPO = ''' -====================== -ATRI 使用说明 -====================== -* 发送[]内的关键词以激活相关指令 -* 命令前带'@'表示需要atBOT -* 命令前带'FIX'表示暂时失效 -* 管理类使用方法会附在网页版的使用手册 - -======[基本功能]====== -[以图搜番] 字面意思 -[本子] 搜索本子 -[一言] 字面意思 -[P站搜图] 以Pid码搜索P站的图片 -[画师] 以画师ID搜索P站画师的作品 -[P站排行榜] 获取实时更新的P站排行榜 -[来份涩图] 获取一张涩图 -========[HELP]======== -[帮助] 获取网页版使用手册 -[菜单] 打开本页面 -[关于] 获取项目、作者信息 -[@ 来杯红茶] 向作者反馈 -=======[小功能]======= -[掷骰子] 1~6的随机数 -[抽签] 抽取今日运势 -'''.strip() - -MENU_AND = ''' -* 由于本项目以及本人一些个人原因,出现Bug请及时反馈 -* 本项目开源,可自行搭建,方法附在网页版使用手册中 -* 如有意愿fork本项目,提交修改,作者会非常感动 -* 运行示例、开发、维护需要成本,作者希望能被赞助 -* Star、提交Issus以及Fork并提交修改意见是本项目继续下去的动力 -* 运行时请适当使用,滥用可能会导致账号被封禁 -'''.strip() - -  @on_command('抽签', only_to_me = False)  async def _(session: CommandSession):      user = session.event.user_id -    with open('ATRI/plugins/noobList/noobList.json', 'r') as f: -        data = json.load(f) - -    if str(user) in data.keys(): -        pass -    else: +    if 0 <= now_time() < 5.5:          await session.send( -            str( -                random.choice( -                    [ -                        '大凶', -                        '大胸', -                        '小凶', -                        '小胸', -                        '凶', -                        '吉', -                        '中吉', -                        '大吉', -                        '特大吉', -                        '超特大吉' -                    ] -                ) +            choice( +                [ +                    'zzzz......', +                    'zzzzzzzz......', +                    'zzz...好涩哦..zzz....', +                    '别...不要..zzz..那..zzz..', +                    '嘻嘻..zzz..呐~..zzzz..' +                ]              )          ) +    else: +        with open('ATRI/plugins/noobList/noobList.json', 'r') as f: +            data = json.load(f) + +        if str(user) in data.keys(): +            pass +        else: +            await session.send( +                str( +                    random.choice( +                        [ +                            '大凶', +                            '大胸', +                            '小凶', +                            '小胸', +                            '凶', +                            '吉', +                            '中吉', +                            '大吉', +                            '特大吉', +                            '超特大吉' +                        ] +                    ) +                ) +            )  @on_command('掷骰子', aliases = ['扔骰子', '骰子'], only_to_me = False)  async def _(session: CommandSession):      user = session.event.user_id -    with open('ATRI/plugins/noobList/noobList.json', 'r') as f: -        data = json.load(f) - -    if str(user) in data.keys(): -        pass -    else: +    if 0 <= now_time() < 5.5:          await session.send( -            str( -                random.randint( -                    1,6 -                ) +            choice( +                [ +                    'zzzz......', +                    'zzzzzzzz......', +                    'zzz...好涩哦..zzz....', +                    '别...不要..zzz..那..zzz..', +                    '嘻嘻..zzz..呐~..zzzz..' +                ]              )          ) +    else: +        with open('ATRI/plugins/noobList/noobList.json', 'r') as f: +            data = json.load(f) + +        if str(user) in data.keys(): +            pass +        else: +            await session.send( +                str( +                    random.randint( +                        1,6 +                    ) +                ) +            )  @on_command('关于', aliases = ['关于机器人'], only_to_me = False)  async def _(session: CommandSession): @@ -131,23 +128,9 @@ async def _(session: CommandSession):      else:          await session.send(              f"""{render_expression(HELP_REPLY)} -    发送:菜单 -    或看这吧! -    https://blog.lolihub.icu/#/ATRI/user""" +请仔细阅读文档哦~~https://blog.lolihub.icu/#/ATRI/user"""          ) -@on_command('menu', aliases = ['菜单'], only_to_me = False) -async def _(session: CommandSession): -    user = session.event.user_id -    with open('ATRI/plugins/noobList/noobList.json', 'r') as f: -        data = json.load(f) - -    if str(user) in data.keys(): -        pass -    else: -        await session.send(MENU_REPO) -        time.sleep(0.5) -        await session.send(MENU_AND)  @on_command('report', aliases = ['来杯红茶'], only_to_me = True)  async def _(session: CommandSession): diff --git a/ATRI/plugins/pixiv.py b/ATRI/plugins/pixiv.py index be0cce0..c9aa694 100644 --- a/ATRI/plugins/pixiv.py +++ b/ATRI/plugins/pixiv.py @@ -1,8 +1,9 @@ -# -*- coding:utf-8 -*-  import time  import json -from nonebot import on_command, CommandSession +from datetime import datetime +from random import choice  import nonebot +from nonebot import on_command, CommandSession  from ATRI.modules import response # type: ignore @@ -29,165 +30,212 @@ Link: {user_link}  完成时间:{time}s""" +def now_time(): +    now_ = datetime.now() +    hour = now_.hour +    minute = now_.minute +    now = hour + minute / 60 +    return now + +  @on_command('pixiv_seach_img', aliases = ['p站搜图', 'P站搜图', '批站搜图'], only_to_me = False)  async def _(session: CommandSession):      user = session.event.user_id -    with open('ATRI/plugins/noobList/noobList.json', 'r') as f: -        data = json.load(f) - -    if str(user) in data.keys(): -        pass +    if 0 <= now_time() < 5.5: +        await session.send( +            choice( +                [ +                    'zzzz......', +                    'zzzzzzzz......', +                    'zzz...好涩哦..zzz....', +                    '别...不要..zzz..那..zzz..', +                    '嘻嘻..zzz..呐~..zzzz..' +                ] +            ) +        )      else: -        with open('ATRI/plugins/switch/switch.json', 'r') as f: +        with open('ATRI/plugins/noobList/noobList.json', 'r') as f:              data = json.load(f) -        if data["pixiv_seach_img"] == 0: -            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) -                ) -            ) -         +        if str(user) in data.keys(): +            pass          else: -            await session.send('该功能已被禁用...') +            with open('ATRI/plugins/switch/switch.json', 'r') as f: +                data = json.load(f) + +            if data["pixiv_seach_img"] == 0: +                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('该功能已被禁用...')  @on_command('pixiv_seach_author', aliases = ['画师', '搜索画师', '画师搜索'], only_to_me = False)  async def _(session: CommandSession):      user = session.event.user_id -    with open('ATRI/plugins/noobList/noobList.json', 'r') as f: -        data = json.load(f) - -    if str(user) in data.keys(): -        pass +    if 0 <= now_time() < 5.5: +        await session.send( +            choice( +                [ +                    'zzzz......', +                    'zzzzzzzz......', +                    'zzz...好涩哦..zzz....', +                    '别...不要..zzz..那..zzz..', +                    '嘻嘻..zzz..呐~..zzzz..' +                ] +            ) +        )      else: -        with open('ATRI/plugins/switch/switch.json', 'r') as f: +        with open('ATRI/plugins/noobList/noobList.json', 'r') as f:              data = json.load(f) -             -        if data["pixiv_seach_author"] == 0: -            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 str(user) in data.keys(): +            pass +        else: +            with open('ATRI/plugins/switch/switch.json', 'r') as f: +                data = json.load(f) +                 +            if data["pixiv_seach_author"] == 0: +                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 +                ) -            if not dc: -                session.finish('ATRI在网络上走散了...请重试...') +                t = 0 -            d ={} +                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 range(0,3): -                pid = dc["response"][i]["id"] -                pidURL = f'https://pixiv.cat/{pid}.jpg' -                d[i] = [f'{pid}',f'{pidURL}'] +                msg1 = (f'\n---------------\n完成时间:{round(end - start, 3)}s') +                msg0 += msg1 +                 +                await session.send(msg0) -            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('该功能已被禁用...') +            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 -    with open('ATRI/plugins/noobList/noobList.json', 'r') as f: -        data = json.load(f) - -    if str(user) in data.keys(): -        pass +    if 0 <= now_time() < 5.5: +        await session.send( +            choice( +                [ +                    'zzzz......', +                    'zzzzzzzz......', +                    'zzz...好涩哦..zzz....', +                    '别...不要..zzz..那..zzz..', +                    '嘻嘻..zzz..呐~..zzzz..' +                ] +            ) +        )      else: -        with open('ATRI/plugins/switch/switch.json', 'r') as f: +        with open('ATRI/plugins/noobList/noobList.json', 'r') as f:              data = json.load(f) -             -        if data["pixiv_daily_rank"] == 0: -            await session.send('ATRI正在获取P站每日排行榜前五作品...') +        if str(user) in data.keys(): +            pass +        else: +            with open('ATRI/plugins/switch/switch.json', 'r') as f: +                data = json.load(f) +                 +            if data["pixiv_daily_rank"] == 0: + +                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 new file mode 100644 index 0000000..434e98f --- /dev/null +++ b/ATRI/plugins/richBISS.py @@ -0,0 +1,147 @@ +import re +import json +import nonebot +from datetime import datetime + +from ATRI.modules import response # type: ignore + + +bot = nonebot.get_bot() + +def now_time(): +    now_ = datetime.now() +    hour = now_.hour +    minute = now_.minute +    now = hour + minute / 60 +    return now + + +BILI_REPORT_FORMAT = """[{aid}] Info: +Title: {title} +bid: {bid} +Viev: {view} Like: {like} +Coin: {coin} Share: {share} +Link: +{aid_link} +{bid_link}""" + +table='fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF' +tr={} +for i in range(58): +	tr[table[i]]=i +s=[11,10,3,8,4,6] +xor=177451812 +add=8728348608 + +def dec(x): +	r=0 +	for i in range(6): +		r+=tr[x[s[i]]]*58**i +	return (r-add)^xor + +def enc(x): +	x=(x^xor)+add +	r=list('BV1  4 1 7  ') +	for i in range(6): +		r[s[i]]=table[x//58**i%58] +	return ''.join(r) + + +@bot.on_message("group") +async def Fuck_bili_rich(context): +    msg = str(context["message"]) +    user = str(context["user_id"]) +    group = context["group_id"] +    pattern = re.compile(r"BV\S+\?") +    bv = re.findall(pattern, msg) +    with open('ATRI/plugins/noobList/noobList.json', 'r') as f: +        data = json.load(f) + +    if user in data.keys(): +        pass +    else: +        if 0 <= now_time() < 5.5: +            pass +        else: +            if bv: +                bv = bv[0] +                bv.replace('?', '') + +                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} +Song id: {id} +Br: {br} +Download: {url} +MD5: {md5}""" + +@bot.on_message("group") +async def Fuck_CloudMusic(context): +    msg = str(context["message"]) +    user = str(context["user_id"]) +    group = context["group_id"] +    m_type = context["sub_type"] +    pattern = re.compile(r"song\S+\/|id=\S+\&") +    music_id = re.findall(pattern, msg) +    print(music_id) + +    with open('ATRI/plugins/noobList/noobList.json', 'r') as f: +        data = json.load(f) + +    if user in data.keys(): +        pass +    else: +        if 0 <= now_time() < 5.5: +            pass +        else: +            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/send.py b/ATRI/plugins/send.py index f1b83af..2f95da2 100644 --- a/ATRI/plugins/send.py +++ b/ATRI/plugins/send.py @@ -1,4 +1,3 @@ -# -*- coding:utf-8 -*-  import time  import nonebot  from nonebot import on_command, CommandSession diff --git a/ATRI/plugins/setu.py b/ATRI/plugins/setu.py index fecba94..efd6147 100644 --- a/ATRI/plugins/setu.py +++ b/ATRI/plugins/setu.py @@ -1,13 +1,13 @@ -# -*- coding:utf-8 -*-  import os  import time  import json  import sqlite3  from random import choice, randint  from pathlib import Path +from datetime import datetime +from random import choice  import nonebot  from nonebot import on_command, CommandSession -from nonebot import session  import config # type: ignore  from ATRI.modules import response # type: ignore @@ -25,115 +25,136 @@ Pid: {pid}  ---------------  Complete time:{time}s""" + +def now_time(): +    now_ = datetime.now() +    hour = now_.hour +    minute = now_.minute +    now = hour + minute / 60 +    return now + +  setu_type = 1  @on_command('setu', patterns = (r"来[点丶张份副个幅][涩色瑟][图圖]|[涩色瑟][图圖]来|[涩色瑟][图圖][gkd|GKD|搞快点]|[gkd|GKD|搞快点][涩色瑟][图圖]|[图圖]来|[我你她他它]想要[点丶张份副][涩色瑟][图圖]|我想要[1一][张份幅副个只][涩色瑟][图圖]|[我你她他它]想[看|look][涩涩|色色]的东西"), only_to_me = False)  async def setu(session: CommandSession):      group = session.event.group_id      user = session.event.user_id      start = time.perf_counter() -    with open('ATRI/plugins/noobList/noobList.json', 'r') as f: -        data0 = json.load(f) -    with open(Path('.') / 'ATRI' / 'plugins' / 'switch' / 'switch.json', 'r') as f: -        data1 = json.load(f) - -    if str(user) in data0.keys(): -        pass +    if 0 <= now_time() < 5.5: +        await session.send( +            choice( +                [ +                    'zzzz......', +                    'zzzzzzzz......', +                    'zzz...好涩哦..zzz....', +                    '别...不要..zzz..那..zzz..', +                    '嘻嘻..zzz..呐~..zzzz..' +                ] +            ) +        )      else: -        if data1["setu"] == 0: -            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] +        with open('ATRI/plugins/noobList/noobList.json', 'r') as f: +            data0 = json.load(f) +        with open(Path('.') / 'ATRI' / 'plugins' / 'switch' / 'switch.json', 'r') as f: +            data1 = json.load(f) + +        if str(user) in data0.keys(): +            pass +        else: +            if data1["setu"] == 0: +                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() +                                    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, +                                "r18": "0", +                                "num": "1" +                            } + +                            try: +                                dc = json.loads(response.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 = img, +                                    setu = dc["data"][0]["url"],                                      time = round(end - start, 3)                                      )                                  ) -                        elif res == 4: -                            for i in msg: -                                pid = i[0] -                                title = i[1] -                                img = i[7] +                            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{img}\nComplete time: {round(end - start, 3)}" +                                    message = f"主人,从群{group}来的涩图!热乎着!\nTitle: {title}\nPid: {pid}\n{setu}\nComplete time: {round(end - start, 3)}"                                  ) - -                     -                    elif setu_type == 2: -                        res = randint(1,4) -                        await session.send('别急!正在找图!') -                        start = time.perf_counter() -                        values = { -                            "apikey": apikey, -                            "r18": "0", -                            "num": "1" -                        } - -                        try: -                            dc = json.loads(response.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: +                    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:                      img = choice(                          [ -                            'SP.jpg', 'SP1.jpg', 'SP2.jpg' +                            'GDZ.png', 'SHZY1.jpg', 'SHZY2.jpg', 'SHZY3.jpg', 'SHZY4.jpg', 'SHZY5.jpg', 'SHZY6.jpg'                          ]                      ) -                    img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}' +                    img = Path('.') / 'ATRI' / 'data' / 'img' / 'niceIMG' / f'{img}'                      img = os.path.abspath(img)                      await 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) diff --git a/ATRI/plugins/switch.py b/ATRI/plugins/switch.py index efc84f2..49a3ca7 100644 --- a/ATRI/plugins/switch.py +++ b/ATRI/plugins/switch.py @@ -1,4 +1,3 @@ -# -*- coding:utf-8 -*-  import json  import nonebot  from nonebot import on_command, CommandSession diff --git a/ATRI/plugins/welcome.py b/ATRI/plugins/welcome.py index 6e2a9d0..b0ac8ac 100644 --- a/ATRI/plugins/welcome.py +++ b/ATRI/plugins/welcome.py @@ -1,4 +1,3 @@ -# -*- coding:utf-8 -*-  import json  import nonebot  from pathlib import Path diff --git a/ATRI/plugins/wordcloud.py b/ATRI/plugins/wordcloud.py index cb63e04..90ed408 100644 --- a/ATRI/plugins/wordcloud.py +++ b/ATRI/plugins/wordcloud.py @@ -1,5 +1,6 @@  import json -from random import randint +from random import randint, choice +from datetime import datetime  import nonebot  from nonebot import on_command  from nonebot import CommandSession @@ -11,6 +12,14 @@ bot = nonebot.get_bot()  master = config.MASTER() +def now_time(): +    now_ = datetime.now() +    hour = now_.hour +    minute = now_.minute +    now = hour + minute / 60 +    return now + +  @on_command('add_word', aliases = ['增加词汇', '删除词汇'], only_to_me = False)  async def _(session: CommandSession):      if session.event.user_id == master: @@ -48,23 +57,26 @@ async def repo(context):      group = context["group_id"]      word = context["message"]      print(word) -    with open('ATRI/plugins/noobList/noobList.json', 'r') as f: -        nL = json.load(f) - -    if str(user) in nL.keys(): +    if 0 <= now_time() < 5.5:          pass      else: -        with open('ATRI/plugins/wordcloud/wordcloud.json', 'r') as f: -            data = json.load(f) +        with open('ATRI/plugins/noobList/noobList.json', 'r') as f: +            nL = json.load(f) + +        if str(user) in nL.keys(): +            pass +        else: +            with open('ATRI/plugins/wordcloud/wordcloud.json', 'r') as f: +                data = json.load(f) -        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}"] +                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 | 
