diff options
author | Kyomotoi <[email protected]> | 2020-04-28 00:30:40 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2020-04-28 00:30:40 +0800 |
commit | b33aba098aae9feafd77b56746b4ff5946c843cf (patch) | |
tree | 3bab5ebd949c0fc201711de3528555fc54bb5a52 | |
download | ATRI-b33aba098aae9feafd77b56746b4ff5946c843cf.tar.gz ATRI-b33aba098aae9feafd77b56746b4ff5946c843cf.tar.bz2 ATRI-b33aba098aae9feafd77b56746b4ff5946c843cf.zip |
Initial commit
-rw-r--r-- | .gitattributes | 2 | ||||
-rw-r--r-- | AyaBot/__pycache__/config.cpython-37.pyc | bin | 0 -> 317 bytes | |||
-rw-r--r-- | AyaBot/plugins/__pycache__/awsl.cpython-37.pyc | bin | 0 -> 735 bytes | |||
-rw-r--r-- | AyaBot/plugins/__pycache__/bilibilifan.cpython-37.pyc | bin | 0 -> 803 bytes | |||
-rw-r--r-- | AyaBot/plugins/__pycache__/weather.cpython-37.pyc | bin | 0 -> 955 bytes | |||
-rw-r--r-- | AyaBot/plugins/awsl.py | 14 | ||||
-rw-r--r-- | AyaBot/plugins/bilibilifan.py | 29 | ||||
-rw-r--r-- | AyaBot/plugins/weather.py | 22 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | __pycache__/config.cpython-37.pyc | bin | 0 -> 311 bytes | |||
-rw-r--r-- | config.py | 14 | ||||
-rw-r--r-- | run.py | 12 |
12 files changed, 95 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/AyaBot/__pycache__/config.cpython-37.pyc b/AyaBot/__pycache__/config.cpython-37.pyc Binary files differnew file mode 100644 index 0000000..3390b6b --- /dev/null +++ b/AyaBot/__pycache__/config.cpython-37.pyc diff --git a/AyaBot/plugins/__pycache__/awsl.cpython-37.pyc b/AyaBot/plugins/__pycache__/awsl.cpython-37.pyc Binary files differnew file mode 100644 index 0000000..46a8162 --- /dev/null +++ b/AyaBot/plugins/__pycache__/awsl.cpython-37.pyc diff --git a/AyaBot/plugins/__pycache__/bilibilifan.cpython-37.pyc b/AyaBot/plugins/__pycache__/bilibilifan.cpython-37.pyc Binary files differnew file mode 100644 index 0000000..a0b53ed --- /dev/null +++ b/AyaBot/plugins/__pycache__/bilibilifan.cpython-37.pyc diff --git a/AyaBot/plugins/__pycache__/weather.cpython-37.pyc b/AyaBot/plugins/__pycache__/weather.cpython-37.pyc Binary files differnew file mode 100644 index 0000000..db0c8e4 --- /dev/null +++ b/AyaBot/plugins/__pycache__/weather.cpython-37.pyc diff --git a/AyaBot/plugins/awsl.py b/AyaBot/plugins/awsl.py new file mode 100644 index 0000000..c476d59 --- /dev/null +++ b/AyaBot/plugins/awsl.py @@ -0,0 +1,14 @@ +from nonebot import on_command, CommandSession + + +@on_command('阿这') +async def _(session: CommandSession): + await session.send('阿这') + +@on_command('喵', aliases=['喵喵', '喵喵喵']) +async def _(session: CommandSession): + await session.send('喵~') + +@on_command('奶宝', aliases=['@๑ ^ ₃•๑', '奶够翘']) +async def _(session: CommandSession): + await session.send('别叫了别叫了,8在') diff --git a/AyaBot/plugins/bilibilifan.py b/AyaBot/plugins/bilibilifan.py new file mode 100644 index 0000000..91a0bd4 --- /dev/null +++ b/AyaBot/plugins/bilibilifan.py @@ -0,0 +1,29 @@ +import requests +import json +from nonebot import on_command, CommandSession + + +@on_command('番剧索引') +async def _(session: CommandSession): + # url = 'https://api.bilibili.com/pgc/season/index/result?season_version=-1&area=-1&is_finish=-1©right=-1&season_status=-1&season_month=-1&year=-1&style_id=-1&order=3&st=1&sort=0&page=1&season_type=1&pagesize=20&type=1' + + res = requests.get( + 'https://api.bilibili.com/pgc/season/index/result?season_version=-1&area=-1&is_finish=-1©right=-1&season_status=-1&season_month=-1&year=-1&style_id=-1&order=3&st=1&sort=0&page=1&season_type=1&pagesize=20&type=1', + headers={ + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36' + } + ) + + data = res.json() + print(['list']) + # JSON.data.list = data['JSON.data.list'] + # reply = '' + # for JSON.data.list in JSON.data.list: + # title = data.list['title'] + # url = data.list['link'] + # reply += f'\n{title}\n{url}' + # session.send('今日番剧索引如下: \n' + reply) + + # if not list: + # await session.send('暂时无法返回请求,或服务器变奇怪了...') + # return
\ No newline at end of file diff --git a/AyaBot/plugins/weather.py b/AyaBot/plugins/weather.py new file mode 100644 index 0000000..f02198d --- /dev/null +++ b/AyaBot/plugins/weather.py @@ -0,0 +1,22 @@ +import re +from nonebot import on_command, CommandSession + + +@on_command('weather', aliases=['天气', '查天气', '天气查询']) +async def weather(session: CommandSession): + city = session.get('city', prompt='你想查哪个城市呢?') + date = session.get('date', prompt='你想查哪一天呢?(格式:20200427)') + await session.send('你查询的情况如下' + city) + await session.send('你想查询的日期' + date) + + [email protected]_parser +async def _(session: CommandSession): + if session.is_first_run: + return + + if session.current_key == 'date': + if not re.fullmatch(r'\d{8}', session.current_arg_text): + session.pause('日期格式有误,请重新输入') + session.args[session.current_key] = session.current_arg_text + diff --git a/README.md b/README.md new file mode 100644 index 0000000..a4268ae --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# Aya + CoolQ Bot by Python diff --git a/__pycache__/config.cpython-37.pyc b/__pycache__/config.cpython-37.pyc Binary files differnew file mode 100644 index 0000000..535caa2 --- /dev/null +++ b/__pycache__/config.cpython-37.pyc diff --git a/config.py b/config.py new file mode 100644 index 0000000..4dd7d5f --- /dev/null +++ b/config.py @@ -0,0 +1,14 @@ +from nonebot.default_config import * + +#配置监听的 IP 和端口 +HOST = '127.0.0.1' +PORT = 8080 + +#设置超级用户 +SUPERUSERS = {2791352599} + +#机器人赋名,替代@ +NICKNAME = {'喵内', 'rbq', ''} + +#自定义命令开头 +COMMAND_START = {'', '/', '!', '/', '!'}
\ No newline at end of file @@ -0,0 +1,12 @@ +import nonebot +import config +from os import path + + +if __name__ == '__main__': + nonebot.init(config) + nonebot.load_builtin_plugins() + nonebot.load_plugins( + path.join(path.dirname(__file__), 'AyaBot', 'plugins'), + 'AyaBot.plugins') + nonebot.run() |