Skip to main content

APScheduler Support for NoneBot2

Project description

nonebot

NoneBot Plugin APScheduler

✨ NoneBot APScheduler 定时任务插件 ✨

license pypi python

使用方式

加载插件后使用 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 = 20
  • DEBUG = 10 (只有在开启 nonebot 的 debug 模式才会显示 debug 日志)

apscheduler_config

apscheduler 的相关配置。参考 配置 scheduler, 配置参数

配置需要包含 prefix: apscheduler.

默认配置:

{ "apscheduler.timezone": "Asia/Shanghai" }

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nonebot_plugin_apscheduler-0.5.0.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page