Skip to main content

一款适用于QQ群的谁是卧底小游戏插件

Project description

NoneBotPluginLogo

NoneBotPluginText

nonebot-plugin-who-is-spy

✨ 一个谁是卧底小游戏插件 ✨

license pypi python

一个基于 NoneBot2 的群聊游戏插件 —— 谁是卧底
支持 群聊轮流发言 + 私聊匿名投票,带有胜场统计、排行榜、胜率榜等功能。

📖 介绍

nonebot-plugin-who-is-spy 是一个基于 NoneBot2 开发的多人群聊游戏插件,复刻了经典的 谁是卧底 桌游玩法。
它支持在 QQ 群里发起游戏,玩家轮流发言,通过私聊匿名投票淘汰嫌疑人,直到一方胜利。

特点:

  • 规则完整:平民、卧底、白板三种身份,还原线下游戏体验
  • 私聊投票:保护投票隐私,避免被针对
  • 自动化流程:发言、投票、淘汰、胜负判定全程自动进行
  • 数据统计:记录胜场、参与次数,支持排行榜与胜率榜
  • 可定制化:词库、玩家人数、白板开关、身份提示等均可配置

💿 安装

使用 nb-cli 安装 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
nb plugin install nonebot-plugin-who-is-spy
使用包管理器安装 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
pip
pip install nonebot-plugin-who-is-spy
pdm
pdm add nonebot-plugin-who-is-spy
poetry
poetry add nonebot-plugin-who-is-spy
conda
conda install nonebot-plugin-who-is-spy

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

plugins = ["nonebot_plugin_template"]

⚙️ 配置

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

配置项 必填 默认值 说明
spy_min_players 4 最少人数
spy_max_players 12 最大人数
spy_default_undercovers 1 默认卧底人数
spy_allow_blank True 是否允许白板
spy_show_role_default False 发词时是否显示身份

📂 词库

插件的词库文件使用 JSON 格式,存放在:

template/undercover_words.json

文件内容是一个二维数组,每一项是一个词对,格式为:

[
  ["平民词", "卧底词"],
  ["苹果", "香蕉"],
  ["猫", "狗"],
  ["飞机", "火车"]
]

运行 nb localstore 来获取数据路径,将词库文件放在 Data Dir 下名为 nonebot_plugin_who_is_spy 的文件夹内。

例如Windows下,使用 "C:\Users\***\AppData\Local\nonebot2\nonebot_plugin_who_is_spy\undercover_words.json" 作为词库路径

🎉 使用

指令

  • 在群内发送 卧底帮助 即可获取帮助
🎮 谁是卧底 - 群聊版玩法说明
——————————
【开局】
卧底开局 [卧底人数] [blank]   创建房间(可选参数:卧底人数,blank=有白板)
加入    进入房间
发身份  房主开始游戏并私聊词语

【发言阶段】
- 系统会在群里公布发言顺序
- 轮到谁,谁直接在群里说一句描述
- 每人一句话,依次发完自动进入投票

【投票阶段(私聊进行)】
- 机器人私聊存活玩家投票序号列表
- 私聊直接回复数字:0=弃权,数字=投票对象

【胜负判定】
- 卧底全出局  平民胜利
- 卧底数≥平民数  卧底胜利

【常用指令】
状态    查看当前局势和投票序号
复盘    查看上一局记录
结束卧底  强制结束当前局
身份提示 开/关  设置私聊是否提示身份
卧底帮助  查看本说明
胜率榜 / 我的胜率  查看胜率 

效果图

alt text

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_who_is_spy-0.0.4.tar.gz (27.6 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_who_is_spy-0.0.4-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_who_is_spy-0.0.4.tar.gz.

File metadata

File hashes

Hashes for nonebot_plugin_who_is_spy-0.0.4.tar.gz
Algorithm Hash digest
SHA256 b93beb5a5e6dfcdf4893ef04815a1188964f7d5c546b8618456c7c67c07500d5
MD5 e3e163aa3c7dea78822c65a3050cfd9e
BLAKE2b-256 8c3cf74697dd0756458e70dacb5376cdd438fa16f5b8ce863882d474bb9c7e67

See more details on using hashes here.

Provenance

The following attestation bundles were made for nonebot_plugin_who_is_spy-0.0.4.tar.gz:

Publisher: pypi-publish.yml on Hanserprpr/nonebot-plugin-who-is-spy

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_who_is_spy-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_who_is_spy-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 726fc758ab6e0b35317a0ddab20dced66c63ac5380a49c803e4314dccb8d2633
MD5 915ba79f60ffbd143c018d6e59327101
BLAKE2b-256 fdff17e2ffbbe0b4c64d28d82115b7e11c8639ec8a3c6d4bf2c3eeeafc391e46

See more details on using hashes here.

Provenance

The following attestation bundles were made for nonebot_plugin_who_is_spy-0.0.4-py3-none-any.whl:

Publisher: pypi-publish.yml on Hanserprpr/nonebot-plugin-who-is-spy

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