Skip to main content

基于图片api的nonebot发图插件,支持定时任务

Project description

nonebot-plugin-sendpic

✨ 基于图片api的发图插件,支持定时任务 ✨

python

📖 介绍

本插件使用Anosu API获取图片,API网站:https://docs.anosu.top/ 支持关键词搜索、定时发送图片到群里

💿 安装

使用 nb-cli 安装 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
nb plugin install nonebot-plugin-sendpic

⚙️ 配置

单纯发送功能无需额外配置 如需设置定时发送,请在 nonebot2 项目的.env文件中添加下表中的所有配置

配置项 必填 默认值 说明
pic_num 发图数量
pic_tag 图片关键词
pic_time 发图时间
pic_group 需要发送到的群号

其中,发图时间的配置请严格按照 "x-hh-mm-ss"的格式填写。 注:x 为定时模式,填"0"为每日定时发送,填"1"为按一定时间间隔发送

多个关键词请用 | 进行分隔

四个配置项均以列表形式填写,并 严格一一对应,例:

pic_num = [8,4,6]
pic_tag = ["御姐","","萝莉|金发"]
pic_time = ["0-18-00-00","0-08-00-00","1-00-00-30"]
pin_group = ["123456789","1145141919","123456789"]

上述配置表示

于每天18:00:00向群号123456789的群发送8张关键词为"御姐"的图
于每天08:00:00向群号1145141919的群发送4张无关键词的随机图
每隔00:00:30(即30秒)向群号123456789的群发送6张关键词为"萝莉"、"金发"的图

🎉 使用

发送 发图 即可获取随机图片,若bot有设置命令前缀,需加命令前缀,如 / 支持的参数:数量、关键词 使用方法: 发图 关键词 数量 ,多个关键词请用 | 进行分隔 不声明数量默认为1,不声明关键词则为随机发图 示例:

发图 原神 5
发图 碧蓝档案|爱丽丝 
发图 3

定时发送功能目前只能在bot端配置

可能遇到的问题

定时任务不执行

可能是apscheduler线程数满了,可以尝试在.env文件中添加

apscheduler_config={ "apscheduler. executors. processpool": {"type": "processpool","max_workers":"61"},"apscheduler. job_defaults. coalesce":"false","apscheduler. job_defaults:misfire_grace_time":"60","apscheduler. job_defaults. max_instances":"61" }

将来可能支持的功能

□支持使用指令直接设置定时任务 □接入更多图片api □编写插件自带指令文档 ...

还有些想说的

本仓库使用了nonebot-plugin-template的模板,谨向作者表示感谢 本人为普通大学生,并非计算机类的专业,水平有限,如有问题或建议请直接发issue,如能解决我会尽量解决

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_sendpic-0.2.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nonebot_plugin_sendpic-0.2.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_sendpic-0.2.0.tar.gz.

File metadata

  • Download URL: nonebot_plugin_sendpic-0.2.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.11

File hashes

Hashes for nonebot_plugin_sendpic-0.2.0.tar.gz
Algorithm Hash digest
SHA256 13ba2c437236e6344507ee92080678f52cf37a6a656d933cfa983149ea35a10b
MD5 3e76b3a4d0e422cced476b16533154e4
BLAKE2b-256 ea66cb867de9d15084e790c2185103419958205d43585ef63fc993e3fe2d6f34

See more details on using hashes here.

File details

Details for the file nonebot_plugin_sendpic-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_sendpic-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1b985a6e8d2854be1424e46939b119a7618af309978bb4bc408448dd15365098
MD5 c713c5a427d5e370793ab19c5efa0345
BLAKE2b-256 94c80af17f17fb8d254beaa84761c5bc5ac59f6a32f71b822edea13ec0a12e14

See more details on using hashes here.

Supported by

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