Skip to main content

nb2chan

nonebot2betaonebotpythonCode style: blackLicense: MITPyPI version

nonebot2酱(推送服务插件)nonebot2chan (push service plugin)

Install it

pip install nb2chan

# or poetry add nb2chan
# pip install git+https://github.com/ffreemt/nb2chan
# poetry add git+https://github.com/ffreemt/nb2chan

# To upgrade
# pip install nb2chan -U
# or poetry add nb2chan@latest

Use it

# bot.py
import nonebot
...
nonebot.init()
import nb2chan
...

(参看bot.py)

  • 目标qq号(例如QQ号 1234)加nonebot2机器人qq号好友
  • nonebot2部署至外网ip,例如 uvicorn --host 0.0.0.0 bot:app (火墙需放行nonebot2的端口)
  • 给qq号发消息(浏览器地址栏或curl/httpie或python reqests/httpx 或云函数/claudflare worker etc.):
http://...:port/nb2chan/?Token=DEMO_TOKEN&qq=1234&msg=hello

例如,qq 1234 加 2129462094 为好友后,即可从以下url发推送消息给 1234。(qq 2129462094 在okteto里提供推送消息服务。)

https://nb2chan-dattw.cloud.okteto.net/nb2chan/?Token=DEMO_TOKEN&qq=1234&msg=hello1

令牌也可在headers里设定,例如

curl http://...:port/nb2chan/?qq=1234&msg=hello -H "token: DEMO_TOKEN"
http -v "http://...:port/nb2chan/?qq=1234&msg=hello world" "token: DEMO_TOKEN"

其他

nb2chan采用简单令牌鉴权。 有效令牌可在 .env.nb2chan 里设定。 默认有效令牌为['DEMO_TOKEN', 'SECRET_TOKEN'] (参看config.py)

Metadata

Release files for nb2chan 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nb2chan 0.1.1
File Size Uploaded
nb2chan-0.1.1.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nb2chan 0.1.1
File Interpreter ABI Platform
nb2chan-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / nb2chan-0.1.1.tar.gz

Download URL nb2chan-0.1.1.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8b453eebde094819a1a6dbdfdd0b1c1b028a88d61fdbbcefd2ecd5ccda2a891b
BLAKE2b-256 checksum
How to use checksums
3230cc2b837caedec97454b8c5ba82ee88d882f289f584d7a54e32b84666945a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.8.5 Windows/10

Release files / nb2chan-0.1.1-py3-none-any.whl

Download URL nb2chan-0.1.1-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aff2adc72d4e2948275c00d329c2875fd54fbc560c412130ae24819df861b4ff
BLAKE2b-256 checksum
How to use checksums
a38ef938754ce67c959d0813083601ef807b8f768b3e00e303a625cbc1001848
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.8.5 Windows/10

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page