Giter Club home page Giter Club logo

nonebot-plugin-report's Introduction

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: 消息模板,支持 titlecontent 两个字段,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

  • 支持设置消息模板

nonebot-plugin-report's People

Contributors

syrinka avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.