Yurushi
适用于 Fabric 的 Discord 集成白名单模组。简化你的服务器访问管理。
功能特性
- Discord 集成: 玩家通过 Discord 表单(Modal)申请白名单权限。
- 一键审批: 管理员可以直接在 Discord 中通过单击按钮来批准或拒绝请求。
- 自动通信:
- 在批准或拒绝后向玩家发送私聊消息。
- 更新原始请求消息以反映决定结果。
- 自定义消息: 通过
messages.toml 完全可配置的文本和嵌入样式。
- 基于角色的访问控制: 使用
whitelistRole 将白名单管理限制为特定的 Discord 角色。
- 调试工具: 使用
/debug embeds 可视化你的嵌入配置。
配置
配置文件位于 config/Yurushi/ 目录下。
Yurushi.toml
主插件配置文件。
| 配置项 |
类型 |
描述 |
botToken |
String |
你的 Discord 机器人令牌 (Bot Token) |
adminChannelId |
String |
接收请求的 Discord 文本频道 ID |
whitelistRole |
List |
允许批准/拒绝请求的角色 ID 列表 |
Yurushi.toml
botToken = "YOUR_BOT_TOKEN_HERE"
adminChannelId = "123456789012345678"
whitelistRole = ["987654321098765432", "112233445566778899"]
messages.toml
自定义所有机器人消息、嵌入内容和按钮标签。支持占位符,如 {minecraft_username}、{reason} 等。(并非所有消息都支持这些占位符)。
messages.toml
[error]
no_permission = "❌ 你没有执行此操作的权限。"
server_unavailable = "❌ 服务器不可用。请稍后再试。"
unexpected = "❌ 发生了一个意外错误。"
admin_channel_not_found = "发生错误。请联系管理员。"
[button]
[button.approve]
label = "批准"
success = "✅ `{minecraft_username}` 的白名单请求已被批准!\n**UUID:** `{uuid}`"
already_whitelisted = "⚠️ `{minecraft_username}` 已经在服务器白名单中。"
player_not_found = "❌ 未在 Mojang 服务器上找到玩家 `{minecraft_username}`。\n该用户名可能不正确或不存在。"
failed = "❌ 未能将 `{minecraft_username}` 加入白名单。\n错误:{error}"
[button.deny]
label = "拒绝"
success = "`{minecraft_username}` 的白名单请求已被拒绝。\n**原因:** {reason}"
[embed]
[embed.request]
title = "? 白名单申请"
footer = "用户 ID: {user_id}"
[embed.request.fields]
discord_user = "Discord 用户"
minecraft_username = "Minecraft 用户名"
description = "描述"
description_empty = "*未提供描述*"
[embed.approved]
title = "✅ 白名单申请 - 已批准"
footer = "你现在可以加入服务器了!"
[embed.approved.fields]
approved_by = "由...批准"
[embed.already_whitelisted]
title = "⚠️ 白名单申请 - 已在白名单中"
footer = "该玩家已在白名单中。"
[embed.denied]
title = "❌ 白名单申请 - 已拒绝"
footer = "如有问题,请联系管理员。"
[embed.denied.fields]
reason = "原因"
denied_by = "由...拒绝"
[dm]
[dm.approved]
title = "✅ 白名单申请已批准"
description = "恭喜!你的白名单申请已获得批准。"
[dm.denied]
title = "❌ 白名单申请已拒绝"
description = "很遗憾,你的白名单申请已被拒绝。"
[modal]
[modal.register]
title = "白名单注册"
success = "你的白名单请求已提交!"
[modal.register.inputs]
username_label = "Minecraft 用户名"
username_placeholder = "输入你的 Minecraft 用户名"
description_label = "描述(可选)"
description_placeholder = "介绍一下你自己,或者说明你想加入的原因..."
[modal.deny]
title = "拒绝白名单申请"
[modal.deny.inputs]
reason_label = "拒绝原因"
reason_placeholder = "提供拒绝白名单申请的理由..."
reason_empty = "*未提供理由*"
使用方法
前提条件
- 运行 Fabric 并安装了 Yurushi 模组的 Minecraft 服务器。
- 一个 Discord 机器人,具备以下设置:
- 机器人令牌 (Bot Token)(来自 Discord 开发者门户)
- 启用了
Server Members Intent(特权网关意图)
- 已邀请至你的 Discord 服务器,并具有
applications.commands 和 bot 作用域
安装步骤
- 从 Releases 下载模组 JAR 文件。
- 将其放入服务器的
mods/ 文件夹中。
- 启动服务器一次,以便在
config/Yurushi/ 中生成默认配置文件。
- 停止服务器,并在
Yurushi.toml 中配置你的机器人令牌和频道设置。
- 重新启动服务器 —— Discord 机器人将自动上线。
Discord 机器人设置
- 前往 Discord Developer Portal 并创建一个新的应用程序。
- 导航到 Bot → Reset Token 以获取你的机器人令牌。
- 在 Privileged Gateway Intents(特权网关意图)下启用 Server Members Intent。
- 进入 OAuth2 → URL Generator,选择
bot 和 Administrator 作用域。
- 复制生成的 URL 并将机器人邀请到你的服务器。
- 将机器人令牌粘贴到
Yurushi.toml 中的 botToken 字段。
玩家操作流程
玩家可以直接在 Discord 中申请白名单权限:
- 在任何机器人可见的频道中使用
/register 斜杠命令。
- 将出现一个模态框,要求填写:
- Minecraft 用户名(必填)
- 描述(可选)—— 自我介绍或解释你想加入的原因。
- 提交后,会出现确认消息,并且请求将被发送到管理员频道。
管理员操作流程
拥有配置好的 whitelistRole 的管理员可以管理请求:
- 白名单申请会在配置的
adminChannelId 频道中显示,并附带 批准 和 拒绝 按钮。
- 点击 批准 将执行以下操作:
- 将该玩家添加到 Minecraft 服务器白名单中。
- 向该玩家发送私信通知其申请已获批准。
- 更新申请嵌入卡片以显示“已批准”状态。
- 点击 拒绝 将执行以下操作:
- 打开一个模态框用于输入拒绝原因。
- 向该玩家发送包含拒绝原因的私信。
- 更新申请嵌入卡片以显示“已拒绝”状态。
命令
Discord 斜杠命令
| 命令 |
描述 |
/register |
为玩家打开白名单注册表单 |
/debug embeds |
预览所有已配置的嵌入样式(仅限管理员) |
/ping |
检查机器人是否在线 |
Minecraft 命令
| 命令 |
权限 |
描述 |
/yurushi reload |
yurushi.command.reload (OP 等级 3+) |
无需重启服务器即可重新加载配置文件 |
Bug 报告与建议
如果您遇到任何错误或有改进建议,请在 GitHub Issues 页面上提交问题。
Yurushi
Discord Integration Whitelist Mod for Fabric. Simplify your server access management.
Features
- Discord Integration: Players request whitelist access via a Discord form (Modal).
- One-Click Approval: Admins can approve or deny requests directly from Discord with a single button click.
- Automated Communication:
- Sends a DM to the player upon approval or denial.
- Updates the original request message to reflect the decision.
- Customizable Messages: Fully configurable text and embed styles via
messages.toml.
- Role-Based Access: Restrict whitelist management to specific Discord roles using
whitelistRole.
- Debug Tools: Visualize your embed configurations with
/debug embeds.
Config
Configuration files are located in config/Yurushi/.
Yurushi.toml
Main plugin configuration.
| Config |
Type |
Description |
botToken |
String |
Your Discord Bot Token |
adminChannelId |
String |
ID of the Discord text channel where requests are sent |
whitelistRole |
List |
List of Role IDs allowed to approve/deny requests |
Yurushi.toml
botToken = "YOUR_BOT_TOKEN_HERE"
adminChannelId = "123456789012345678"
whitelistRole = ["987654321098765432", "112233445566778899"]
messages.toml
Customize all bot messages, embeds, and button labels. Supports placeholders like {minecraft_username}, {reason}, etc. (Might not available in all messages).
messages.toml
[error]
no_permission = "❌ You don't have permission to perform this action."
server_unavailable = "❌ Server is not available. Please try again later."
unexpected = "❌ An unexpected error occurred."
admin_channel_not_found = "An error occurred. Please contact an administrator."
[button]
[button.approve]
label = "Approve"
success = "✅ Whitelist request for `{minecraft_username}` has been approved!\n**UUID:** `{uuid}`"
already_whitelisted = "⚠️ `{minecraft_username}` is already whitelisted on the server."
player_not_found = "❌ Player `{minecraft_username}` was not found on Mojang's servers.\nThis username might be incorrect or doesn't exist."
failed = "❌ Failed to whitelist `{minecraft_username}`.\nError: {error}"
[button.deny]
label = "Deny"
success = "Whitelist request for `{minecraft_username}` has been denied.\n**Reason:** {reason}"
[embed]
[embed.request]
title = "? Whitelist Request"
footer = "User ID: {user_id}"
[embed.request.fields]
discord_user = "Discord User"
minecraft_username = "Minecraft Username"
description = "Description"
description_empty = "*No description provided*"
[embed.approved]
title = "✅ Whitelist Request - Approved"
footer = "You can now join the server!"
[embed.approved.fields]
approved_by = "Approved By"
[embed.already_whitelisted]
title = "⚠️ Whitelist Request - Already Whitelisted"
footer = "This player is already whitelisted."
[embed.denied]
title = "❌ Whitelist Request - Denied"
footer = "Please contact an administrator if you have questions."
[embed.denied.fields]
reason = "Reason"
denied_by = "Denied By"
[dm]
[dm.approved]
title = "✅ Whitelist Request Approved"
description = "Congratulations! Your whitelist request has been approved."
[dm.denied]
title = "❌ Whitelist Request Denied"
description = "Unfortunately, your whitelist request has been denied."
[modal]
[modal.register]
title = "Whitelist Registration"
success = "Your whitelist request has been submitted!"
[modal.register.inputs]
username_label = "Minecraft Username"
username_placeholder = "Enter your Minecraft username"
description_label = "Description (Optional)"
description_placeholder = "Tell us a bit about yourself or why you want to join..."
[modal.deny]
title = "Deny Whitelist Request"
[modal.deny.inputs]
reason_label = "Denial Reason"
reason_placeholder = "Provide a reason for denying the whitelist request..."
reason_empty = "*No reason provided*"
How to Use
Prerequisites
- A Minecraft server running Fabric with the Yurushi mod installed.
- A Discord Bot with the following:
- Bot Token (from Discord Developer Portal)
Server Members Intent enabled (Privileged Gateway Intents)
- Invited to your Discord server with
applications.commands and bot scopes
Installation
- Download the mod JAR from Releases.
- Place it in your server's
mods/ folder.
- Start the server once to generate default config files in
config/Yurushi/.
- Stop the server and configure
Yurushi.toml with your bot token and channel settings.
- Restart the server — the Discord bot will come online automatically.
Discord Bot Setup
- Go to Discord Developer Portal and create a new application.
- Navigate to Bot → Reset Token to get your bot token.
- Enable Server Members Intent under Privileged Gateway Intents.
- Go to OAuth2 → URL Generator, select
bot and Administrator scopes.
- Copy the generated URL and invite the bot to your server.
- Paste the bot token in
Yurushi.toml (botToken).
Player Workflow
Players can request whitelist access directly from Discord:
- Use the
/register slash command in any channel the bot can see.
- A modal will appear asking for:
- Minecraft Username (required)
- Description (optional) – introduce yourself or explain why you want to join.
- After submitting, a confirmation message appears, and the request is sent to the admin channel.
Admin Workflow
Admins with the configured whitelistRole can manage requests:
- Whitelist requests appear in the configured
adminChannelId with Approve and Deny buttons.
- Click Approve to:
- Add the player to the Minecraft server whitelist.
- Send a DM to the player notifying them of approval.
- Update the request embed to show "Approved" status.
- Click Deny to:
- Open a modal to enter a denial reason.
- Send a DM to the player with the reason.
- Update the request embed to show "Denied" status.
Commands
Discord Slash Commands
| Command |
Description |
/register |
Opens the whitelist registration form for players |
/debug embeds |
Preview all configured embed styles (Admin only) |
/ping |
Check if the bot is online |
Minecraft Commands
| Command |
Permission |
Description |
/yurushi reload |
yurushi.command.reload (OP Level 3+) |
Reload configuration files without restarting the server |
Bug Reports & Suggestions
If you encounter any bugs or have suggestions for improvements, please open an issue on the GitHub Issues page.
评论 0
登录后参与评分
还没有评论,来抢沙发吧