Skip to main content

「能不能好好说话?」拼音首字母缩写翻译 NoneBot2 插件。

Project description

logo

✨ nonebot-plugin-nbnhhsh ✨

LICENSE pypi python uv
ruff pre-commit

📖 介绍

「能不能好好说话?」—— 拼音首字母缩写翻译插件。

看不懂群友在说什么?直接问 bot 就行。支持主动查询、自然语言问句触发,以及开启后的自动划词翻译。数据来源:itorr/nbnhhsh

🎨 效果图

效果图

💿 安装

使用 nb-cli 安装 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
nb plugin install nonebot-plugin-nbnhhsh --upgrade

使用 pypi 源安装

nb plugin install nonebot-plugin-nbnhhsh --upgrade -i "https://pypi.org/simple"

使用清华源安装

nb plugin install nonebot-plugin-nbnhhsh --upgrade -i "https://pypi.tuna.tsinghua.edu.cn/simple"
使用包管理器安装 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
uv
uv add nonebot-plugin-nbnhhsh

安装仓库 master 分支

uv add git+https://github.com/ByteColtX/nonebot-plugin-nbnhhsh@master
pdm
pdm add nonebot-plugin-nbnhhsh

安装仓库 master 分支

pdm add git+https://github.com/ByteColtX/nonebot-plugin-nbnhhsh@master
poetry
poetry add nonebot-plugin-nbnhhsh

安装仓库 master 分支

poetry add git+https://github.com/ByteColtX/nonebot-plugin-nbnhhsh@master

打开 nonebot2 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分追加写入

plugins = ["nonebot_plugin_nbnhhsh"]
使用 nbr 安装(使用 uv 管理依赖可用)

nbr 是一个基于 uv 的 nb-cli,可以方便地管理 nonebot2

nbr plugin install nonebot-plugin-nbnhhsh

使用 pypi 源安装

nbr plugin install nonebot-plugin-nbnhhsh -i "https://pypi.org/simple"

使用清华源安装

nbr plugin install nonebot-plugin-nbnhhsh -i "https://pypi.tuna.tsinghua.edu.cn/simple"

⚙️ 配置

在 nonebot2 项目的.env文件中添加下表中的必填配置

配置项 必填 默认值 说明
NBNHHSH_AUTO false 开启自动划词翻译,bot 会自动识别消息中的缩写并回复
NBNHHSH_AUTO_MIN_LEN 2 自动划词触发的最短缩写长度
NBNHHSH_TIMEOUT 10 设置 HTTP 请求的超时时间(秒)
NBNHHSH_TEXT2PIC false 是否将翻译结果以图片形式发送,避免因敏感词导致消息无法发送

同时需要在 .env 中配置命令分隔符(空格)以支持子命令:

COMMAND_SEP=[" ", "."]

🎉 使用

指令表

指令 权限 需要@ 范围 说明
/nbnhhsh <缩写> 群员 群聊/私聊 翻译缩写,别名:/好好说话 /hhsh /缩写
/nbnhhsh submit <缩写> <文字> 群员 群聊/私聊 提交缩写的对应文字,审核通过后生效
自然语言问句 群员 群聊/私聊 发送「xx是什么」「xx是啥」「xx啥意思」等自动触发查询

自然语言触发示例

以下问法均可触发查询,无需命令前缀:

yyds是什么
gkd是啥
nbcs啥意思
yyds是什么意思

自动划词

开启 NBNHHSH_AUTO=true 后,bot 会自动识别消息中出现的缩写并翻译,只回复有实际翻译结果的词条,暂未录入的词条不会触发回复。

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_nbnhhsh-0.1.18.tar.gz (9.5 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_nbnhhsh-0.1.18-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_nbnhhsh-0.1.18.tar.gz.

File metadata

  • Download URL: nonebot_plugin_nbnhhsh-0.1.18.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nonebot_plugin_nbnhhsh-0.1.18.tar.gz
Algorithm Hash digest
SHA256 f7534ce8f10b3735dbc387122804966d7a136aa48dde90baddabef7af93d89eb
MD5 f3ec6bb6340853332be38b6b8e16ab9a
BLAKE2b-256 334a76f1afd6591832ef49bade9859a1c51f975524f4afa41b7bc98e0ddcb1e0

See more details on using hashes here.

File details

Details for the file nonebot_plugin_nbnhhsh-0.1.18-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_nbnhhsh-0.1.18-py3-none-any.whl
Algorithm Hash digest
SHA256 23d1a290ab8063d1bab29c621344c17fbae97887d6d500e913ad662a046b28ab
MD5 cd6037f96f3289ecdf4f2b3a90cf9995
BLAKE2b-256 3a0f0f6faf8884618c3cc41132bdc81a73811e8cd85cb12469e8b4167642c147

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