<p align="center">
<a href="https://nonebot.dev/"><img src="https://nonebot.dev/logo.png" width="200" height="200" alt="nonebot"></a>
</p>
<div align="center">
# NoneBot Plugin APScheduler
_✨ NoneBot APScheduler 定时任务插件 ✨_
</div>
<p align="center">
<a href="https://raw.githubusercontent.com/nonebot/plugin-apscheduler/master/LICENSE">
<img src="https://img.shields.io/github/license/nonebot/plugin-apscheduler.svg" alt="license">
</a>
<a href="https://pypi.python.org/pypi/nonebot-plugin-apscheduler">
<img src="https://img.shields.io/pypi/v/nonebot-plugin-apscheduler.svg" alt="pypi">
</a>
<img src="https://img.shields.io/badge/python-3.7+-blue.svg" alt="python">
</p>
## 使用方式
加载插件后使用 `require` 获取 `scheduler` 对象(请注意插件加载顺序)
```python
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` = `20`
- `DEBUG` = `10` (只有在开启 nonebot 的 debug 模式才会显示 debug 日志)
### apscheduler_config
`apscheduler` 的相关配置。参考 [配置 scheduler](https://apscheduler.readthedocs.io/en/latest/userguide.html#scheduler-config), [配置参数](https://apscheduler.readthedocs.io/en/latest/modules/schedulers/base.html#apscheduler.schedulers.base.BaseScheduler)
配置需要包含 `prefix: apscheduler.`
默认配置:
```json
{ "apscheduler.timezone": "Asia/Shanghai" }
```
Raw data
{
"_id": null,
"home_page": "https://github.com/nonebot/plugin-apscheduler",
"name": "nonebot-plugin-apscheduler",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "yanyongyu",
"author_email": "yyy@nonebot.dev",
"download_url": "https://files.pythonhosted.org/packages/d6/53/019bfea58c506c0166d8ef77959fd8676019469d0d3d8e135ae8f1a4b772/nonebot_plugin_apscheduler-0.5.0.tar.gz",
"platform": null,
"description": "<p align=\"center\">\n <a href=\"https://nonebot.dev/\"><img src=\"https://nonebot.dev/logo.png\" width=\"200\" height=\"200\" alt=\"nonebot\"></a>\n</p>\n\n<div align=\"center\">\n\n# NoneBot Plugin APScheduler\n\n_\u2728 NoneBot APScheduler \u5b9a\u65f6\u4efb\u52a1\u63d2\u4ef6 \u2728_\n\n</div>\n\n<p align=\"center\">\n <a href=\"https://raw.githubusercontent.com/nonebot/plugin-apscheduler/master/LICENSE\">\n <img src=\"https://img.shields.io/github/license/nonebot/plugin-apscheduler.svg\" alt=\"license\">\n </a>\n <a href=\"https://pypi.python.org/pypi/nonebot-plugin-apscheduler\">\n <img src=\"https://img.shields.io/pypi/v/nonebot-plugin-apscheduler.svg\" alt=\"pypi\">\n </a>\n <img src=\"https://img.shields.io/badge/python-3.7+-blue.svg\" alt=\"python\">\n</p>\n\n## \u4f7f\u7528\u65b9\u5f0f\n\n\u52a0\u8f7d\u63d2\u4ef6\u540e\u4f7f\u7528 `require` \u83b7\u53d6 `scheduler` \u5bf9\u8c61\uff08\u8bf7\u6ce8\u610f\u63d2\u4ef6\u52a0\u8f7d\u987a\u5e8f\uff09\n\n```python\nfrom nonebot import require\n\nrequire(\"nonebot_plugin_apscheduler\")\n\nfrom nonebot_plugin_apscheduler import scheduler\n\n@scheduler.scheduled_job(\"cron\", hour=\"*/2\", id=\"xxx\", args=[1], kwargs={\"arg2\": 2})\nasync def run_every_2_hour(arg1, arg2):\n pass\n\nscheduler.add_job(run_every_day_from_program_start, \"interval\", days=1, id=\"xxx\")\n```\n\n## \u914d\u7f6e\u9879\n\n### apscheduler_autostart\n\n\u662f\u5426\u81ea\u52a8\u542f\u52a8 `scheduler`\n\n### apscheduler_log_level\n\n`int` \u7c7b\u578b\u65e5\u5fd7\u7b49\u7ea7\n\n- `WARNING` = `30` (\u9ed8\u8ba4)\n- `INFO` = `20`\n- `DEBUG` = `10` (\u53ea\u6709\u5728\u5f00\u542f nonebot \u7684 debug \u6a21\u5f0f\u624d\u4f1a\u663e\u793a debug \u65e5\u5fd7)\n\n### apscheduler_config\n\n`apscheduler` \u7684\u76f8\u5173\u914d\u7f6e\u3002\u53c2\u8003 [\u914d\u7f6e scheduler](https://apscheduler.readthedocs.io/en/latest/userguide.html#scheduler-config), [\u914d\u7f6e\u53c2\u6570](https://apscheduler.readthedocs.io/en/latest/modules/schedulers/base.html#apscheduler.schedulers.base.BaseScheduler)\n\n\u914d\u7f6e\u9700\u8981\u5305\u542b `prefix: apscheduler.`\n\n\u9ed8\u8ba4\u914d\u7f6e\uff1a\n\n```json\n{ \"apscheduler.timezone\": \"Asia/Shanghai\" }\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "APScheduler Support for NoneBot2",
"version": "0.5.0",
"project_urls": {
"Documentation": "https://github.com/nonebot/plugin-apscheduler#readme",
"Homepage": "https://github.com/nonebot/plugin-apscheduler",
"Repository": "https://github.com/nonebot/plugin-apscheduler"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fbf48a3334dcd91e368d2f4e2b21f4805ac70b5dd8a1f9dac94fea5269e82bd3",
"md5": "ddbfd42a33ddda1800ba890c9a378515",
"sha256": "8b99b5ee60c4bc195d4df2fd27dab3d6963691e3332f6cee31a06eb4277c307f"
},
"downloads": -1,
"filename": "nonebot_plugin_apscheduler-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ddbfd42a33ddda1800ba890c9a378515",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 4307,
"upload_time": "2024-06-28T13:17:09",
"upload_time_iso_8601": "2024-06-28T13:17:09.593510Z",
"url": "https://files.pythonhosted.org/packages/fb/f4/8a3334dcd91e368d2f4e2b21f4805ac70b5dd8a1f9dac94fea5269e82bd3/nonebot_plugin_apscheduler-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d653019bfea58c506c0166d8ef77959fd8676019469d0d3d8e135ae8f1a4b772",
"md5": "8b1fa960b7f96ee04008fb3b5cdf49ab",
"sha256": "6c0230e99765f275dc83d6639ff33bd6f71203fa10cd1b8a204b0f95530cda86"
},
"downloads": -1,
"filename": "nonebot_plugin_apscheduler-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "8b1fa960b7f96ee04008fb3b5cdf49ab",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 3816,
"upload_time": "2024-06-28T13:17:10",
"upload_time_iso_8601": "2024-06-28T13:17:10.570749Z",
"url": "https://files.pythonhosted.org/packages/d6/53/019bfea58c506c0166d8ef77959fd8676019469d0d3d8e135ae8f1a4b772/nonebot_plugin_apscheduler-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-28 13:17:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nonebot",
"github_project": "plugin-apscheduler",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nonebot-plugin-apscheduler"
}