From 5487ad601dea57c34d8721e4373db57df2fe6f17 Mon Sep 17 00:00:00 2001
From: Kyomotoi <1172294279@qq.com>
Date: Wed, 29 Apr 2020 00:05:27 +0800
Subject: =?UTF-8?q?=E5=90=8C=E6=A0=B7=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=B8=80?=
=?UTF-8?q?=E4=BA=9B=E7=90=90=E7=A2=8E=E5=B0=8F=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/Aya.iml | 11 --
.idea/misc.xml | 7 -
.idea/modules.xml | 8 -
.idea/vcs.xml | 6 -
.idea/workspace.xml | 219 ---------------------
AyaBot/__pycache__/config.cpython-37.pyc | Bin 317 -> 317 bytes
AyaBot/config.py | 14 ++
AyaBot/date.py | 24 +++
AyaBot/plugins/__pycache__/awsl.cpython-37.pyc | Bin 1029 -> 2482 bytes
AyaBot/plugins/__pycache__/bilibili.cpython-37.pyc | Bin 0 -> 1114 bytes
AyaBot/plugins/awsl.py | 48 ++++-
AyaBot/plugins/bilibili.py | 33 ++++
AyaBot/plugins/bilibili/__init__.py | 0
.../bilibili/__pycache__/__init__.cpython-37.pyc | Bin 134 -> 0 bytes
AyaBot/plugins/bilibili/index.py | 3 -
config.py | 14 --
date.py | 8 -
run.py | 3 +-
18 files changed, 119 insertions(+), 279 deletions(-)
delete mode 100644 .idea/Aya.iml
delete mode 100644 .idea/misc.xml
delete mode 100644 .idea/modules.xml
delete mode 100644 .idea/vcs.xml
delete mode 100644 .idea/workspace.xml
create mode 100644 AyaBot/config.py
create mode 100644 AyaBot/date.py
create mode 100644 AyaBot/plugins/__pycache__/bilibili.cpython-37.pyc
create mode 100644 AyaBot/plugins/bilibili.py
delete mode 100644 AyaBot/plugins/bilibili/__init__.py
delete mode 100644 AyaBot/plugins/bilibili/__pycache__/__init__.cpython-37.pyc
delete mode 100644 AyaBot/plugins/bilibili/index.py
delete mode 100644 config.py
delete mode 100644 date.py
diff --git a/.idea/Aya.iml b/.idea/Aya.iml
deleted file mode 100644
index 6711606..0000000
--- a/.idea/Aya.iml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 8656114..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index eca873e..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 94a25f7..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
deleted file mode 100644
index f7341f9..0000000
--- a/.idea/workspace.xml
+++ /dev/null
@@ -1,219 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1588051377355
-
-
- 1588051377355
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/AyaBot/__pycache__/config.cpython-37.pyc b/AyaBot/__pycache__/config.cpython-37.pyc
index 3390b6b..6a2d45b 100644
Binary files a/AyaBot/__pycache__/config.cpython-37.pyc and b/AyaBot/__pycache__/config.cpython-37.pyc differ
diff --git a/AyaBot/config.py b/AyaBot/config.py
new file mode 100644
index 0000000..382a461
--- /dev/null
+++ b/AyaBot/config.py
@@ -0,0 +1,14 @@
+from nonebot.default_config import *
+
+#配置监听的 IP 和端口
+HOST = '127.0.0.1'
+PORT = 8080
+
+#设置超级用户
+SUPERUSERS = {1172294279}
+
+#机器人赋名,替代@
+NICKNAME = {'喵内', 'rbq', 'Aya'}
+
+#自定义命令开头
+COMMAND_START = {'', '/', '!', '/', '!'}
\ No newline at end of file
diff --git a/AyaBot/date.py b/AyaBot/date.py
new file mode 100644
index 0000000..1fbde00
--- /dev/null
+++ b/AyaBot/date.py
@@ -0,0 +1,24 @@
+import time
+import pytz
+from datetime import datetime
+
+
+def get_date():
+ tz = pytz.timezone('Asia/Shanghai')
+ t = datetime.fromtimestamp(int(time.time()),
+ pytz.timezone('Asia/Shanghai')).strftime('%Y-%m-%d')
+
+def get_year():
+ tz = pytz.timezone('Asia/Shanghai')
+ t = datetime.fromtimestamp(int(time.time()),
+ pytz.timezone('Asia/Shanghai')).strftime('%Y')
+
+def get_month():
+ tz = pytz.timezone('Asia/Shanghai')
+ t = datetime.fromtimestamp(int(time.time()),
+ pytz.timezone('Asia/Shanghai')).strftime('%m')
+
+def get_day():
+ tz = pytz.timezone('Asia/Shanghai')
+ t = datetime.fromtimestamp(int(time.time()),
+ pytz.timezone('Asia/Shanghai')).strftime('%d')
\ No newline at end of file
diff --git a/AyaBot/plugins/__pycache__/awsl.cpython-37.pyc b/AyaBot/plugins/__pycache__/awsl.cpython-37.pyc
index c06634f..6c47288 100644
Binary files a/AyaBot/plugins/__pycache__/awsl.cpython-37.pyc and b/AyaBot/plugins/__pycache__/awsl.cpython-37.pyc differ
diff --git a/AyaBot/plugins/__pycache__/bilibili.cpython-37.pyc b/AyaBot/plugins/__pycache__/bilibili.cpython-37.pyc
new file mode 100644
index 0000000..59bdbf0
Binary files /dev/null and b/AyaBot/plugins/__pycache__/bilibili.cpython-37.pyc differ
diff --git a/AyaBot/plugins/awsl.py b/AyaBot/plugins/awsl.py
index 2916d8c..d2f976a 100644
--- a/AyaBot/plugins/awsl.py
+++ b/AyaBot/plugins/awsl.py
@@ -1,5 +1,25 @@
+import os
import random
-from nonebot import on_command, CommandSession
+from nonebot import on_command, CommandSession, permission as perm, on_request
+from datetime import datetime
+from typing import Optional
+
+import pytz
+from pandas import Timestamp
+
+
+CST_TIMEZONE = 'Asia/Shanghai'
+
+
+def beijing_now(freq: Optional[str] = None) -> datetime:
+ now = datetime.now(pytz.timezone(CST_TIMEZONE))
+ if freq is not None:
+ now = Timestamp(now).round(freq)
+ return now
+
+
+def beijing_from_timestamp(timestamp: int) -> datetime:
+ return datetime.fromtimestamp(timestamp, pytz.timezone(CST_TIMEZONE))
@on_command('阿这', only_to_me=False)
@@ -16,4 +36,28 @@ async def _(session: CommandSession):
@on_command('抽签', only_to_me=False)
async def _(session: CommandSession):
- await session.send(str(random.choice(['大凶', '小凶', '凶', '吉', '小吉', '中吉', '大吉'])))
\ No newline at end of file
+ await session.send(str(random.choice(['大凶', '小凶', '凶', '吉', '小吉', '中吉', '大吉'])))
+
+@on_command('掷骰子', aliases=['投骰子'], only_to_me=False)
+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('?')
+
+@on_command('seach_this_group_p', aliases=['本群总人数', '总人数', '群人数'], only_to_me=False, permission=perm.GROUP)
+async def _(session: CommandSession):
+ try:
+ seach_group_member = await session.bot.get_group_member_list(
+ group_id=session.ctx['group_id']
+ )
+ except:
+ await session.send('获取数据时出问题,请重试')
+ return
+
+ await session.send(f'本群目前共有{len(seach_group_member)}人')
+
+
+
+
\ No newline at end of file
diff --git a/AyaBot/plugins/bilibili.py b/AyaBot/plugins/bilibili.py
new file mode 100644
index 0000000..fa4554b
--- /dev/null
+++ b/AyaBot/plugins/bilibili.py
@@ -0,0 +1,33 @@
+import requests
+import nonebot
+import re
+from nonebot import on_command, CommandSession, CQHttpError
+
+
+@on_command('fan', aliases=['搜番', '查番', '番剧搜索', '搜索番剧'], only_to_me=False)
+async def seach_fan(session: CommandSession):
+ year = session.get('year', prompt='你想查找哪一年的番呢?(示范:2020)')
+ month = session.get('month', prompt='你想查找哪个月的番呢(示范:4)?')
+ await session.send('查询的情况如下:')
+ await session.send('日期:' + year + month)
+ # await session.send('标题:' + title)
+ # await session.send('链接:' + link)
+
+
+@seach_fan.args_parser
+async def _(session: CommandSession):
+ # if session.is_first_run:
+ # return
+ if session.current_key == 'year':
+ if not re.fullmatch(r'\d{4}', session.current_arg_text):
+ session.pause('日期格式有误,请重新输入(示范:2020)')
+
+ if session.current_key == 'month':
+ if not re.fullmatch(r'\d{2}', session.current_arg_text):
+ session.pause('日期格式有误,请重新输入(示范:4)')
+
+
+ # try:
+ # except CQHttpError:
+ # await session.send('请求未响应或出错,请重试')
+
diff --git a/AyaBot/plugins/bilibili/__init__.py b/AyaBot/plugins/bilibili/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/AyaBot/plugins/bilibili/__pycache__/__init__.cpython-37.pyc b/AyaBot/plugins/bilibili/__pycache__/__init__.cpython-37.pyc
deleted file mode 100644
index a197886..0000000
Binary files a/AyaBot/plugins/bilibili/__pycache__/__init__.cpython-37.pyc and /dev/null differ
diff --git a/AyaBot/plugins/bilibili/index.py b/AyaBot/plugins/bilibili/index.py
deleted file mode 100644
index c887183..0000000
--- a/AyaBot/plugins/bilibili/index.py
+++ /dev/null
@@ -1,3 +0,0 @@
-import requests
-import nonebot
-import json
diff --git a/config.py b/config.py
deleted file mode 100644
index 4dd7d5f..0000000
--- a/config.py
+++ /dev/null
@@ -1,14 +0,0 @@
-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
diff --git a/date.py b/date.py
deleted file mode 100644
index 988fad1..0000000
--- a/date.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import time
-from datetime import datetime
-import pytz
-
-
-
-
-print(thisyear())
diff --git a/run.py b/run.py
index 1f85549..b44f258 100644
--- a/run.py
+++ b/run.py
@@ -1,5 +1,5 @@
import nonebot
-import config
+from AyaBot import config
from os import path
@@ -10,3 +10,4 @@ if __name__ == '__main__':
path.join(path.dirname(__file__), 'AyaBot', 'plugins'),
'AyaBot.plugins')
nonebot.run()
+
--
cgit v1.2.3