summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyomotoi <[email protected]>2020-06-21 00:29:51 +0800
committerKyomotoi <[email protected]>2020-06-21 00:29:51 +0800
commit7d129eb9e9cca5d0a06f7e699b425306fb8ce2f6 (patch)
tree37042c9792336747942c304e7a07a49f97dbe1a0
parentcc9ce1bfcd695c74fd3d2dbdc39bd147d444e6b7 (diff)
downloadATRI-7d129eb9e9cca5d0a06f7e699b425306fb8ce2f6.tar.gz
ATRI-7d129eb9e9cca5d0a06f7e699b425306fb8ce2f6.tar.bz2
ATRI-7d129eb9e9cca5d0a06f7e699b425306fb8ce2f6.zip
(FIX)
-rw-r--r--AyaBot/__pycache__/config.cpython-37.pycbin317 -> 317 bytes
-rw-r--r--AyaBot/config.py7
-rw-r--r--AyaBot/plugins/__pycache__/covid19.cpython-37.pycbin2265 -> 2252 bytes
-rw-r--r--AyaBot/plugins/__pycache__/pixiv.cpython-37.pycbin0 -> 1473 bytes
-rw-r--r--AyaBot/plugins/__pycache__/setu.cpython-37.pycbin1300 -> 3586 bytes
-rw-r--r--AyaBot/plugins/__pycache__/translate.cpython-37.pycbin1769 -> 1756 bytes
-rw-r--r--AyaBot/plugins/__pycache__/weather.cpython-37.pycbin6230 -> 6213 bytes
-rw-r--r--AyaBot/plugins/__pycache__/welcome.cpython-37.pycbin2253 -> 2253 bytes
-rw-r--r--AyaBot/plugins/covid19.py8
-rw-r--r--AyaBot/plugins/hbook.py69
-rw-r--r--AyaBot/plugins/other.py12
-rw-r--r--AyaBot/plugins/pixiv.py37
-rw-r--r--AyaBot/plugins/setu.py133
-rw-r--r--AyaBot/plugins/translate.py10
-rw-r--r--AyaBot/plugins/weather.py10
-rw-r--r--AyaBot/plugins/welcome.py2
-rw-r--r--AyaBot/plugins/ytu.py56
-rw-r--r--run.py1
18 files changed, 207 insertions, 138 deletions
diff --git a/AyaBot/__pycache__/config.cpython-37.pyc b/AyaBot/__pycache__/config.cpython-37.pyc
index 732f3af..29f571a 100644
--- a/AyaBot/__pycache__/config.cpython-37.pyc
+++ b/AyaBot/__pycache__/config.cpython-37.pyc
Binary files differ
diff --git a/AyaBot/config.py b/AyaBot/config.py
index a7e6456..a51b6e7 100644
--- a/AyaBot/config.py
+++ b/AyaBot/config.py
@@ -5,11 +5,14 @@ from nonebot.default_config import *
HOST = '127.0.0.1'
PORT = 8080
-#ADMIN
+#咱的主人(QQ号)
SUPERUSERS = {1172294279}
#机器人赋名,替代@
NICKNAME = {'喵内', 'rbq', 'Aya'}
#自定义命令开头
-COMMAND_START = {'', '/', '!', '/', '!'} \ No newline at end of file
+COMMAND_START = {'', '/', '!', '/', '!'}
+
+#推送屏蔽群名单
+bangroup = [] \ No newline at end of file
diff --git a/AyaBot/plugins/__pycache__/covid19.cpython-37.pyc b/AyaBot/plugins/__pycache__/covid19.cpython-37.pyc
index 6dda69f..7524c7d 100644
--- a/AyaBot/plugins/__pycache__/covid19.cpython-37.pyc
+++ b/AyaBot/plugins/__pycache__/covid19.cpython-37.pyc
Binary files differ
diff --git a/AyaBot/plugins/__pycache__/pixiv.cpython-37.pyc b/AyaBot/plugins/__pycache__/pixiv.cpython-37.pyc
new file mode 100644
index 0000000..72467ee
--- /dev/null
+++ b/AyaBot/plugins/__pycache__/pixiv.cpython-37.pyc
Binary files differ
diff --git a/AyaBot/plugins/__pycache__/setu.cpython-37.pyc b/AyaBot/plugins/__pycache__/setu.cpython-37.pyc
index 19fb6b1..66e8215 100644
--- a/AyaBot/plugins/__pycache__/setu.cpython-37.pyc
+++ b/AyaBot/plugins/__pycache__/setu.cpython-37.pyc
Binary files differ
diff --git a/AyaBot/plugins/__pycache__/translate.cpython-37.pyc b/AyaBot/plugins/__pycache__/translate.cpython-37.pyc
index 24b6b9a..42462a8 100644
--- a/AyaBot/plugins/__pycache__/translate.cpython-37.pyc
+++ b/AyaBot/plugins/__pycache__/translate.cpython-37.pyc
Binary files differ
diff --git a/AyaBot/plugins/__pycache__/weather.cpython-37.pyc b/AyaBot/plugins/__pycache__/weather.cpython-37.pyc
index e9783d5..02ebb2f 100644
--- a/AyaBot/plugins/__pycache__/weather.cpython-37.pyc
+++ b/AyaBot/plugins/__pycache__/weather.cpython-37.pyc
Binary files differ
diff --git a/AyaBot/plugins/__pycache__/welcome.cpython-37.pyc b/AyaBot/plugins/__pycache__/welcome.cpython-37.pyc
index 05e20cf..c86739f 100644
--- a/AyaBot/plugins/__pycache__/welcome.cpython-37.pyc
+++ b/AyaBot/plugins/__pycache__/welcome.cpython-37.pyc
Binary files differ
diff --git a/AyaBot/plugins/covid19.py b/AyaBot/plugins/covid19.py
index d474ccd..9917396 100644
--- a/AyaBot/plugins/covid19.py
+++ b/AyaBot/plugins/covid19.py
@@ -1,14 +1,18 @@
# -*- coding:utf-8 -*-
import re
import json
+<<<<<<< HEAD
+=======
import sys
-sys.path.append('D:\\code\\Aya\\AyaBot\\plugins\\Module')
+sys.path.append(r'请改成你机器人的对应目录\Aya\AyaBot\plugins\Module')
+>>>>>>> af9b3ef683d28a2e4dd3bbc23cc1b2c455fc4fe2
import demjson
import requests
+from os import path
from pprint import pformat, pprint
from urllib.parse import urlencode
from nonebot import on_command, CommandSession
-import google_translate
+from AyaBot.plugins.module import google_translate
# 国外版 数据更新非常及时
diff --git a/AyaBot/plugins/hbook.py b/AyaBot/plugins/hbook.py
deleted file mode 100644
index 29a3df5..0000000
--- a/AyaBot/plugins/hbook.py
+++ /dev/null
@@ -1,69 +0,0 @@
-# -*- coding:utf-8 -*-
-import re
-import nonebot
-from aiohttp import ClientSession
-from nonebot import on_command, CommandSession
-
-
-async def post_bytes(url, headers=None,data=None):
- async with ClientSession() as asyncsession:
- async with asyncsession.post(url,headers=headers,data=data) as response:
- b = await response.read()
- return b
-
-
-hbook_switch = True
-@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)
- swtich = command[0]
- plugins = command[1]
- global hbook_switch
- if swtich == '开启':
- if plugins == '本子':
- hbook_switch = True
- else:
- await session.send('检查一下是否输错了呢')
- else:
- if plugins == '本子':
- hbook_switch = False
- else:
- await session.send('检查一下是否输错了呢')
- await session.send('完成')
- else:
- await session.send('恁哪位?')
-
-
-@on_command('hbook', aliases=['本子', '找本子', '本子查询'], only_to_me=False)
-async def _(session: CommandSession):
- if hbook_switch:
- h_msg = session.current_arg.strip()
- if not h_msg:
- h_msg = session.get('message', prompt='要冲了吗?速发关键词')
- h_type = session.ctx['message_type']
- h_qq = session.ctx['user_id']
- 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':h_msg}
- responce = await post_bytes('https://b-upp.com/search/', headers=header, data=keyword)
- responce = responce.decode()
- if '没有搜索到相关的内容' in responce:
- n_msg = '...似乎没有找到[{}]相关的本子呢'.format(h_msg)
- await session.send(message=n_msg)
- else:
- p = '<a href="(.*?)" target="_blank" title="(.*?)">'
- data = re.findall(p,responce)
- n = len(data)
- if h_type == 'group':
- limit = 3
- elif h_type == 'private':
- limit = 10
- if n > limit:
- n = limit
- msg = f'根据提供信息,已查询到{n}本关键词为[{h_msg}]的本子:'
- if h_type == 'group':
- msg = f'[CQ:at,qq={h_qq}]\n根据提供信息,已查询到{n}本关键词为[{h_msg}]的本子:'
- for i in range(n):
- msg0 = ('\n——————————\n本子链接:https://b-upp.com%s \n本子标题:%s '%(data[i]))
- msg += msg0
- await session.send(message=msg) \ No newline at end of file
diff --git a/AyaBot/plugins/other.py b/AyaBot/plugins/other.py
index bec5167..ec489ff 100644
--- a/AyaBot/plugins/other.py
+++ b/AyaBot/plugins/other.py
@@ -9,7 +9,7 @@ from nonebot import on_natural_language, NLPSession, IntentCommand
bot = nonebot.get_bot()
master = bot.config.SUPERUSERS
-bangroup = [] #推送屏蔽群名单
+bangroup = bot.config.bangroup
@on_command('抽签', only_to_me=False)
@@ -20,6 +20,14 @@ async def _(session: CommandSession):
async def _(session: CommandSession):
await session.send(str(random.randint(1,6)))
+@on_command('关于', aliases=['关于', '关于机器人'], only_to_me=False)
+async def _(session: CommandSession):
+ await session.send('阿?想了解咱?\n写出咱的是Kyomotoi~\n他的主页:https://lolihub.icu\n项目地址:https://github.com/Kyomotoi/Aya')
+
+@on_command('帮助', aliases=['帮助', '食用方法'], only_to_me=False)
+async def _(session: CommandSession):
+ await session.send('嗯...不会用咱的话,看这吧!https://lolihub.icu/#/robot/user')
+
@on_command('seach_this_group_p', aliases=['本群总人数', '总人数', '群人数'], only_to_me=False, permission=perm.GROUP)
async def _(session: CommandSession):
try:
@@ -42,7 +50,7 @@ async def send_all_group(session: CommandSession):
for group in group_list:
if group['group_id'] not in bangroup:
try:
- await bot.send_group_msg( group_id=group['group_id'], message='ADMIN推送:\n' + msg)
+ await bot.send_group_msg( group_id=group['group_id'], message=msg)
except:
pass
await session.send('推送完成') \ No newline at end of file
diff --git a/AyaBot/plugins/pixiv.py b/AyaBot/plugins/pixiv.py
new file mode 100644
index 0000000..930c152
--- /dev/null
+++ b/AyaBot/plugins/pixiv.py
@@ -0,0 +1,37 @@
+import json
+import nonebot
+import requests
+from nonebot import on_command, CommandSession
+
+
+@on_command('pixivsearch', aliases=['p站搜索'], only_to_me=False)
+async def pixivsearch(session: CommandSession):
+ gets = session.get('gets', pormpt='请输入需要查询的pid码')
+ try:
+ URL = 'https://api.imjad.cn/pixiv/v1/?type=illust&id=' + gets
+ print(URL)
+ response = requests.request("GET", URL)
+ html = response.text
+ sr = json.loads(html)
+ i = sr["response"][0]["id"]
+ title = sr["response"][0]["title"]
+ width = sr["response"][0]["width"]
+ height = sr["response"][0]["height"]
+ userid = sr["response"][0]["user"]["id"]
+ account = sr["response"][0]["user"]["account"]
+ name = sr["response"][0]["user"]["name"]
+ await session.send(f'搜索结果如下:\nPid:{i}\nTitle:{title}\n宽高:{width},{height}\nTags:{tags}\n作者id:{userid}\n账号名称:{account}\n名称:{name}')
+ except:
+ await session.send('连接似乎失败了呢...请稍后尝试')
+
+async def _(session: CommandSession):
+ stripped_arg = session.current_arg_text.strip()
+ if session.is_first_run:
+ if stripped_arg:
+ session.state['gets'] = stripped_arg
+ return
+
+ if not stripped_arg:
+ session.pause('请输入需要查询的pid码')
+ session.state[session.current_key] = stripped_arg \ No newline at end of file
diff --git a/AyaBot/plugins/setu.py b/AyaBot/plugins/setu.py
new file mode 100644
index 0000000..f0d5365
--- /dev/null
+++ b/AyaBot/plugins/setu.py
@@ -0,0 +1,133 @@
+import re
+import json
+import random
+import urllib
+import nonebot
+import requests
+from aiohttp import ClientSession
+from nonebot import on_command, CommandSession
+
+
+async def post_bytes(url, headers=None,data=None):
+ async with ClientSession() as asyncsession:
+ async with asyncsession.post(url,headers=headers,data=data) as response:
+ b = await response.read()
+ return b
+
+
+a = '1'
+b = '2'
+c = '3'
+
+hphoto_switch = True
+hbook_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]
+ com = command[1]
+ global hphoto_switch
+ if switch == '开启':
+ if com == '涩图':
+ hphoto_switch = True
+ elif com == '本子':
+ hbook_switch = True
+ else:
+ pass
+ elif switch == '关闭':
+ if com == '涩图':
+ hphoto_switch = False
+ elif com == '本子':
+ hbook_switch = False
+ else:
+ pass
+ 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])
+ 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://api.lolicon.app/setu/'
+ values = {
+ "apikey": "574300555ee56eb2be5e03",
+ "r18": "0",
+ "num": "1"
+ }
+ response = requests.get(url, params=values)
+ html = response.text
+ se = json.loads(html)
+ # print(se)
+ title=se["data"][0]["title"]
+ pid=se["data"][0]["pid"]
+ setu=se["data"][0]["url"]
+ await session.send(f'Title: {title}\nPid: {pid}\n[CQ:image,file={setu}]')
+ # if r == '2':
+ # URL = 'https://danbooru.donmai.us/post.json'
+ # values = {
+ # "api_key": "UoTNRNeta73tqqdGVvsU9mmH"
+ # }
+ # response = requests.get(URL, params=values)
+ # 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'
+ # values = {
+ # "api_key": "zgBbal8sZVuRYp3UNX5Frg"
+ # }
+ # response = requests.get(URL, params=values)
+ # 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}]')
+
+
+@on_command('hbook', aliases=['本子', '找本子', '本子查询'], only_to_me=False)
+async def _(session: CommandSession):
+ if hbook_switch:
+ h_msg = session.current_arg.strip()
+ if not h_msg:
+ h_msg = session.get('message', prompt='要冲了吗?速发关键词')
+ h_type = session.ctx['message_type']
+ h_qq = session.ctx['user_id']
+ 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':h_msg}
+ responce = await post_bytes('https://b-upp.com/search/', headers=header, data=keyword)
+ responce = responce.decode()
+ if '没有搜索到相关的内容' in responce:
+ n_msg = '...似乎没有找到[{}]相关的本子呢'.format(h_msg)
+ await session.send(message=n_msg)
+ else:
+ p = '<a href="(.*?)" target="_blank" title="(.*?)">'
+ data = re.findall(p,responce)
+ n = len(data)
+ if h_type == 'group':
+ limit = 3
+ elif h_type == 'private':
+ limit = 10
+ if n > limit:
+ n = limit
+ msg = f'根据提供信息,已查询到{n}本关键词为[{h_msg}]的本子:'
+ if h_type == 'group':
+ msg = f'[CQ:at,qq={h_qq}]\n根据提供信息,已查询到{n}本关键词为[{h_msg}]的本子:'
+ for i in range(n):
+ msg0 = ('\n——————————\n本子链接:https://b-upp.com%s \n本子标题:%s '%(data[i]))
+ msg += msg0
+ await session.send(message=msg) \ No newline at end of file
diff --git a/AyaBot/plugins/translate.py b/AyaBot/plugins/translate.py
index 916c723..3cb396b 100644
--- a/AyaBot/plugins/translate.py
+++ b/AyaBot/plugins/translate.py
@@ -1,13 +1,17 @@
# -*- coding:utf-8 -*-
import re
+<<<<<<< HEAD
+=======
import sys
-sys.path.append('D:\\code\\Aya\\AyaBot\\plugins\\Module')
+sys.path.append(r'请改成你机器人的对应目录\Aya\AyaBot\plugins\Module')
+>>>>>>> af9b3ef683d28a2e4dd3bbc23cc1b2c455fc4fe2
import demjson
import requests
+from os import path
from pprint import pformat, pprint
from urllib.parse import urlencode
from nonebot import on_command, CommandSession
-import google_translate
+from AyaBot.plugins.module import google_translate
#FROM Joenothing-lst
@@ -42,4 +46,4 @@ async def _(session: CommandSession):
msg=session.ctx['raw_message'][5:]
re_msg = google_translate.translate(msg[:4999], to='en', source='zh-CN')
if re_msg[0]!='':
- await session.send(re_msg[0]) \ No newline at end of file
+ await session.send(re_msg[0])
diff --git a/AyaBot/plugins/weather.py b/AyaBot/plugins/weather.py
index 158cde2..414b55c 100644
--- a/AyaBot/plugins/weather.py
+++ b/AyaBot/plugins/weather.py
@@ -1,12 +1,16 @@
# -*- coding:utf-8 -*-
import os
import re
+<<<<<<< HEAD
+=======
import sys
-sys.path.append('D:\\code\\Aya\\AyaBot\\plugins\\Module')
+sys.path.append(r'请改成你机器人的对应目录\Aya\AyaBot\plugins\Module')
+>>>>>>> af9b3ef683d28a2e4dd3bbc23cc1b2c455fc4fe2
import json
import requests
+from os import path
from nonebot import on_command, CommandSession
-import google_translate
+from AyaBot.plugins.module import google_translate
API_URL = 'https://api.weatherbit.io/v2.0/current?city='
API_URL_2 = '&key=1df2eb2951f3470a94cb323bb4647c18'
@@ -216,4 +220,4 @@ async def _(session: CommandSession):
if not stripped_arg:
session.pause('要查询的城市不能为空,请重新输入')
- session.state[session.current_key] = stripped_arg \ No newline at end of file
+ session.state[session.current_key] = stripped_arg
diff --git a/AyaBot/plugins/welcome.py b/AyaBot/plugins/welcome.py
index 8affdd8..3fcc1a9 100644
--- a/AyaBot/plugins/welcome.py
+++ b/AyaBot/plugins/welcome.py
@@ -4,7 +4,7 @@ from aiocqhttp.exceptions import ActionFailed
bot=nonebot.get_bot()
request_flag=False
-master = bot.config.SUPERUSERS[0]
+master = bot.config.SUPERUSERS
#FROM Joenothing-lst
diff --git a/AyaBot/plugins/ytu.py b/AyaBot/plugins/ytu.py
deleted file mode 100644
index 3d396b0..0000000
--- a/AyaBot/plugins/ytu.py
+++ /dev/null
@@ -1,56 +0,0 @@
-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}]')
-
diff --git a/run.py b/run.py
index e7eefb2..41be08f 100644
--- a/run.py
+++ b/run.py
@@ -1,6 +1,7 @@
# -*- coding:utf-8 -*-
import nonebot
from AyaBot import config
+from AyaBot.plugins import module
from os import path