nonebot_plugin_mqtt
功能
- 将 nonebot 接入 mqtt 网络
开始使用
- 使用 nb-cli 安装
nb plugin install nonebot-plugin-mqtt
- 参照下文在 nonebot2 项目的环境文件 .env.* 中添加配置项
配置项
MQTT_TOPIC # MQTT 订阅 Topic
MQTT_CLIENT_ID # MQTT 订阅 Client ID
MQTT_HOST # MQTT Broker 地址
MQTT_PORT # MQTT Broker 端口
MQTT_USER # MQTT 可选验证项
MQTT_PASSWORD
在其他插件中使用
from nonebot import require
require("nonebot_plugin_mqtt")
from nonebot_plugin_mqtt import mqtt_client
mqtt_client.publish(topic, payload=payload, qos=0, retain=False)
mqtt_client.subscribe(topic, qos=1)
# 自定义回调
mqtt_client.on_message = on_message
mqtt_client.on_connect = on_connect
特别感谢
优化建议
可以来抓更多网站的接口 or 汇报 bug or pr
Metadata
Release files for nonebot-plugin-mqtt 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nonebot-plugin-mqtt-0.1.2.tar.gz | 16.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nonebot_plugin_mqtt-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.9 kB
Release files / nonebot-plugin-mqtt-0.1.2.tar.gz
| Download URL | nonebot-plugin-mqtt-0.1.2.tar.gz |
|---|---|
| Size | 16.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e6f256840c77796d7f26f2d2e03e28bfa4b78cf672729748913076d755bf5c5b
|
|
BLAKE2b-256 checksum How to use checksums |
69de15329e1e42149cb4688dfa0c700ec326c153a52ab18c1ea509471def1af6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.8
|
Release files / nonebot_plugin_mqtt-0.1.2-py3-none-any.whl
| Download URL | nonebot_plugin_mqtt-0.1.2-py3-none-any.whl |
|---|---|
| Size | 16.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
80a3ca25bb3f1dbc700201f5dca811ef96096d062ec2353453f6949a2727115b
|
|
BLAKE2b-256 checksum How to use checksums |
a2934ab24ce8aa1488828c3a09714607d189ef6458c7f81a8d0de8794ab01e28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.8
|