DiSky
DiSky 是一个 Skript 插件,允许你在 Minecraft 服务器中使用 Skript 编写 Discord 机器人。它基于 JDA 构建:任何 JDA 机器人能做的事,DiSky 都力求通过 Skript 语法暴露出来。
此分支是 DiSky 5,是对 DiSky 4 的重写。目前处于公开测试阶段:DiSky 4 的大部分内容已涵盖,语法相近但并非完全相同,且 V4 脚本需要进行少量更改(请参阅迁移指南)。
- 语法参考:atlas.disky.me
- 移植 DiSky 4 脚本:迁移指南
- 下载:Modrinth
- Bug 报告与功能请求:GitHub issues
要求
- Paper 服务器,1.21.5 或更高版本(或 Purpur 等 Paper 分支)
- Java 21 或更高版本
- Skript 2.16.1 或更高版本,且其
config.sk中开启了use type properties: true(默认设置) - 来自 Discord Developer Portal 的机器人令牌(token)
安装
- 将
DiSky-<version>.jar放入服务器的plugins/文件夹中,与 Skript 放在一起。 - 重启服务器。
DiSky 没有配置文件。每次启动时,它会写入 plugins/DiSky/disky-syntax.json,列出它注册的所有语法;你无需触碰该文件。
匿名统计信息 (FastStats)
DiSky 会向 FastStats 报告匿名使用统计信息和错误。首次启动期间不会发送任何数据:提交操作在下次重启后开始,因此你可以在之前选择退出。
发送的内容包括:
- 使用情况:一个随机生成的服务器 ID(如果删除则会重新生成)、DiSky 版本、Minecraft 版本、服务器软件及其版本、在线模式、玩家数量、Java 供应商及版本、操作系统名称、版本和架构,以及 CPU 核心数。
- 错误:运行时由 DiSky 语法引发的错误(异常类型、截断至 500 字符的消息以及缩短后的堆栈跟踪)。
不会收集任何 IP 地址、玩家数据、机器人令牌、Discord 内容或脚本源代码。
若要选择退出,请编辑 plugins/faststats/config.properties(所有使用 FastStats 的插件共享此文件)并重启:
enabled=false将完全关闭 FastStats;submitMetrics=false仅停止使用统计信息的提交;submitErrors=false仅停止错误报告的提交。
JVM 参数 -Dfaststats.enabled=false 也能将其关闭。
第一个机器人
将此代码保存为 plugins/Skript/scripts/bot.sk,在其中填入你的令牌,然后运行 /sk reload bot:
options:
token: "YOUR-BOT-TOKEN"
on load:
set {_bot} to a new discord bot
set token of {_bot} to {@token}
login {_bot} as "my-bot"
on unload:
shutdown the bot named "my-bot"
# Slash commands are declared in the script, then sent to Discord explicitly.
on guild ready:
update the discord commands (all structured application commands) in event-guild
slash command ping:
description: Check that the bot is alive
trigger:
reply with hidden "Pong!"
slash command ban <target: member> [<reason: string>]:
description: Ban a member
enabled for: ban members
trigger:
try:
ban {_target} because of {_reason}
catch {_errors::*} and stop:
reply with hidden "Could not ban %{_target}%: %error meaning of {_errors::1}%"
reply with hidden "%{_target}% was banned."
on message received seen by "my-bot":
discord content of event-message is "!about"
set {_e} to a new discord embed
set title of {_e} to name of event-guild
set description of {_e} to "%member count of event-guild% members"
set color of {_e} to orange
reply with {_e}
hidden 使回复仅对运行命令的用户可见。如果封禁失败(缺少权限、成员等级高于机器人),catch 块会获取可读的错误信息,而不是控制台中的堆栈跟踪。
你能做什么
- 机器人:同时运行多个机器人、意图(intents)、缓存设置、分片(sharding)、状态显示(presence)。
- 消息:发送、回复、编辑、删除、置顶、反应、读取历史记录;嵌入(embeds)、文件上传和下载、投票。
- 命令:带有类型化选项、自动补全、子命令、冷却时间和翻译的斜杠命令;用户和消息(右键单击)命令;带有前缀的经典文本命令。
- 组件:按钮、选择菜单、模态框(modals),以及较新的布局组件(容器、部分、画廊)。
- 服务器管理:成员、角色及其排序、频道和线程、权限和频道覆盖、表情符号和贴纸、邀请链接、预定事件、欢迎界面、AutoMod 规则、Webhook。
- Moderation:封禁、踢出、超时、清理、审计日志原因。
- 事件:约 130 个 Discord 事件,从消息和反应到语音、角色和 AutoMod。
Atlas 列出了每种语法的模式及示例。
与纯 Skript 不同的三件事
与 Discord 通信需要时间。 任何向 Discord 发送内容的操作(发布消息、封禁成员)都在服务器线程之外运行,因此你的服务器永远不会因为等待 Discord 而卡顿。DiSky 内存中已有的值会直接读取;需要向 Discord 查询的值则需使用 await 读取,这会等待响应:
await set {_bans::*} to bans of event-guild
在不使用 await 的情况下读取此类值会在脚本加载时报错,而不是静默返回 <none>。
构建器(Builders)。 要在 Discord 上创建某物(如角色、频道或多部分消息),你先填充一个构建器,然后再发送:
set {_b} to a new role builder named "Helpers" in event-guild
set color of {_b} to light blue
await set {_role} to the build result of {_b}
错误处理。 失败的 Discord 操作会将可读的消息打印到控制台中。你可以将其放在 try 块中以自行处理,如上文的 ban 命令所示,或者监听 on discord error 来捕获未被任何 try 处理的错误。
来自 DiSky 4
DiSky 5 取代 DiSky 4:插件名称相同,Modrinth 页面不变,依赖 DiSky 的附加组件仍可正常使用其名称。V4 脚本无法直接运行。
在切换机器人之前,请先阅读 Atlas 上的 迁移指南。 该指南提供了脚本移植的步骤顺序、每项变更的前后对比示例(如 retrieve 变为 await、构建器、discord 前缀、命令、组件、事件等),以及 DiSky 5 尚未包含的功能列表。
从源代码构建
./gradlew build
需要 JDK 21。生成的插件文件为 build/libs/DiSky-<version>.jar(旁边的 -thin jar 不包含 JDA,因此无法加载)。
许可证
Apache License 2.0
DiSky
DiSky is a Skript addon for writing Discord bots in Skript, on your Minecraft server. It is built on JDA: anything a JDA bot can do, DiSky aims to expose as Skript syntax.
This branch is DiSky 5, a rewrite of DiSky 4. It is in public beta: most of DiSky 4 is covered, the syntax is close but not identical, and V4 scripts need a few changes (see the migration guide).
- Syntax reference: atlas.disky.me
- Porting DiSky 4 scripts: migration guide
- Download: Modrinth
- Bugs and requests: GitHub issues
Requirements
- A Paper server, 1.21.5 or newer (or a Paper fork such as Purpur)
- Java 21 or newer
- Skript 2.16.1 or newer, with
use type properties: truein itsconfig.sk(the default) - A bot token from the Discord Developer Portal
Installation
- Put
DiSky-<version>.jarin your server'splugins/folder, next to Skript. - Restart the server.
DiSky has no config file. At each boot it writes plugins/DiSky/disky-syntax.json, a list of every syntax it registered; you don't need to touch it.
Anonymous statistics (FastStats)
DiSky reports anonymous usage statistics and errors to FastStats. Nothing is sent during the first start: submission begins after the next restart, so you can opt out beforehand.
What is sent:
- Usage: a random server id (regenerated if you delete it), the DiSky version, the Minecraft version, the server software and its version, online mode, the player count, the Java vendor and version, the OS name, version and architecture, and the CPU core count.
- Errors: errors raised by DiSky syntaxes at runtime (the exception type, its message truncated to 500 characters and a shortened stack trace).
No IP address, player data, bot token, Discord content or script source is collected.
To opt out, edit plugins/faststats/config.properties (shared by every plugin that uses FastStats) and restart:
enabled=falseturns FastStats off entirely;submitMetrics=falsestops usage statistics only;submitErrors=falsestops error reports only.
The JVM flag -Dfaststats.enabled=false also turns it off.
A first bot
Save this as plugins/Skript/scripts/bot.sk, put your token in it, and run /sk reload bot:
options:
token: "YOUR-BOT-TOKEN"
on load:
set {_bot} to a new discord bot
set token of {_bot} to {@token}
login {_bot} as "my-bot"
on unload:
shutdown the bot named "my-bot"
# Slash commands are declared in the script, then sent to Discord explicitly.
on guild ready:
update the discord commands (all structured application commands) in event-guild
slash command ping:
description: Check that the bot is alive
trigger:
reply with hidden "Pong!"
slash command ban <target: member> [<reason: string>]:
description: Ban a member
enabled for: ban members
trigger:
try:
ban {_target} because of {_reason}
catch {_errors::*} and stop:
reply with hidden "Could not ban %{_target}%: %error meaning of {_errors::1}%"
reply with hidden "%{_target}% was banned."
on message received seen by "my-bot":
discord content of event-message is "!about"
set {_e} to a new discord embed
set title of {_e} to name of event-guild
set description of {_e} to "%member count of event-guild% members"
set color of {_e} to orange
reply with {_e}
hidden makes a reply visible only to the user who ran the command. If the ban fails (missing permission, member above the bot), the catch block gets a readable error instead of a stack trace in the console.
What you can do
- Bots: several bots at once, intents, cache settings, sharding, presence.
- Messages: send, reply, edit, delete, pin, react, read history; embeds, file uploads and downloads, polls.
- Commands: slash commands with typed options, autocomplete, subcommands, cooldowns and translations; user and message (right-click) commands; classic text commands with a prefix.
- Components: buttons, select menus, modals, and the newer layout components (containers, sections, galleries).
- Server management: members, roles and their order, channels and threads, permissions and channel overrides, emotes and stickers, invites, scheduled events, welcome screen, AutoMod rules, webhooks.
- Moderation: ban, kick, timeout, purge, audit log reasons.
- Events: about 130 Discord events, from messages and reactions to voice, roles and AutoMod.
The Atlas lists every syntax with its patterns and examples.
Three things that differ from plain Skript
Talking to Discord takes time. Anything that sends something to Discord (posting a message, banning a member) runs off the server thread, so your server never lags waiting for Discord. Values DiSky has in memory are read directly; values it has to ask Discord for are read with await, which waits for the answer:
await set {_bans::*} to bans of event-guild
Reading such a value without await is an error when the script loads, not a silent <none>.
Builders. To create something on Discord (a role, a channel, a message with several parts), you fill a builder first, then send it:
set {_b} to a new role builder named "Helpers" in event-guild
set color of {_b} to light blue
await set {_role} to the build result of {_b}
Errors. A failed Discord action prints a readable message to the console. Put it in a try block to handle it yourself, as in the ban command above, or listen to on discord error to catch the ones no try handled.
Coming from DiSky 4
DiSky 5 replaces DiSky 4: same plugin name, same Modrinth page, and addons that depend on DiSky keep working by name. V4 scripts do not run as-is.
Read the migration guide on the Atlas before switching a bot over. It gives the order to port a script in, before/after examples for every change (retrieve becoming await, builders, the discord prefix, commands, components, events), and the list of what DiSky 5 does not have yet.
Building from source
./gradlew build
Needs JDK 21. The plugin is build/libs/DiSky-<version>.jar (the -thin jar next to it does not contain JDA and will not load).
License
Apache License 2.0
下载 DiSky
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 DiSky
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 DiSky
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 DiSky
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 DiSky
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 DiSky
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 DiSky
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 DiSky
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 DiSky
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 DiSky
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
功能特性
- 实时实体设置器、消息频道、通用频道获取器、V4 活动,重新登录会关闭之前的机器人 (caaa764)
修复内容
- 语法冲突检查不再阻止 DiSky 启用 (3a79a6d)
- 自动 moderation 执行事件中可读的 automod 执行记录 (d427d09)
- 反应添加/移除事件中可读的反应表情符号 (3897707)
- 实体的 V4 字符串显示,频道更新事件的 Skript 类型 (5b38161)
- 重定位阴影依赖项,空安全的成员语音频道,确定性的默认机器人 (67ac41f)
首次发布 DiSky V5:所有语法均在 Atlas 上列出,。
大家好!带来了一个相当充实的更新 ?
特别感谢 @P0wders 处理了本次版本中的大量 PR(包括斜杠命令 ID、活动与主要公会事件等)!
✨ 新功能 预定事件 全面支持 Discord 的预定事件!
11 个新事件:创建、删除、用户订阅/取消订阅,以及名称/描述/位置/开始和结束时间/状态/封面图片的更新。状态更新可用于检测事件的开始或结束。 新增预定事件描述和预定事件跳转 URL 属性。 ⚠️ 需要 SCHEDULED_EVENTS 意图 + 缓存标志(默认均为关闭)!
? 活动与丰富状态显示 成员活动(%member% 的活动):成员的当前所有活动(游戏、直播、自定义状态……)。 10 个新活动属性:详情、状态、大/小图片 URL 及悬停文本、队伍大小/最大人数、开始/结束时间戳。 新增用户活动开始 / 用户活动结束事件。 ⚠️ 需要 GUILD_PRESENCES 意图 + ACTIVITY 缓存标志!
? 更多属性与条件 成员颜色(%member% 的颜色):成员最高非默认角色的 RoleColors。 邀请创建日期(仅限扩展邀请信息!)。 用户是否显示服务器标签条件。 新增用户主要公会更新事件(过去/新的主要公会 ID 及用户标签)。 在斜杠命令事件中添加了斜杠命令 ID 表达式。 ?️ 获取投票选民 新增获取投票选民效果:获取对给定投票答案投了票的人(通过位置或 pollanswer)。只需传入投票的消息,机器人重新绑定处理方式与 retrieve message 相同。 ? 音频:重要的 DAVE 更新 自 2026 年 3 月 1 日起,Discord 强制实施 DAVE(音视频端到端加密);否则音频连接将无法工作。DiSky 现已自动集成该功能。
⚠️ macOS 不受 DAVE 支持(仅支持 Linux 和 Windows)。如果您的机器人使用语音功能,强烈建议更新!
改进 has role 和 bot-in-thread 条件现在接受列表并支持正确的否定形式(isn't, doesn't have...)。 discord id 现在可在 pollanswer 对象上使用。 大规模文档审查 + 更清晰的生成文档(现包含线程状态)。 完整变更日志:4.28.0...4.29.0
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
插件
PacketEvents 是一款专为 Minecraft Java 版打造的协议库,旨在简化数据包的处理与传输。
插件
ExyliaPlugins 的库。
插件
通过对话框或铁砧界面帮助你的 Anthme
插件
重新定义服务器上的生物运输方式。使用高度可定制的口袋道具,安全地捕获、存储和释放任何实体。
插件
为基于 Spigot/Paper/Folia 的服务器添加对 Vivecraft 的支持
插件
用于绘制游戏内地图或在浏览器中随探索实时进行地图绘制的实时地图。
评论 0
登录后参与评分
还没有评论,来抢沙发吧