Push message from anywhere to your bot through webhook.
Project description
nonebot-plugin-report
功能
该插件提供了一个位于 /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 | Type | Desc | Default |
---|---|---|---|
REPORT_TOKEN |
Optional[str] |
令牌,若不设置则不会进行验证,所有人都可以触发 webhook | |
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
- 支持设置消息模板
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.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca61eaa69f0c9c501941140f40a4e365dd8c7415e8fd20411d64bb80b870b94e |
|
MD5 | e7134ea577feaa7b1ce12084598cd7e7 |
|
BLAKE2b-256 | 133df6a6c49655ba22447bf68b3a824606410774a358e0d7a95ebdadaa187825 |
Close
Hashes for nonebot_plugin_report-1.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7f2099d9f1a56dfc7ba475e417a444c96a35d8791c54291422f575e3172a701 |
|
MD5 | 05f16c7a371997cf1050c4b0c44ea0be |
|
BLAKE2b-256 | 2165ca2d729e6998a15b2b3f6771565207da371281272c56202f1856e3bfafa5 |