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;若为字符串列表同上
send_to_group
: 推送群组,规则同 send_to
。
配置
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.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b592b37e8aa0d803aa1acf8e09e45f969442116aaa2e9548685e2c5aa31064fc |
|
MD5 | e5b97eda680a643b7a557939670dc9d5 |
|
BLAKE2b-256 | 1ab33b26f9e34f0a2743153f4ca0b3ede9a33b4b2a4a1a48b836aba99c61fb70 |
Close
Hashes for nonebot_plugin_report-1.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5e73957e0937fed26cdb2748b83017c5ddf5780796c921d6055a0b45335115f |
|
MD5 | 4a82b89d97266567fafdfcebdfbc0773 |
|
BLAKE2b-256 | 1de654cbc6fd53f2e585561e770552b4c74b818871b93af680b4a9b811367e1e |