使用方式
加载插件后使用 require 获取 scheduler 对象(请注意插件加载顺序)
from nonebot import require
require("nonebot_plugin_apscheduler")
from nonebot_plugin_apscheduler import scheduler
@scheduler.scheduled_job("cron", hour="*/2", id="xxx", args=[1], kwargs={"arg2": 2})
async def run_every_2_hour(arg1, arg2):
pass
scheduler.add_job(run_every_day_from_program_start, "interval", days=1, id="xxx")
配置项
apscheduler_autostart
是否自动启动 scheduler
apscheduler_log_level
int 类型日志等级
WARNING=30(默认)INFO=20DEBUG=10(只有在开启 nonebot 的 debug 模式才会显示 debug 日志)
apscheduler_config
apscheduler 的相关配置。参考 配置 scheduler, 配置参数
配置需要包含 prefix: apscheduler.
默认配置:
{ "apscheduler.timezone": "Asia/Shanghai" }
Metadata
Release files for nonebot-plugin-apscheduler 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nonebot_plugin_apscheduler-0.5.0.tar.gz | 3.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nonebot_plugin_apscheduler-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.1 kB
Release files / nonebot_plugin_apscheduler-0.5.0.tar.gz
| Download URL | nonebot_plugin_apscheduler-0.5.0.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c0230e99765f275dc83d6639ff33bd6f71203fa10cd1b8a204b0f95530cda86
|
|
BLAKE2b-256 checksum How to use checksums |
d653019bfea58c506c0166d8ef77959fd8676019469d0d3d8e135ae8f1a4b772
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Release files / nonebot_plugin_apscheduler-0.5.0-py3-none-any.whl
| Download URL | nonebot_plugin_apscheduler-0.5.0-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b99b5ee60c4bc195d4df2fd27dab3d6963691e3332f6cee31a06eb4277c307f
|
|
BLAKE2b-256 checksum How to use checksums |
fbf48a3334dcd91e368d2f4e2b21f4805ac70b5dd8a1f9dac94fea5269e82bd3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|