Skip to main content

在QQ频道与 Discord 之间同步消息的 nonebot2 插件

Project description

QQ频道-Discord 互通

python

前言

[!CAUTION] QQ 官方机器人于 2025 年 4 月 21 日起不再提供主动推送能力。因此本插件将不能正常工作。

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

因用到了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

配置

dcqg_relay_channel_links

  • 类型: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_idwebhook_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]
  • 默认值:["/"]
  • 说明:指明不转发的消息开头

特别感谢

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nonebot_plugin_dcqg_relay-1.1.3.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nonebot_plugin_dcqg_relay-1.1.3-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_dcqg_relay-1.1.3.tar.gz.

File metadata

File hashes

Hashes for nonebot_plugin_dcqg_relay-1.1.3.tar.gz
Algorithm Hash digest
SHA256 1db8a37078091d8ff3986d9617208cb27e3129c4531595467470a798509011b5
MD5 27bb62fde5fb802758d02c9a55c3dee5
BLAKE2b-256 7ed5ebcca8da62dc2bf043c1bc1331bd6ab32b0e517f210211b924a3f0a953c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for nonebot_plugin_dcqg_relay-1.1.3.tar.gz:

Publisher: release.yml on Autuamn/nonebot-plugin-dcqg-relay

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nonebot_plugin_dcqg_relay-1.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_dcqg_relay-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f0302561f03a906cc891009ffbb5bd1437e5f1d9472cd2d40451d17639e90a22
MD5 9cbf75f10e13572138dca0ee6b7795a4
BLAKE2b-256 5805e1c93e642e144a18fe669998508639193b977ebcf4157868aa3bc6d45ce0

See more details on using hashes here.

Provenance

The following attestation bundles were made for nonebot_plugin_dcqg_relay-1.1.3-py3-none-any.whl:

Publisher: release.yml on Autuamn/nonebot-plugin-dcqg-relay

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page