功能
该插件提供了一个位于 /report 的路由,通过此路由可直接向用户推送消息,实现消息推送机器人的功能
使用
请求体示例
{
"token": "your token here",
"title": "report title",
"content": "report content",
"send_to": "send to"
}
字段
| Field | Type | Desc |
|---|---|---|
token |
Optional[str] |
令牌; 当与设置的 REPORT_TOKEN 相同时才会推送消息,否则返回 403 |
title |
Optional[str] |
消息标题 |
content |
str |
消息内容,必需字段 |
send_from |
Optional[ID] |
推送消息的机器人 ID; 若不设置,任意获取一个可用的机器人 |
send_to |
Optional[ID | List[ID]] |
推送用户 user_id;若为 null 则推送给所有超管; |
send_to_group |
Optional[ID | List[ID]] |
推送群组 group_id |
别名
部分字段提供有较短的别名:
| Field | Alias |
|---|---|
send_from |
from |
send_to |
to |
send_to_group |
to_group |
别名的优先度低于原名,当且仅当原名未传入时,才会检查别名
配置
| Field | Type | Desc | Default |
|---|---|---|---|
REPORT_TOKEN |
Optional[str] |
令牌,若不设置则不会进行验证,所有人都可以触发 webhook | |
REPORT_FROM |
Optional[ID] |
send_from 的默认值 |
|
REPORT_ROUTE |
str |
路由,若与其它路由冲突可以更换该值, | /report |
REPORT_TEMPLATE |
str |
消息模板,支持 title 与 content 两个字段, |
{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
- 支持设置消息模板
Metadata
Release files for nonebot-plugin-report 1.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nonebot_plugin_report-1.3.1.tar.gz | 15.3 kB | Without provenance | Details for nonebot_plugin_report-1.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nonebot_plugin_report-1.3.1-py3-none-any.whl | Python 3 | none | any | Details for nonebot_plugin_report-1.3.1-py3-none-any.whl |
Total release size: 31.3 kB
Release files / nonebot_plugin_report-1.3.1.tar.gz
| Download URL | nonebot_plugin_report-1.3.1.tar.gz |
|---|---|
| Size | 15.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
11cf2c2e261652ce36e6faf976091dd7b6d58ac56f708d2ff21463723424284b
|
|
BLAKE2b-256 checksum How to use checksums |
43b225ddc1e0e449ba7e494a77579b09292316242549920b26983e01f2d21340
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.0 Windows/10
|
Release files / nonebot_plugin_report-1.3.1-py3-none-any.whl
| Download URL | nonebot_plugin_report-1.3.1-py3-none-any.whl |
|---|---|
| Size | 16.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e0823164d7ee5747f21952a021e8f4eb363cc1f53b7f966638c72d5ccbe2a813
|
|
BLAKE2b-256 checksum How to use checksums |
8aaba8cf7ffe83a6eb97e69445102ebe087c9d752af69c3228103f67590cf6d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.0 Windows/10
|
Security for nonebot-plugin-report 1.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.