Skip to main content
改群名插件头图

🏷️ 改群名 · Group Rename

面向 PJSK、BanG Dream! 等使用五位房间号的固车、冲榜群的 NoneBot 插件

Python >= 3.10 NoneBot >= 2.4.4 OneBot V11 Version 0.1.0 MIT License

适用范围 · 主要功能 · 快速开始 · 指令与效果 · 配置

本项目参考了 luban652 的 AstrBot 群名前缀插件的功能需求

🎯 适用范围

适合 PJSK、BanG Dream! 等使用五位数字房间号的固车、冲榜群。 群管理员开启后,在群内发送房间号,Bot 会移除群名中的旧号码,并把新号码放在群名开头; 发送 清空 可移除号码。插件依据群消息中的数字工作,不区分具体游戏。

✨ 主要功能

功能 行为
车牌改名 群内发送独立的连续五位数字(车牌),将其放在群名开头
清空车牌 发送 清空,移除群名中的连续五位及以上数字
按群开关 默认关闭,由群管理员及以上在目标群内开启或关闭
混合消息 数字或“清空”可与 @、图片、回复同条发送;数字不能被非文本消息段隔开
防止覆盖 同一群的改名串行处理,并有默认 1 秒操作冷却

🚀 快速开始

环境要求:

  • Python >= 3.10
  • NoneBot >= 2.4.4
  • OneBot V11 适配器
  • 机器人账号具备修改目标群名称的权限

将仓库放到 Bot 设备上,在该 Bot 的 Python 环境中运行:

pip install -e /path/to/nonebot-plugin-group-rename

上架 NoneBot 商店后,可在 Bot 项目中使用 NB-CLI 安装:

nb plugin install nonebot-plugin-group-rename

如果手动管理插件加载,请在 NoneBot 初始化后加载:

nonebot.load_plugin("nonebot_plugin_group_rename")

确认 Bot 已加载 OneBot V11 适配器,并在 COMMAND_START 中包含 /。随后由群管理员、群主或 SUPERUSER 在目标群发送 /group_rename on 或 /改群名 on。首次安装时所有群均关闭。


⌨️ 指令与效果

群开关

指令 权限 作用
/group_rename on 或 /改群名 on 群管理员、群主或 SUPERUSER 开启当前群
/group_rename off 或 /改群名 off 群管理员、群主或 SUPERUSER 关闭当前群
/group_rename status 或 /改群名 status 群管理员、群主或 SUPERUSER 查看当前群状态
12345 默认群成员;开启管理员限制后仅上述管理员 将 12345 设置为群名车牌
清空 默认群成员;开启管理员限制后仅上述管理员 从群名移除旧车牌

改名前后举例

原群名 群消息 修改后 原因
冲榜群 12345 12345 冲榜群 新增车牌
12345 冲榜群 67890 67890 冲榜群 替换旧车牌
1234567冲榜群 67890 67890 冲榜群 连续五位及以上数字整体移除
12345 冲榜群 清空 冲榜群 清除车牌
12345 67890 67890 原群名只剩车牌时仅替换
12345 清空 12345 清空会得到空群名,因此保留原名并提示先手动设置群名

发送 @某人 12345、[回复]12345 或 12345[图片] 仍可触发。12[图片]345、123456、文字 12345 和同一条消息里的两段非空文本不会触发。被 group_rename_ignore_patterns 忽略的数字也不会触发。


⚙️ 配置

不写配置文件即可使用默认参数,群开关仍默认关闭。 配置文件由 nonebot-plugin-localstore 管理。

JSON 参数 默认值 说明
group_rename_max_length 30 目标群名的最长字符数,最小为 5
group_rename_enable_notify true 冷却、读取或修改群名失败、仅剩车牌无法清空时发送提示
group_rename_admin_only false 开启后仅允许群管理员、群主或 SUPERUSER 通过车牌消息触发改名
group_rename_ignore_patterns [] 忽略的五位数字,使用 JSON 数组
group_rename_cooldown_seconds 1 每群改名尝试的冷却秒数

例如,在 config.json 中只填写需要覆盖的参数:

{
  "group_rename_admin_only": true,
  "group_rename_ignore_patterns": ["12345", "99999"]
}

群开关状态另存在 nonebot-plugin-localstore 管理的数据目录下的 groups.json,不与参数配置混用;换设备时复制该状态文件,或在目标群重新执行 /group_rename on。


📋 版本记录

0.1.0

  • 支持 OneBot V11 群内发送连续五位数字更新群名,发送“清空”移除旧号码;@、图片和回复可与号码同条发送。
  • 群开关默认关闭,由群管理员及以上在目标群管理;开关状态单独保存。
  • 同群改名串行处理,默认冷却 1 秒;号码与原群名之间保留空格,清空后群名为空时保留原名。
  • 使用独立 JSON 文件配置插件参数。

本项目代码采用 MIT License。

Metadata

Release files for nonebot-plugin-group-rename 0.1.0

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-group-rename 0.1.0
File Size Uploaded Provenance Actions
nonebot_plugin_group_rename-0.1.0.tar.gz 16.1 kB Without provenance Details for nonebot_plugin_group_rename-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nonebot-plugin-group-rename 0.1.0
File Interpreter ABI Platform Actions
nonebot_plugin_group_rename-0.1.0-py3-none-any.whl Python 3 none any Details for nonebot_plugin_group_rename-0.1.0-py3-none-any.whl

Total release size: 28.3 kB

Release files / nonebot_plugin_group_rename-0.1.0.tar.gz

Download URL nonebot_plugin_group_rename-0.1.0.tar.gz
Size 16.1 kB
Tags Source
SHA-256 checksum
How to use checksums
272c0335538015f1d8ad78c1fc37e7173055cf86d18eb43b857dd1ce7a85d553
BLAKE2b-256 checksum
How to use checksums
1e1538eccd1913a8eb61782fba60d757d8454958a2bc2b2798b9d40b7faf2985
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / nonebot_plugin_group_rename-0.1.0-py3-none-any.whl

Download URL nonebot_plugin_group_rename-0.1.0-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac596f2c9b5b5f8b09fb745ea01e84a354a0bc37a40f8e1ced9f4baeb7809f96
BLAKE2b-256 checksum
How to use checksums
f6a4042fbfd11a270fcd278364a2093c52814e37fde1910d2b67020abe0f08b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for nonebot-plugin-group-rename 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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