Skip to main content

QQ频道-Discord 互通

python

前言

本项目为自用插件,如果有需求或想法请提出,我尽量满足

因用到了QQ官方的频道机器人接口,功能少,限制多,而且很多功能我也没法测试,就没有支持。之后可能会出一个基于 OneBot 适配器的版本(懒)

目前QQ机器人不能发 url,如果从 Discord 转来的消息里带有 url 的活是发不出来的,目前我没有想到解决办法。有想法请提出

功能

可以在指定的QQ子频道和 Discord 频道之间同步消息,只支持普通的文字频道,不支持帖子频道

目前支持的消息:

  • 文字
  • 图片
  • 表情

尚未支持的消息:

  • 文件
  • 语音
  • 视频
  • ARK 消息
  • Embed 消息

安装

使用 nb-cli 安装

在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装

nb plugin install nonebot-plugin-dcqg-relay

使用包管理器安装

建议使用 poetry

  • 通过 poetry 添加到 NoneBot2 项目的 pyproject.toml
poetry add nonebot-plugin-dcqg-relay
  • 也可以通过 pip 安装
pip install nonebot-plugin-dcqg-relay

安装开发中版本

pip install git+https://github.com/Autuamn/nonebot-plugin-dcqg-relay.git@main

配置

  • 类型:json
  • 默认值:[]
  • 说明:链接对应的QQ子频道与 Discord 频道,目前只支持一对一链接

配置文件示例

dcqg_relay_channel_links='[
    {
        "qq_guild_id": "123132",
        "dc_guild_id": 456456,
        "qq_channel_id": "78789",
        "dc_channel_id": 123123,
        "webhook_id": 456456,
        "webhook_token": "xxx"
    },
    {
        "qq_guild_id": str                # QQ频道 id
        "dc_guild_id": int                # Discord 服务器 id
        "qq_channel_id": str              # QQ子频道 id
        "dc_channel_id": int              # Discord 频道 id
        "webhook_id": Optional[int]       # (可选的)Discord 对应频道的 WebHook id
        "webhook_token": Optional[str]    # (可选的)对应 Webhook 的 token
                                        # 请不要将注释放在此处!!
    }
]'

Webhook 的相关配置是可选的,不填插件会自动获取

关于 Webhook 是什么请看:使用網絡鉤手(Webhooks)

得到 Webhook URL 后,可从 URL 中获取 webhook_id 和 webhook_token

Webhook URL 形如: https://discord.com/api/webhooks/{webhook_id}/{webhook_token}

例如:

当 Webhook URL 为 https://discord.com/api/webhooks/1243529342621978694/kq1Vc3NsN4d3SB0MAusB-xbY_e8xMChQmxypIFna0c1lwQS-uL85fqupK2jFfkYtUR1h 时

1243529342621978694 就是 webhook_id

kq1Vc3NsN4d3SB0MAusB-xbY_e8xMChQmxypIFna0c1lwQS-uL85fqupK2jFfkYtUR1h 就是 webhook_token

dcqg_relay_unmatch_beginning

  • 类型:list[str]
  • 默认值:["/"]
  • 说明:指明不转发的消息开头

特别感谢

Metadata

Release files for nonebot-plugin-dcqg-relay 1.1.4

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

Source distribution (sdist)

Source distribution for nonebot-plugin-dcqg-relay 1.1.4
File Size Uploaded Provenance Actions
nonebot_plugin_dcqg_relay-1.1.4.tar.gz 16.3 kB With provenance Details for nonebot_plugin_dcqg_relay-1.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nonebot-plugin-dcqg-relay 1.1.4
File Interpreter ABI Platform Actions
nonebot_plugin_dcqg_relay-1.1.4-py3-none-any.whl Python 3 none any Details for nonebot_plugin_dcqg_relay-1.1.4-py3-none-any.whl

Total release size: 34.3 kB

Release files / nonebot_plugin_dcqg_relay-1.1.4.tar.gz

Download URL nonebot_plugin_dcqg_relay-1.1.4.tar.gz
Size 16.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0a9267259f0eb8604436468b5766d40aab9bd743989110363f50339f17eaf281
BLAKE2b-256 checksum
How to use checksums
563b54b83e81277c71028ed96ba99de903b55beabce56f286ed4a47dd24c4065
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2025.

Transparency log

Release files / nonebot_plugin_dcqg_relay-1.1.4-py3-none-any.whl

Download URL nonebot_plugin_dcqg_relay-1.1.4-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
89575890040d58f8538342f92f4e04d28a6893ea82bf0f3b8101845bf1e2c95e
BLAKE2b-256 checksum
How to use checksums
3b7a88055e8b0b400f270e478aee9192a8039721889bb495232bcaf03938c47f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2025.

Transparency log

Security for nonebot-plugin-dcqg-relay 1.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nonebot_plugin_dcqg_relay-1.1.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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