kovi-plugin-webhooker 1.0.0

基于 Kovi 框架的 Webhook 转发插件
Documentation

Webhooker

Webhooker 是基于 Kovi 框架的 Webhook 转发插件

通过配置 Webhook 端点和 json 访问路径,用户可以将发送到 Webhook 的 json payload 的指定字段交由 bot 转发

安装

  1. 根据教程创建一个 Kovi 工程
  2. 在项目根目录运行
cargo add kovi-plugin-webhooker

  1. build_bot! 宏中传入插件
let bot = build_bot!(kovi-plugin-webhooker /* 和其他你正在使用的插件,用 , 分割 */ );

配置

Webhooker 可以通过 toml 文件进行配置。如果配置文件不存在,则使用默认配置。

# 监听地址

listen = "0.0.0.0"

port = 11451



auth = "Some Cool Auth Token"   # 可选, 添加后需要通过 Bearer Auth 头鉴权



[[webhooks]]

endpoint = "/test"                           # 在 /webhook/test 添加 webhook 端点

message = "Today's temperature is {temp}"    # 字符串,具体规则见下方 values

values = [

    # 此处 `temp` 字段会从发过来的 POST json 中, 通过路径 `weather.temperature` 抽取数值

    # 随后, `temp` 会填充到上方 message 的 {temp} 处

    { name = "temp", dotpath = "weather.temperature" }, 

]

groups = [123456789]    # 要发送的群聊

users = [987654321]    # 要发送的用户

配置文件应放置于编译后与可执行文件同级的 data/kovi-plugin-webhooker/config.toml 中。