Skip to main content

Multi language tanslator worked with nonebot2

Project description

基于 NoneBot2

前言

接口来自 腾讯机器翻译 TMT 目前使用 签名方法 v1

准备工作

  • 云API密钥 新建密钥

    取得 SecretIdSecretKey

  • 打开 机器翻译控制台 确认是否能正常看到概览页面

    若提示没有完成实名认证,则需要完成才能继续和正常使用

开始使用

建议使用 poetry

  • 通过 poetry 添加到 NoneBot2 项目的 pyproject.toml

poetry add nonebot-plugin-translator
  • 也可以通过 pip 从 PyPI 安装

pip install nonebot-plugin-translator
  • 参照下文在 NoneBot2 项目的环境文件 .env.* 中添加配置项

配置项

腾讯云 API 请求的公共参数(必须)
  • tencentcloud_common_region str
    地域参数 ,用来标识希望操作哪个地域的数据
  • tencentcloud_common_secretid str
    云API密钥 上申请的标识身份的 SecretId,一个 SecretId 对应唯一的 SecretKey
  • tencentcloud_common_secretkey str
    你的 SecretKey 用来生成请求签名 Signature
# .env.prod
tencentcloud_common_region = "ap-shanghai"
tencentcloud_common_secretid = ""
tencentcloud_common_secretkey = ""
这样,就能够在 bot 所在群聊或私聊发送 翻译翻译+ 使用了

翻译+ 是一个用于进行连续翻译的翻译锁定模式,翻译锁定 是它的别名,请根据提示操作

常见问题

  • 我确认我的安装和配置过程正确,但我发送 翻译机翻 没有反应
    如果在 .env.*command_start 内仅设置了非空前缀,就必须在命令前加上前缀,比如 /翻译 /翻译+

特别感谢

优化建议

请积极提交 Issues 或 Pull requests

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_translator-2.0.0b4.post2.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file nonebot_plugin_translator-2.0.0b4.post2.tar.gz.

File metadata

File hashes

Hashes for nonebot_plugin_translator-2.0.0b4.post2.tar.gz
Algorithm Hash digest
SHA256 34d5f076e53c18fe7e105661f2589e8446eeea5be1c0ebae8649ce364fb60f96
MD5 fc82e6db951a06fdf3a45b03181c877b
BLAKE2b-256 951bdd3b595ce41307a9291bb97e51125b891eaf3876013464cd1871655ae911

See more details on using hashes here.

File details

Details for the file nonebot_plugin_translator-2.0.0b4.post2-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_translator-2.0.0b4.post2-py3-none-any.whl
Algorithm Hash digest
SHA256 8b58b0da493f0000819977b77478d014b16249c72ee847ff6a1e8397e51ebad4
MD5 c9ef7e3b749b033113c21da20522a5f7
BLAKE2b-256 d66b75c65ca416f989ae4f2e148cec60b04375e0517ad7928b9df106ac05a5ea

See more details on using hashes here.

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