{"id":21275357,"url":"https://github.com/ffreemt/nb2chan","last_synced_at":"2025-07-11T07:30:54.462Z","repository":{"id":57445056,"uuid":"415517865","full_name":"ffreemt/nb2chan","owner":"ffreemt","description":"nonebot2酱（推送服务插件） nonebot2chan (push service plugin)","archived":false,"fork":false,"pushed_at":"2022-09-19T08:59:28.000Z","size":127,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-09T05:52:39.941Z","etag":null,"topics":["cqhttp","nonebot2","plugin","push"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ffreemt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-10T07:38:25.000Z","updated_at":"2023-09-11T10:02:48.000Z","dependencies_parsed_at":"2022-09-26T17:30:45.080Z","dependency_job_id":null,"html_url":"https://github.com/ffreemt/nb2chan","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffreemt%2Fnb2chan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffreemt%2Fnb2chan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffreemt%2Fnb2chan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffreemt%2Fnb2chan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ffreemt","download_url":"https://codeload.github.com/ffreemt/nb2chan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225704692,"owners_count":17511145,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cqhttp","nonebot2","plugin","push"],"created_at":"2024-11-21T09:30:03.712Z","updated_at":"2024-11-21T09:30:04.383Z","avatar_url":"https://github.com/ffreemt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nb2chan\r\n[![nonebot2beta](https://img.shields.io/static/v1?label=nonebot\u0026message=v2b\u0026color=green)](https://v2.nonebot.dev/)[![onebot](https://img.shields.io/static/v1?label=driver\u0026message=onebot\u0026color=green)](https://adapter-onebot.netlify.app/)[![python](https://img.shields.io/static/v1?label=python+\u0026message=3.7%2B\u0026color=blue)](https://img.shields.io/static/v1?label=python+\u0026message=3.7%2B\u0026color=blue)[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)[![PyPI version](https://badge.fury.io/py/nb2chan.svg)](https://badge.fury.io/py/nb2chan)\r\n\r\nnonebot2酱（推送服务插件）nonebot2chan (push service plugin)\r\n\r\n## Install it\r\n\r\n```shell\r\npip install nb2chan\r\n\r\n# or poetry add nb2chan\r\n# pip install git+https://github.com/ffreemt/nb2chan\r\n# poetry add git+https://github.com/ffreemt/nb2chan\r\n\r\n# To upgrade\r\n# pip install nb2chan -U\r\n# or poetry add nb2chan@latest\r\n```\r\n\r\n## Use it\r\n```python\r\n# bot.py\r\nimport nonebot\r\n...\r\nnonebot.init()\r\nimport nb2chan\r\n...\r\n```\r\n(参看[`bot.py`](https://github.com/ffreemt/nb2chan/blob/master/bot.py))\r\n\r\n* 目标qq号（例如QQ号 1234）加`nonebot2`机器人qq号好友\r\n* `nonebot2`部署至外网`ip`，例如 `uvicorn --host 0.0.0.0 bot:app` (火墙需放行`nonebot2`的端口)\r\n* 给qq号发消息(浏览器地址栏或`curl/httpie`或`python reqests/httpx` 或`云函数`/`claudflare worker` etc.)：\r\n```bash\r\nhttp://...:port/nb2chan/?Token=DEMO_TOKEN\u0026qq=1234\u0026msg=hello\r\n```\r\n例如，qq 1234 加 `2129462094` 为好友后，即可从以下url发推送消息给 1234。（qq 2129462094 在`okteto`里提供推送消息服务。）\r\n```\r\nhttps://nb2chan-dattw.cloud.okteto.net/nb2chan/?Token=DEMO_TOKEN\u0026qq=1234\u0026msg=hello1\r\n```\r\n\r\n令牌也可在`headers`里设定，例如\r\n```\r\ncurl http://...:port/nb2chan/?qq=1234\u0026msg=hello -H \"token: DEMO_TOKEN\"\r\nhttp -v \"http://...:port/nb2chan/?qq=1234\u0026msg=hello world\" \"token: DEMO_TOKEN\"\r\n```\r\n\r\n## 其他\r\n`nb2chan`采用简单令牌鉴权。 有效令牌可在 `.env.nb2chan` 里设定。 默认有效令牌为`['DEMO_TOKEN', 'SECRET_TOKEN']` (参看`config.py`）\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fffreemt%2Fnb2chan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fffreemt%2Fnb2chan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fffreemt%2Fnb2chan/lists"}