From f5b0b283316e61f14741cb7841207f65d873d8a1 Mon Sep 17 00:00:00 2001 From: felinae98 <731499577@qq.com> Date: Thu, 8 Jul 2021 19:43:23 +0800 Subject: [PATCH] update doc --- docs/README.md | 2 +- docs/usage/README.md | 12 +++++++++++- docs/usage/quick-start.md | 1 - src/plugins/nonebot_hk_reporter/platform/platform.py | 7 +++---- 4 files changed, 15 insertions(+), 7 deletions(-) delete mode 100644 docs/usage/quick-start.md diff --git a/docs/README.md b/docs/README.md index 3ae3760..6ccaef1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,7 +1,7 @@ --- home: true heroText: Nonebot HK Reporter -tagline: 本bot励志做全世界跑得最快的记者 +tagline: 本bot励志做全世界跑得最快的搬运机器人 actionText: 快速部署 actionLink: /usage/ features: diff --git a/docs/usage/README.md b/docs/usage/README.md index 1baa6fc..ca6b4e9 100644 --- a/docs/usage/README.md +++ b/docs/usage/README.md @@ -1,6 +1,5 @@ --- sidebar: auto -sidebarDepth: 4 --- # 部署和使用 本节将教你快速部署和使用一个nonebot-hk-reporter,如果你不知道要选择哪种部署方式,推荐使用[docker-compose](#docker-compose部署-推荐) @@ -44,12 +43,23 @@ sidebarDepth: 4 docker-compose up -d ``` #### docker部署 +本项目的docker镜像为`felinae98/nonebot-hk-reporter`,可以直接pull后run进行使用, +相关配置参数可以使用`-e`作为环境变量传入 #### 直接运行(不推荐) ::: danger 本项目中使用了Python 3.9的语法,如果出现问题,请检查Python版本 ::: +1. 首先安装poetry:[安装方法](https://python-poetry.org/docs/#installation) +2. clone本项目,在项目中`poetry install`安装依赖 +3. 编辑`.env.prod`配置各种环境变量,见[Nonebot2配置](https://v2.nonebot.dev/guide/basic-configuration.html) +4. 运行`poetry run python bot.py`启动机器人 ### 作为插件使用 本部分假设大家会部署nonebot2 +#### 手动安装 +1. 安装pip包`nonebot-hk-reporter` +2. 在`bot.py`中导入插件`nonebot_hk_reporter` +### 自动安装 +使用`nb-cli`执行:`nb plugin install nonebot_hk_reporter` ## 配置 * `HK_REPORTER_CONFIG_PATH`: 插件存放配置文件的位置,如果不设定默认为项目目录下的`data`目录 * `HK_REPORTER_USE_PIC`: 将文字渲染成图片后进行发送,多用于规避风控 diff --git a/docs/usage/quick-start.md b/docs/usage/quick-start.md deleted file mode 100644 index b8be99b..0000000 --- a/docs/usage/quick-start.md +++ /dev/null @@ -1 +0,0 @@ -# 快速入门 diff --git a/src/plugins/nonebot_hk_reporter/platform/platform.py b/src/plugins/nonebot_hk_reporter/platform/platform.py index 7f73087..b840335 100644 --- a/src/plugins/nonebot_hk_reporter/platform/platform.py +++ b/src/plugins/nonebot_hk_reporter/platform/platform.py @@ -74,7 +74,7 @@ class NoTargetMixin(StorageMixinProto, abstract=True): def set_stored_data(self, _: Target, data: Any): self.store = data -class PlaformNameMixin(metaclass=RegistryABCMeta, abstract=True): +class PlatformNameMixin(metaclass=RegistryABCMeta, abstract=True): platform_name: str class CategoryMixin(metaclass=RegistryABCMeta, abstract=True): @@ -91,7 +91,7 @@ class ParsePostMixin(metaclass=RegistryABCMeta, abstract=True): "parse RawPost into post" ... -class MessageProcessMixin(PlaformNameMixin, CategoryMixin, ParsePostMixin, abstract=True): +class MessageProcessMixin(PlatformNameMixin, CategoryMixin, ParsePostMixin, abstract=True): "General message process fetch, parse, filter progress" def __init__(self): @@ -221,7 +221,7 @@ class UserCustomFilterMixin(CategoryMixin, ParsePostMixin, abstract=True): res.append((user, user_post)) return res -class Platform(metaclass=RegistryABCMeta, base=True): +class Platform(PlatformNameMixin, base=True): # schedule_interval: int schedule_type: Literal['date', 'interval', 'cron'] @@ -269,7 +269,6 @@ class NewMessage( class StatusChange( Platform, StorageMixinProto, - PlaformNameMixin, UserCustomFilterMixin, abstract=True ):