Update scheduler.md

This commit is contained in:
StarHeart 2021-02-01 13:45:31 +08:00 committed by GitHub
parent 34c2ba8faa
commit b67d2ebce6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,10 +96,14 @@ scheduler = require('nonebot_plugin_apscheduler').scheduler
对于大多数情况,我们需要在 `nonebot2` 项目被启动时启动定时任务,则此处设为 `true`
### 在 `.env` 中添加
```bash
APSCHEDULER_AUTOSTART=true
```
### 在 `bot.py` 中添加
```python
nonebot.init(apscheduler_autostart=True)
```
@ -116,10 +120,14 @@ nonebot.init(apscheduler_autostart=True)
> 官方文档在绝大多数时候能提供最准确和最具时效性的指南
### 在 `.env` 中添加
```bash
APSCHEDULER_CONFIG={"apscheduler.timezone": "Asia/Shanghai"}
```
### 在 `bot.py` 中添加
```python
nonebot.init(apscheduler_config={
"apscheduler.timezone": "Asia/Shanghai"