Push message from anywhere to your bot through webhook.
Project description
nonebot-plugin-report
Push message from anywhere to your bot through webhook.
功能
该插件提供了一个位于 /report
的路由,通过此路由可直接向用户推送消息,实现消息推送机器人的功能
使用
请求体示例
{
"token": "your token here",
"title": "report title",
"content": "report content",
"send_to": "send to"
}
字段
token
: 令牌,当与设置的 REPORT_TOKEN
相同时才会推送消息,否则返回 403
title
: 消息标题
content
: 消息内容,* 必需字段
send_to
: 推送对象。若为 null
则推送给所有超管;若为字符串则将其视为推送对象 user_id;若为字符串列表同上
配置
REPORT_TOKEN
: 令牌,若不设置则不会进行验证,即所有人都可以触发 webhook
REPORT_ROUTE
: 路由,若与其它路由冲突可以更换该值,default: /report
REPORT_TEMPLATE
: 消息模板,支持 title
与 content
两个字段,default: {title}\n{content}
使用例
python
import requests
data = {'token': '...', 'content': '...'}
requests.post('http://127.0.0.1:8080/report', json=data)
curl
curl -L -X POST \
-d '{"token": "...", "content": "..."}' \
-H "Content-Type: application/json" \
-- http://127.0.0.1:8080/report
todo
- 支持设置消息模板
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for nonebot-plugin-report-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 914b4fbbfdc2c7a774e46fec633fe72c42bec7fa9d90365d04734d9a8fcb95db |
|
MD5 | 1db72f0d1c00f442b2aef5ba4083a91f |
|
BLAKE2b-256 | d17bfcfbbb0f9b1a68ca6f4ca935e3043ac9f8e1c98c37befdd235297ace9d24 |
Close
Hashes for nonebot_plugin_report-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2a5519fbeec25ccd17bd42aac79a8d5389e0c6a1b369ed5f472ab61705ab434 |
|
MD5 | 9133b24bde8c263d8a6d96f3da7a45bb |
|
BLAKE2b-256 | 19293fc6a903ce46d1fdccfd14e83a77e428009849a5c8af1b324740364850eb |