kovi-plugin-web-shot

Crates.iokovi-plugin-web-shot
lib.rskovi-plugin-web-shot
version0.1.7
created_at2025-11-26 10:27:36.829782+00
updated_at2025-11-27 19:00:36.586353+00
descriptionKovi 的网页截图插件,自动检测 URL 并生成长截图。
homepage
repositoryhttps://github.com/araea/kovi-plugin-web-shot
max_upload_size
id1951224
size68,675
nawyjx (araea)

documentation

README

kovi-plugin-web-shot

github crates.io

Kovi 的网页截图插件。自动检测消息中的 URL,调用无头浏览器进行截图(支持长页面自动滚动截图)。

前置

  1. 创建 Kovi 项目
  2. 执行 cargo add kovi-plugin-web-shot
  3. src/main.rs 中添加 kovi_plugin_web_shot
  4. 环境要求:运行环境需安装 Chrome、Chromium 或 Edge 浏览器。

使用

  1. 在群组或私聊中发送包含 httphttps 链接的消息。
  2. 机器人将自动访问网页,生成截图并发送。
  3. 如果网页内容较长,插件会自动调整视口进行长截图(受最大高度限制)。

注意:插件会自动忽略黑名单群组和配置文件中指定的域名。

配置

资源目录 : data/kovi-plugin-web-shot/*

首次运行时自动生成。

config.toml - 插件配置

# 插件总开关
enabled = true

# 是否只在 @ 机器人时响应(设为 false 则自动检测所有包含链接的消息)
only_at = false

# 截图最大高度限制 (像素),防止无限滚动页面导致内存溢出
max_height = 5000

# 页面加载超时时间 (秒)
timeout_seconds = 30

# 截图质量 (1-100, 仅对 jpeg/webp 有效,>=100 会使用 png 格式)
quality = 80

# 浏览器视口宽度
viewport_width = 1280

# 像素比 (2.0 为高清/Retina,1.0 为标准)
device_scale_factor = 1.0

# 忽略的域名关键词列表 (不截图包含这些词的链接)
# 例如不截图百度 ignore_domains = ["baidu.com"]
ignore_domains = []

# 频道过滤
[channel]
# 频道白名单(如果非空,只允许这些群)
white = []
# 频道黑名单(排除这些群)
black = ["123456789"]

致谢


License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Commit count: 0

cargo fmt