summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.idea/Aya.iml11
-rw-r--r--.idea/misc.xml7
-rw-r--r--.idea/modules.xml8
-rw-r--r--.idea/vcs.xml6
-rw-r--r--.idea/workspace.xml219
-rw-r--r--AyaBot/__pycache__/config.cpython-37.pycbin317 -> 317 bytes
-rw-r--r--AyaBot/config.py (renamed from config.py)4
-rw-r--r--AyaBot/date.py24
-rw-r--r--AyaBot/plugins/__pycache__/awsl.cpython-37.pycbin1029 -> 2482 bytes
-rw-r--r--AyaBot/plugins/__pycache__/bilibili.cpython-37.pycbin0 -> 1114 bytes
-rw-r--r--AyaBot/plugins/awsl.py48
-rw-r--r--AyaBot/plugins/bilibili.py33
-rw-r--r--AyaBot/plugins/bilibili/__init__.py0
-rw-r--r--AyaBot/plugins/bilibili/__pycache__/__init__.cpython-37.pycbin134 -> 0 bytes
-rw-r--r--AyaBot/plugins/bilibili/index.py3
-rw-r--r--date.py8
-rw-r--r--run.py3
17 files changed, 107 insertions, 267 deletions
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 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="PYTHON_MODULE" version="4">
- <component name="NewModuleRootManager">
- <content url="file://$MODULE_DIR$" />
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- </component>
- <component name="TestRunnerService">
- <option name="PROJECT_TEST_RUNNER" value="Unittests" />
- </component>
-</module> \ 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 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="JavaScriptSettings">
- <option name="languageLevel" value="ES6" />
- </component>
- <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7" project-jdk-type="Python SDK" />
-</project> \ 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 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="ProjectModuleManager">
- <modules>
- <module fileurl="file://$PROJECT_DIR$/.idea/Aya.iml" filepath="$PROJECT_DIR$/.idea/Aya.iml" />
- </modules>
- </component>
-</project> \ 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 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="VcsDirectoryMappings">
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
- </component>
-</project> \ 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 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="ChangeListManager">
- <list default="true" id="36ba256b-4321-4561-a616-aba14c57931e" name="Default Changelist" comment="">
- <change beforePath="$PROJECT_DIR$/AyaBot/plugins/bilibilifan.py" beforeDir="false" afterPath="$PROJECT_DIR$/AyaBot/plugins/bilibilifan.py" afterDir="false" />
- </list>
- <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
- <option name="SHOW_DIALOG" value="false" />
- <option name="HIGHLIGHT_CONFLICTS" value="true" />
- <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
- <option name="LAST_RESOLUTION" value="IGNORE" />
- </component>
- <component name="FileEditorManager">
- <leaf>
- <file pinned="false" current-in-tab="true">
- <entry file="file://$PROJECT_DIR$/AyaBot/plugins/bilibilifan.py">
- <provider selected="true" editor-type-id="text-editor">
- <state relative-caret-position="270">
- <caret line="21" column="34" lean-forward="true" selection-start-line="21" selection-start-column="34" selection-end-line="21" selection-end-column="34" />
- <folding>
- <element signature="e#0#15#0" expanded="true" />
- </folding>
- </state>
- </provider>
- </entry>
- </file>
- <file pinned="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/run.py">
- <provider selected="true" editor-type-id="text-editor">
- <state relative-caret-position="228">
- <caret line="12" selection-start-line="12" selection-end-line="12" />
- <folding>
- <element signature="e#0#14#0" expanded="true" />
- </folding>
- </state>
- </provider>
- </entry>
- </file>
- </leaf>
- </component>
- <component name="Git.Settings">
- <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
- </component>
- <component name="IdeDocumentHistory">
- <option name="CHANGED_PATHS">
- <list>
- <option value="$PROJECT_DIR$/run.py" />
- <option value="$PROJECT_DIR$/AyaBot/plugins/bilibilifan.py" />
- </list>
- </option>
- </component>
- <component name="ProjectConfigurationFiles">
- <option name="files">
- <list>
- <option value="$PROJECT_DIR$/.idea/Aya.iml" />
- <option value="$PROJECT_DIR$/.idea/misc.xml" />
- <option value="$PROJECT_DIR$/.idea/vcs.xml" />
- <option value="$PROJECT_DIR$/.idea/modules.xml" />
- </list>
- </option>
- </component>
- <component name="ProjectFrameBounds">
- <option name="x" value="260" />
- <option name="y" value="20" />
- <option name="width" value="1400" />
- <option name="height" value="1000" />
- </component>
- <component name="ProjectView">
- <navigator proportions="" version="1">
- <foldersAlwaysOnTop value="true" />
- </navigator>
- <panes>
- <pane id="Scope" />
- <pane id="ProjectPane">
- <subPane>
- <expand>
- <path>
- <item name="Aya" type="b2602c69:ProjectViewProjectNode" />
- <item name="Aya" type="462c0819:PsiDirectoryNode" />
- </path>
- <path>
- <item name="Aya" type="b2602c69:ProjectViewProjectNode" />
- <item name="Aya" type="462c0819:PsiDirectoryNode" />
- <item name="AyaBot" type="462c0819:PsiDirectoryNode" />
- </path>
- <path>
- <item name="Aya" type="b2602c69:ProjectViewProjectNode" />
- <item name="Aya" type="462c0819:PsiDirectoryNode" />
- <item name="AyaBot" type="462c0819:PsiDirectoryNode" />
- <item name="plugins" type="462c0819:PsiDirectoryNode" />
- </path>
- </expand>
- <select />
- </subPane>
- </pane>
- </panes>
- </component>
- <component name="PropertiesComponent">
- <property name="WebServerToolWindowFactoryState" value="false" />
- <property name="last_opened_file_path" value="$PROJECT_DIR$" />
- </component>
- <component name="RecentsManager">
- <key name="CopyFile.RECENT_KEYS">
- <recent name="D:\code\Aya" />
- </key>
- </component>
- <component name="RunDashboard">
- <option name="ruleStates">
- <list>
- <RuleState>
- <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
- </RuleState>
- <RuleState>
- <option name="name" value="StatusDashboardGroupingRule" />
- </RuleState>
- </list>
- </option>
- </component>
- <component name="RunManager">
- <configuration name="run" type="PythonConfigurationType" factoryName="Python" temporary="true">
- <module name="Aya" />
- <option name="INTERPRETER_OPTIONS" value="" />
- <option name="PARENT_ENVS" value="true" />
- <envs>
- <env name="PYTHONUNBUFFERED" value="1" />
- </envs>
- <option name="SDK_HOME" value="" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- <option name="IS_MODULE_SDK" value="true" />
- <option name="ADD_CONTENT_ROOTS" value="true" />
- <option name="ADD_SOURCE_ROOTS" value="true" />
- <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
- <option name="SCRIPT_NAME" value="$PROJECT_DIR$/run.py" />
- <option name="PARAMETERS" value="" />
- <option name="SHOW_COMMAND_LINE" value="false" />
- <option name="EMULATE_TERMINAL" value="false" />
- <option name="MODULE_MODE" value="false" />
- <option name="REDIRECT_INPUT" value="false" />
- <option name="INPUT_FILE" value="" />
- <method v="2" />
- </configuration>
- <recent_temporary>
- <list>
- <item itemvalue="Python.run" />
- </list>
- </recent_temporary>
- </component>
- <component name="SvnConfiguration">
- <configuration />
- </component>
- <component name="TaskManager">
- <task active="true" id="Default" summary="Default task">
- <changelist id="36ba256b-4321-4561-a616-aba14c57931e" name="Default Changelist" comment="" />
- <created>1588051377355</created>
- <option name="number" value="Default" />
- <option name="presentableId" value="Default" />
- <updated>1588051377355</updated>
- <workItem from="1588051381944" duration="1217000" />
- </task>
- <servers />
- </component>
- <component name="TimeTrackingManager">
- <option name="totallyTimeSpent" value="1217000" />
- </component>
- <component name="ToolWindowManager">
- <frame x="260" y="20" width="1400" height="1000" extended-state="0" />
- <layout>
- <window_info id="Favorites" side_tool="true" />
- <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25" />
- <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
- <window_info anchor="bottom" id="Docker" show_stripe_button="false" />
- <window_info anchor="bottom" id="Database Changes" />
- <window_info anchor="bottom" id="Version Control" />
- <window_info active="true" anchor="bottom" id="Python Console" visible="true" weight="0.3290993" />
- <window_info anchor="bottom" id="Terminal" />
- <window_info anchor="bottom" id="Event Log" side_tool="true" />
- <window_info anchor="bottom" id="Message" order="0" />
- <window_info anchor="bottom" id="Find" order="1" />
- <window_info anchor="bottom" id="Run" order="2" weight="0.3290993" />
- <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
- <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
- <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
- <window_info anchor="bottom" id="TODO" order="6" />
- <window_info anchor="right" id="SciView" />
- <window_info anchor="right" id="Database" />
- <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
- <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
- <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
- </layout>
- </component>
- <component name="TypeScriptGeneratedFilesManager">
- <option name="version" value="1" />
- </component>
- <component name="com.intellij.coverage.CoverageDataManagerImpl">
- <SUITE FILE_PATH="coverage/Aya$run.coverage" NAME="run Coverage Results" MODIFIED="1588052657410" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
- </component>
- <component name="editorHistoryManager">
- <entry file="file://$PROJECT_DIR$/run.py">
- <provider selected="true" editor-type-id="text-editor">
- <state relative-caret-position="228">
- <caret line="12" selection-start-line="12" selection-end-line="12" />
- <folding>
- <element signature="e#0#14#0" expanded="true" />
- </folding>
- </state>
- </provider>
- </entry>
- <entry file="file://$PROJECT_DIR$/AyaBot/plugins/bilibilifan.py">
- <provider selected="true" editor-type-id="text-editor">
- <state relative-caret-position="270">
- <caret line="21" column="34" lean-forward="true" selection-start-line="21" selection-start-column="34" selection-end-line="21" selection-end-column="34" />
- <folding>
- <element signature="e#0#15#0" expanded="true" />
- </folding>
- </state>
- </provider>
- </entry>
- </component>
-</project> \ 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
--- a/AyaBot/__pycache__/config.cpython-37.pyc
+++ b/AyaBot/__pycache__/config.cpython-37.pyc
Binary files differ
diff --git a/config.py b/AyaBot/config.py
index 4dd7d5f..382a461 100644
--- a/config.py
+++ b/AyaBot/config.py
@@ -5,10 +5,10 @@ HOST = '127.0.0.1'
PORT = 8080
#设置超级用户
-SUPERUSERS = {2791352599}
+SUPERUSERS = {1172294279}
#机器人赋名,替代@
-NICKNAME = {'喵内', 'rbq', ''}
+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
--- a/AyaBot/plugins/__pycache__/awsl.cpython-37.pyc
+++ b/AyaBot/plugins/__pycache__/awsl.cpython-37.pyc
Binary files 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
--- /dev/null
+++ b/AyaBot/plugins/__pycache__/bilibili.cpython-37.pyc
Binary files 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
--- a/AyaBot/plugins/bilibili/__init__.py
+++ /dev/null
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
--- a/AyaBot/plugins/bilibili/__pycache__/__init__.cpython-37.pyc
+++ /dev/null
Binary files 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/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()
+