Skip to main content

Multi language tanslator worked with nonebot2

Project description

nonebot plugin translator

功能

  • 多语种翻译插件

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

准备工作

  • 云API密钥 新建密钥,取得 SecretIdSecretKey

开始使用

建议使用 poetry

  • 通过 poetry 添加到 nonebot2 项目的 pyproject.toml
poetry add nonebot-plugin-translator
  • 也可以通过 pip 从 PyPI 安装
pip install nonebot-plugin-translator
  • 在 nonebot2 项目中设置 nonebot.load_plugin()

当使用 nb-cli 添加本插件时,该条会被自动添加

nonebot.load_plugin('nonebot_plugin_translator')
  • 参照下文在 nonebot2 项目的环境文件 .env.* 中添加配置项

配置项

  • 腾讯云 API 请求的公共参数(必须)

    tencentcloud_common_region: str 地域参数,用来标识希望操作哪个地域的数据

    tencentcloud_common_secretid: str云API密钥 上申请的标识身份的 SecretId,一个 SecretId 对应唯一的 SecretKey

    tencentcloud_common_secretkey: str 你的 SecretKey 用来生成请求签名 Signature

tencentcloud_common_region = "ap-shanghai"
tencentcloud_common_secretid = ""
tencentcloud_common_secretkey = ""
  • 这样,就能够在 bot 所在群聊或私聊发送 翻译机翻 使用了

特别感谢

优化建议

请积极提交 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.0a13.post0.tar.gz (17.6 kB view hashes)

Uploaded Source

Built Distribution

Supported by

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