summaryrefslogtreecommitdiff
path: root/AyaBot/plugins/hitokoto.py
diff options
context:
space:
mode:
authorKyomotoi <[email protected]>2020-05-31 15:05:33 +0800
committerKyomotoi <[email protected]>2020-05-31 15:05:33 +0800
commit74d76543072a89fd7f4edbbde94eb665cc24275d (patch)
treeaacc77bcb2b5bc8d8a3027de089c3a8013787cde /AyaBot/plugins/hitokoto.py
parent3024a100de2eeb0ef9bd1049de12c2f696a2c4fd (diff)
downloadATRI-74d76543072a89fd7f4edbbde94eb665cc24275d.tar.gz
ATRI-74d76543072a89fd7f4edbbde94eb665cc24275d.tar.bz2
ATRI-74d76543072a89fd7f4edbbde94eb665cc24275d.zip
开新坑
Diffstat (limited to 'AyaBot/plugins/hitokoto.py')
-rw-r--r--AyaBot/plugins/hitokoto.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/AyaBot/plugins/hitokoto.py b/AyaBot/plugins/hitokoto.py
new file mode 100644
index 0000000..d621bb5
--- /dev/null
+++ b/AyaBot/plugins/hitokoto.py
@@ -0,0 +1,30 @@
+import json
+import requests
+import pandas as pd
+from nonebot import on_command, CommandSession
+from datetime import datetime
+
+
+url_1 = 'https://api.imjad.cn/hitokoto/?cat=a&charset=utf-8&length=50&encode=json&fun=sync&source='
+response_1 = requests.get(url=url_1).json()
+data_1 = json.load(response_1)
+
+filename1 = "data_1.json"
+
+LIST = """一言
+{hitokoto}
+by {source}
+"""
+
+@on_command('hitokoto', aliases=['一言'], only_to_me=False)
+async def _(session: CommandSession):
+ f = open(filename1, encoding='utf-8')
+ setting = json.load(f)
+ await session.send(LIST.format(
+ hitokoto=setting["hitokoto"],
+ source=setting["source"]
+ )
+ )
+
+
+#开发ing \ No newline at end of file