diff options
author | Kyomotoi <[email protected]> | 2020-06-14 00:03:44 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2020-06-14 00:03:44 +0800 |
commit | faf116c5afcb20966c7b2e26eef9d4538ab86c6f (patch) | |
tree | 0207038c0d66f74eb3291c6afb51a8d38e85cf1c /AyaBot | |
parent | e9e2d6b76b8e0f6fe3bf928835d934d01eb28eba (diff) | |
download | ATRI-faf116c5afcb20966c7b2e26eef9d4538ab86c6f.tar.gz ATRI-faf116c5afcb20966c7b2e26eef9d4538ab86c6f.tar.bz2 ATRI-faf116c5afcb20966c7b2e26eef9d4538ab86c6f.zip |
test
Diffstat (limited to 'AyaBot')
22 files changed, 118 insertions, 18 deletions
diff --git a/AyaBot/__pycache__/config.cpython-37.pyc b/AyaBot/__pycache__/config.cpython-37.pyc Binary files differindex a75a96b..732f3af 100644 --- a/AyaBot/__pycache__/config.cpython-37.pyc +++ b/AyaBot/__pycache__/config.cpython-37.pyc diff --git a/AyaBot/config.py b/AyaBot/config.py index ea756a8..a7e6456 100644 --- a/AyaBot/config.py +++ b/AyaBot/config.py @@ -6,7 +6,7 @@ HOST = '127.0.0.1' PORT = 8080 #ADMIN -SUPERUSERS = {} +SUPERUSERS = {1172294279} #机器人赋名,替代@ NICKNAME = {'喵内', 'rbq', 'Aya'} diff --git a/AyaBot/plugins/__pycache__/anime_search_in_photo.cpython-37.pyc b/AyaBot/plugins/__pycache__/anime_search_in_photo.cpython-37.pyc Binary files differindex 7018578..a606652 100644 --- a/AyaBot/plugins/__pycache__/anime_search_in_photo.cpython-37.pyc +++ b/AyaBot/plugins/__pycache__/anime_search_in_photo.cpython-37.pyc diff --git a/AyaBot/plugins/__pycache__/anime_search_photo.cpython-37.pyc b/AyaBot/plugins/__pycache__/anime_search_photo.cpython-37.pyc Binary files differnew file mode 100644 index 0000000..8eb81e7 --- /dev/null +++ b/AyaBot/plugins/__pycache__/anime_search_photo.cpython-37.pyc diff --git a/AyaBot/plugins/__pycache__/covid19.cpython-37.pyc b/AyaBot/plugins/__pycache__/covid19.cpython-37.pyc Binary files differindex be04c61..6dda69f 100644 --- a/AyaBot/plugins/__pycache__/covid19.cpython-37.pyc +++ b/AyaBot/plugins/__pycache__/covid19.cpython-37.pyc diff --git a/AyaBot/plugins/__pycache__/hbook.cpython-37.pyc b/AyaBot/plugins/__pycache__/hbook.cpython-37.pyc Binary files differindex 9d3982b..c634d3b 100644 --- a/AyaBot/plugins/__pycache__/hbook.cpython-37.pyc +++ b/AyaBot/plugins/__pycache__/hbook.cpython-37.pyc diff --git a/AyaBot/plugins/__pycache__/hitokoto.cpython-37.pyc b/AyaBot/plugins/__pycache__/hitokoto.cpython-37.pyc Binary files differindex 6bd50f8..cddfff3 100644 --- a/AyaBot/plugins/__pycache__/hitokoto.cpython-37.pyc +++ b/AyaBot/plugins/__pycache__/hitokoto.cpython-37.pyc diff --git a/AyaBot/plugins/__pycache__/other.cpython-37.pyc b/AyaBot/plugins/__pycache__/other.cpython-37.pyc Binary files differindex 0c6ddd0..1b4d258 100644 --- a/AyaBot/plugins/__pycache__/other.cpython-37.pyc +++ b/AyaBot/plugins/__pycache__/other.cpython-37.pyc diff --git a/AyaBot/plugins/__pycache__/pixiv_seach_photo.cpython-37.pyc b/AyaBot/plugins/__pycache__/pixiv_seach_photo.cpython-37.pyc Binary files differnew file mode 100644 index 0000000..d672578 --- /dev/null +++ b/AyaBot/plugins/__pycache__/pixiv_seach_photo.cpython-37.pyc diff --git a/AyaBot/plugins/__pycache__/setu.cpython-37.pyc b/AyaBot/plugins/__pycache__/setu.cpython-37.pyc Binary files differnew file mode 100644 index 0000000..19fb6b1 --- /dev/null +++ b/AyaBot/plugins/__pycache__/setu.cpython-37.pyc diff --git a/AyaBot/plugins/__pycache__/translate.cpython-37.pyc b/AyaBot/plugins/__pycache__/translate.cpython-37.pyc Binary files differindex 6346914..24b6b9a 100644 --- a/AyaBot/plugins/__pycache__/translate.cpython-37.pyc +++ b/AyaBot/plugins/__pycache__/translate.cpython-37.pyc diff --git a/AyaBot/plugins/__pycache__/weather.cpython-37.pyc b/AyaBot/plugins/__pycache__/weather.cpython-37.pyc Binary files differindex fab7f30..e9783d5 100644 --- a/AyaBot/plugins/__pycache__/weather.cpython-37.pyc +++ b/AyaBot/plugins/__pycache__/weather.cpython-37.pyc diff --git a/AyaBot/plugins/__pycache__/welcome.cpython-37.pyc b/AyaBot/plugins/__pycache__/welcome.cpython-37.pyc Binary files differnew file mode 100644 index 0000000..05e20cf --- /dev/null +++ b/AyaBot/plugins/__pycache__/welcome.cpython-37.pyc diff --git a/AyaBot/plugins/__pycache__/ytu.cpython-37.pyc b/AyaBot/plugins/__pycache__/ytu.cpython-37.pyc Binary files differnew file mode 100644 index 0000000..3bce10b --- /dev/null +++ b/AyaBot/plugins/__pycache__/ytu.cpython-37.pyc diff --git a/AyaBot/plugins/anime_search_in_photo.py b/AyaBot/plugins/anime_search_photo.py index ccafa1d..7462e9b 100644 --- a/AyaBot/plugins/anime_search_in_photo.py +++ b/AyaBot/plugins/anime_search_photo.py @@ -54,6 +54,7 @@ async def _(session: CommandSession): img = re.findall(p, msg) if img: URL = f'https://trace.moe/api/search?url={img[0]}' + print(URL) req = await get_bytes(URL) if req: data = json.loads(req.decode()) diff --git a/AyaBot/plugins/covid19.py b/AyaBot/plugins/covid19.py index 393d31b..d474ccd 100644 --- a/AyaBot/plugins/covid19.py +++ b/AyaBot/plugins/covid19.py @@ -2,7 +2,7 @@ import re import json import sys -sys.path.append(r'请改成你机器人的对应目录\Aya\AyaBot\plugins\Module') +sys.path.append('D:\\code\\Aya\\AyaBot\\plugins\\Module') import demjson import requests from pprint import pformat, pprint diff --git a/AyaBot/plugins/hbook.py b/AyaBot/plugins/hbook.py index 83d5002..29a3df5 100644 --- a/AyaBot/plugins/hbook.py +++ b/AyaBot/plugins/hbook.py @@ -13,7 +13,7 @@ async def post_bytes(url, headers=None,data=None): hbook_switch = True -@on_command('switch', aliases=['开启', '关闭'], only_to_me=False) +@on_command('hbook_switch', aliases=['开启', '关闭'], only_to_me=False) async def _(session: CommandSession): if session.ctx['user_id'] in session.bot.config.SUPERUSERS: command = session.ctx['raw_message'].split(' ', 1) diff --git a/AyaBot/plugins/other.py b/AyaBot/plugins/other.py index 0ff94cf..bec5167 100644 --- a/AyaBot/plugins/other.py +++ b/AyaBot/plugins/other.py @@ -12,19 +12,6 @@ master = bot.config.SUPERUSERS bangroup = [] #推送屏蔽群名单 - -@on_command('阿这', only_to_me=False) -async def _(session: CommandSession): - await session.send('阿这') - -@on_command('喵', aliases=['喵喵', '喵喵喵'], only_to_me=False) -async def _(session: CommandSession): - await session.send('喵~') - -@on_command('奶宝', aliases=['@๑ ^ ₃•๑', '奶够翘'], only_to_me=False) -async def _(session: CommandSession): - await session.send('别叫了别叫了,8在') - @on_command('抽签', only_to_me=False) async def _(session: CommandSession): await session.send(str(random.choice(['大凶', '小凶', '凶', '吉', '小吉', '中吉', '大吉']))) diff --git a/AyaBot/plugins/translate.py b/AyaBot/plugins/translate.py index 9f56dca..916c723 100644 --- a/AyaBot/plugins/translate.py +++ b/AyaBot/plugins/translate.py @@ -1,7 +1,7 @@ # -*- coding:utf-8 -*- import re import sys -sys.path.append(r'请改成你机器人的对应目录\Aya\AyaBot\plugins\Module') +sys.path.append('D:\\code\\Aya\\AyaBot\\plugins\\Module') import demjson import requests from pprint import pformat, pprint diff --git a/AyaBot/plugins/weather.py b/AyaBot/plugins/weather.py index 6e384b5..158cde2 100644 --- a/AyaBot/plugins/weather.py +++ b/AyaBot/plugins/weather.py @@ -2,7 +2,7 @@ import os import re import sys -sys.path.append(r'请改成你机器人的对应目录\Aya\AyaBot\plugins\Module') +sys.path.append('D:\\code\\Aya\\AyaBot\\plugins\\Module') import json import requests from nonebot import on_command, CommandSession diff --git a/AyaBot/plugins/welcome.py b/AyaBot/plugins/welcome.py new file mode 100644 index 0000000..87754f6 --- /dev/null +++ b/AyaBot/plugins/welcome.py @@ -0,0 +1,56 @@ +import nonebot +from nonebot import on_notice, NoticeSession, on_request, RequestSession, on_command, CommandSession +from aiocqhttp.exceptions import ActionFailed + +bot=nonebot.get_bot() +request_flag=False +master = bot.config.SUPERUSERS + +#FROM Joenothing-lst + +@on_notice('group_increase') +async def increase(session: NoticeSession): + q = session.ctx['user_id'] + me = session.ctx['self_id'] + if q==me: + await session.send('在下綾,今后请多指教呐') + else: + await session.send(f'?好欸,是新人! [CQ:at,qq={q}]') + +@on_notice('group_decrease') +async def decrease(session: NoticeSession): + q = str(session.ctx['user_id']) + m = str(session.ctx['operator_id']) + if m==q: + inf=await bot.get_stranger_info(user_id=q) + name=inf['nickname'] + await session.send(f'{name}({q}) 跑了...') + +@on_request('group') +async def bot_request(session: RequestSession): + global request_flag + f_group= session.ctx['group_id'] + f_user= session.ctx['user_id'] + if session.ctx['sub_type']=='invite': + if request_flag == False: + await session.bot.send_private_msg(user_id=f_user,message=f'想邀请綾入群嘛?请先点击这里联系作者:\nhttps://lolihub.icu/#/about') + await session.bot.send_private_msg(user_id=master,message=f'有新的群邀请:\n群:{f_group}\n邀请人:{f_user}\n已忽略') + else : + try: + await session.approve() + except ActionFailed as e: + print(e.retcode) + await session.bot.send_private_msg(user_id=master,message=f'有新的群邀请:\n群:{f_group}\n邀请人:{f_user}\n已同意') + request_flag=False + +@on_notice('friend_add') +async def friend_add(session: NoticeSession): + f_user=session.ctx['user_id'] + await bot.send_private_msg(user_id=master,message=f'有人加我啦!\n{f_user}') + +@on_command('set_request', aliases=('开启邀请',), only_to_me=True) +async def set_request(session: CommandSession): + global request_flag + if session.ctx['user_id']==master: + request_flag=True + await session.bot.send_private_msg(user_id=master,message='已开启')
\ No newline at end of file diff --git a/AyaBot/plugins/ytu.py b/AyaBot/plugins/ytu.py new file mode 100644 index 0000000..3d396b0 --- /dev/null +++ b/AyaBot/plugins/ytu.py @@ -0,0 +1,56 @@ +import json +import random +import nonebot +import requests +from nonebot import on_command, CommandSession + +a = '1' +b = '2' +c = '3' + +hphoto_switch = True +@on_command('hphoto_switch', aliases=['开启一图', '关闭一图'], only_to_me=False) +async def _(session: CommandSession): + if session.ctx['user_id'] in session.bot.config.SUPERUSERS: + command = session.ctx['raw_message'].split(' ', 1) + switch = command[0] + global hphoto_switch + if switch == '开启涩图': + hphoto_switch = True + if switch == '关闭涩图': + hphoto_switch = False + await session.send('完成') + else: + await session.send('恁哪位?') + + +@on_command('hphoto', aliases=['一图'], only_to_me=False) +async def _(session: CommandSession): + if hphoto_switch: + r = random.choice([a, b, c]) + print(r) + if r == '1': + URL = 'https://konachan.com/post.json' + response = requests.request("GET", URL) + html = response.text + hp = json.loads(html) + re = random.randint(0,20) + pt = hp[re]["jpeg_url"] + await session.send(f'[CQ:image,file={pt}]') + if r == '2': + URL = 'https://danbooru.donmai.us/posts.json' + response = requests.request("GET", URL) + html = response.text + hp = json.loads(html) + re = random.randint(0,19) + pt = hp[re]["file_url"] + await session.send(f'[CQ:image,file={pt}]') + if r == '3': + URL = 'https://yande.re/post.json' + response = requests.request("GET", URL) + html = response.text + hp = json.loads(html) + re = random.randint(0,39) + pt = hp[re]["jpeg_url"] + await session.send(f'[CQ:image,file={pt}]') + |