update doc

This commit is contained in:
felinae98 2021-07-08 19:43:23 +08:00
parent 72e0b8ae3d
commit f5b0b28331
No known key found for this signature in database
GPG Key ID: 00C8B010587FF610
4 changed files with 15 additions and 7 deletions

View File

@ -1,7 +1,7 @@
--- ---
home: true home: true
heroText: Nonebot HK Reporter heroText: Nonebot HK Reporter
tagline: 本bot励志做全世界跑得最快的记者 tagline: 本bot励志做全世界跑得最快的搬运机器人
actionText: 快速部署 actionText: 快速部署
actionLink: /usage/ actionLink: /usage/
features: features:

View File

@ -1,6 +1,5 @@
--- ---
sidebar: auto sidebar: auto
sidebarDepth: 4
--- ---
# 部署和使用 # 部署和使用
本节将教你快速部署和使用一个nonebot-hk-reporter如果你不知道要选择哪种部署方式推荐使用[docker-compose](#docker-compose部署-推荐) 本节将教你快速部署和使用一个nonebot-hk-reporter如果你不知道要选择哪种部署方式推荐使用[docker-compose](#docker-compose部署-推荐)
@ -44,12 +43,23 @@ sidebarDepth: 4
docker-compose up -d docker-compose up -d
``` ```
#### docker部署 #### docker部署
本项目的docker镜像为`felinae98/nonebot-hk-reporter`可以直接pull后run进行使用
相关配置参数可以使用`-e`作为环境变量传入
#### 直接运行(不推荐) #### 直接运行(不推荐)
::: danger ::: danger
本项目中使用了Python 3.9的语法如果出现问题请检查Python版本 本项目中使用了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 本部分假设大家会部署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_CONFIG_PATH`: 插件存放配置文件的位置,如果不设定默认为项目目录下的`data`目录
* `HK_REPORTER_USE_PIC`: 将文字渲染成图片后进行发送,多用于规避风控 * `HK_REPORTER_USE_PIC`: 将文字渲染成图片后进行发送,多用于规避风控

View File

@ -1 +0,0 @@
# 快速入门

View File

@ -74,7 +74,7 @@ class NoTargetMixin(StorageMixinProto, abstract=True):
def set_stored_data(self, _: Target, data: Any): def set_stored_data(self, _: Target, data: Any):
self.store = data self.store = data
class PlaformNameMixin(metaclass=RegistryABCMeta, abstract=True): class PlatformNameMixin(metaclass=RegistryABCMeta, abstract=True):
platform_name: str platform_name: str
class CategoryMixin(metaclass=RegistryABCMeta, abstract=True): class CategoryMixin(metaclass=RegistryABCMeta, abstract=True):
@ -91,7 +91,7 @@ class ParsePostMixin(metaclass=RegistryABCMeta, abstract=True):
"parse RawPost into post" "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" "General message process fetch, parse, filter progress"
def __init__(self): def __init__(self):
@ -221,7 +221,7 @@ class UserCustomFilterMixin(CategoryMixin, ParsePostMixin, abstract=True):
res.append((user, user_post)) res.append((user, user_post))
return res return res
class Platform(metaclass=RegistryABCMeta, base=True): class Platform(PlatformNameMixin, base=True):
# schedule_interval: int # schedule_interval: int
schedule_type: Literal['date', 'interval', 'cron'] schedule_type: Literal['date', 'interval', 'cron']
@ -269,7 +269,6 @@ class NewMessage(
class StatusChange( class StatusChange(
Platform, Platform,
StorageMixinProto, StorageMixinProto,
PlaformNameMixin,
UserCustomFilterMixin, UserCustomFilterMixin,
abstract=True abstract=True
): ):