ThemisToDiscord
此前仅在 GitHub 和 SpigotMC 上提供,ThemisToDiscord 现已在 Modrinth 上发布!
向 Discord Webhook 发送嵌入式的 Themis 通知。
这是一个非官方插件,与 Themis 项目没有任何关联。
安装
依赖 Themis。如果你想在配置文件中使用的 %os% 占位符,你还需要 Floodgate。
- 将
ThemisToDiscord.jar 文件放入你的 /plugins 文件夹中。
- 启动或重启服务器。
- 运行
/ttd url <webhookUrl>(将 <webhookUrl> 替换为你的 webhook URL)。
- 如有必要,请通过
/ttd reload 修改来配置你的消息。
- 可选:通过运行相应的命令
/ttd msg <message> <player:player_name> <type:detection_type> [score:score] [ping:ping] [tps:tps] 测试你的消息,以确保设置正常运行。
处理机制
你可以创建任意数量你需要的/想要的消息。对于每条消息,你都有定义 处理机制 的选项。
为此,你使用与 Themis 配置中包含的相同阈值和延迟。
default:
# 定义 ThemisToDiscord 是否应处理发送此消息
# 如果将此消息的命令添加到你的 Themis action(s) 中,请禁用处理
Handling:
Enabled: true
# 发送到 Discord 的通知最低分数是多少?
execution-threshold: 10.0
# 需要发生多少新违规才会再次发送通知?
repetition-threshold: 5.0
# 需要经过多少时间才会再次发送通知?
repetition-delay: 10.0
如果缺少此选项或被禁用,ThemisToDiscord 将不会处理发送该消息。
这意味着发送消息的唯一方式是通过相应的命令:
/ttd msg <message> <player:player_name> <type:detection_type> [score:score] [ping:ping] [tps:tps]
让 Themis 处理消息的一个简单示例是:在 ThemisToDiscord 配置中禁用处理,然后将该消息的命令放置在类似如下的 Themis action 中:
actions:
# 此 action 的名称是什么?此名称必须是唯一的。
notify:
# Themis 运行此 action 的最低分数是多少?
execution-threshold: 10.0
# 需要发生多少新违规才会重复此 action?
repetition-threshold: 5.0
# 需要经过多少时间才会重复此 action?
repetition-delay: 10.0
# 应该运行哪些命令?你可以指定任意数量的命令,它们将按照列出的顺序运行。
# 目前,你可以使用以下占位符:%player_name%, %detection_type%, %score%, %ping%, %tps%
commands:
- "themis notify §5[Themis] §4%player_name% §cwas flagged for §4%detection_type% §chacks!\n§c[Score: §4%score% §c| Ping: §4%ping% §c| TPS: §4%tps%§c]"
- "ttd msg example player:%player_name% type:%detection_type% score:%score% ping:%ping% tps:%tps%"
JSON
你可以指定将通过 webhook URL 发送到 Discord 的实际 JSON 消息。这对于使用 设计消息非常有用。
一个小示例:
# 定义用于构建消息的 json 数据
# 如果你想使用 https://discohook.org/ 设计你的消息/嵌入,这很有用
# 如果提供了 json,则忽略所有其他选项
Json: >
{
"content": "Hello this is an example of including a JSON string!",
"embeds": [
{
"title": "JSON Example",
"description": "A little example of using JSON in a ThemisToDiscord message.",
"color": 5055373,
"fields": [
{
"name": "Example Field",
"value": "Did you know, all placeholders will work inside JSON too!",
"inline": true
},
{
"name": "Another Field",
"value": "This is another field!",
"inline": true
}
],
"author": {
"name": "%player_name%",
"icon_url": "%avatar_url%"
}
}
],
"attachments": []
}
需要注意的是,如果提供了 JSON,所有其他选项(除了 webhook URL)都将被忽略。
默认颜色
所有这些颜色都可以通过配置文件进行修改。
| 检查类型 |
十六进制颜色 |
文本颜色 |
| Boat Movement |
#875229 |
Light Brown |
| Flight / Y-Movement |
#3276bf |
Light Blue |
| Speed |
#d6e600 |
Neon Yellow |
| Spoofed Packets |
#ff0000 |
Neon Red |
| Timer / Blink |
#d61ad6 |
Neon Pink |
| Reach |
#6f1ad6 |
Neon Purple |
| Elytra Flight |
#afaeb0 |
Light Gray |
| Illegal Packets |
#141414 |
Black Shade |
示例嵌入(完全可修改)


替代方案
对于已安装 DiscordSRV 的服务器,本插件可能并非必需。
DiscordSRV 自带命令 /discordsrv broadcast [#频道ID/#频道名称] <消息>,相关文档见此处。
该命令可将消息发送至指定频道;若省略频道参数,则默认发送至主频道。
因此,你可以在 Themis 配置文件的 actions 键中添加以下内容,以接收基本的 Discord 通知。
actions:
# 动作的名称是什么?此名称必须是唯一的。
discord:
# Themis 运行此动作的最低分数是多少?
execution-threshold: 10.0
# 需要发生多少次新的违规才能重复执行此动作?
repetition-threshold: 5.0
# 需要经过多长时间才能重复执行此动作?
repetition-delay: 10.0
# 应该运行哪些命令?你可以指定任意数量的命令,它们将按列出的顺序依次执行。
# 目前,你可以使用以下占位符:%player_name%、%detection_type%、%score%、%ping%、%tps%
commands:
- "discordsrv broadcast #0000000000000000000 [Themis] **%player_name%** 因 *%detection_type%* 作弊行为被标记![分数: %score% | 延迟: %ping% | TPS: %tps%]"
你也可以简单地将该命令复制到任何现有的 Themis 动作中。
早在该插件创建之前,这种方法就已经广为人知。然而,并非所有服务器都使用 DiscordSRV,而 ThemisToDiscord 提供了更多的样式选项,包括通过 webhook 更改名称和头像,以及发送带有颜色编码的嵌入消息,而不是普通的通用消息。
ThemisToDiscord
Formerly only found on GitHub and SpigotMC, ThemisToDiscord is now available on Modrinth!
Sends an embedded Themis notification to a discord webhook.
This is an unofficial addon and is not affiliated with the Themis project in any compacity.
Installation
Depends on Themis. If you want to use the %os% placeholder in the config file you will also need Floodgate.
- Place the ThemisToDiscord.jar file in your /plugins folder.
- Start or restart the server
- Run
/ttd url <webhookUrl> (replace <webhookUrl> with your webhook url)
- Configure your messages if necessary following modifications with
/ttd reload
- Optionally, test your messages by running their respective commands
/ttd msg <message> <player:player_name> <type:detection_type> [score:score] [ping:ping] [tps:tps] to ensure the setup is functioning
Handling
You can create as many messages as you need/want. For each message you have the option to define the handling.
To do this, you use the same thresholds and delays included in the Themis configuration.
default:
# Define whether ThemisToDiscord should handle sending this message
# Disable handling if you add this message's command to your Themis action(s)
Handling:
Enabled: true
# What is the minimum score for a notification to be sent to the discord?
execution-threshold: 10.0
# What amount of new violations need to happen before another notification is sent?
repetition-threshold: 5.0
# What amount of time needs to pass before another notification is sent?
repetition-delay: 10.0
Should this option be missing or disabled, ThemisToDiscord will not handle sending the message.
This means the only way for the message to be sent would be the corresponding command:
/ttd msg <message> <player:player_name> <type:detection_type> [score:score] [ping:ping] [tps:tps]
A simple example of having Themis handle the message would be to disable handling in the ThemisToDiscord configuration and then place the message's command in a Themis action such as the following:
actions:
# What is the name of the action? This name needs to be unique.
notify:
# What is the minimum score for Themis to run this action?
execution-threshold: 10.0
# Which amount of new violations need to happen for this action to be repeated?
repetition-threshold: 5.0
# Which amount of time needs to pass for this action to be repeated?
repetition-delay: 10.0
# Which commands should be run? You can specify as many as you'd like which will be run in the order they're listed.
# Currently, you can use the following placeholders: %player_name%, %detection_type%, %score%, %ping%, %tps%
commands:
- "themis notify §5[Themis] §4%player_name% §cwas flagged for §4%detection_type% §chacks!\n§c[Score: §4%score% §c| Ping: §4%ping% §c| TPS: §4%tps%§c]"
- "ttd msg example player:%player_name% type:%detection_type% score:%score% ping:%ping% tps:%tps%"
JSON
You can specify the actual JSON message that will be sent to Discord via the webhook url. This is great for designing messages with .
A small example:
# Defines the json data used to construct the message
# This is useful if you want to design your message/embed with https://discohook.org/
# All other options are ignored if json is provided
Json: >
{
"content": "Hello this is an example of including a JSON string!",
"embeds": [
{
"title": "JSON Example",
"description": "A little example of using JSON in a ThemisToDiscord message.",
"color": 5055373,
"fields": [
{
"name": "Example Field",
"value": "Did you know, all placeholders will work inside JSON too!",
"inline": true
},
{
"name": "Another Field",
"value": "This is another field!",
"inline": true
}
],
"author": {
"name": "%player_name%",
"icon_url": "%avatar_url%"
}
}
],
"attachments": []
}
It is important to note that all other options (beside webhook urls) will be ignored should JSON be provided.
Default Colors
All of these colors can be modified via the config file.
| Check Type |
Hex Color |
Textual Color |
| Boat Movement |
#875229 |
Light Brown |
| Flight / Y-Movement |
#3276bf |
Light Blue |
| Speed |
#d6e600 |
Neon Yellow |
| Spoofed Packets |
#ff0000 |
Neon Red |
| Timer / Blink |
#d61ad6 |
Neon Pink |
| Reach |
#6f1ad6 |
Neon Purple |
| Elytra Flight |
#afaeb0 |
Light Gray |
| Illegal Packets |
#141414 |
Black Shade |
Example Embeds (Completely Modifiable)

Alternatives
For servers with DiscordSRV installed this plugin may not be necessary.
DiscordSRV comes with the command /discordsrv broadcast [#ChannelID/#ChannelName] <Message> documented here.
It allows dispatching a message to the specified channel or if omitted to the main channel.
Therefore, one could add the following to the actions key in their Themis configuration file to receive basic Discord notifications.
actions:
# What is the name of the action? This name needs to be unique.
discord:
# What is the minimum score for Themis to run this action?
execution-threshold: 10.0
# Which amount of new violations need to happen for this action to be repeated?
repetition-threshold: 5.0
# Which amount of time needs to pass for this action to be repeated?
repetition-delay: 10.0
# Which commands should be run? You can specify as many as you'd like which will be run in the order they're listed.
# Currently, you can use the following placeholders: %player_name%, %detection_type%, %score%, %ping%, %tps%
commands:
- "discordsrv broadcast #0000000000000000000 [Themis] **%player_name%** was flagged for *%detection_type%* hacks! [Score: %score% | Ping: %ping% | TPS: %tps%]"
You could simply copy the command to any existing Themis action as well.
This method was known well before the creation of this plugin. However, not all servers use DiscordSRV and ThemisToDiscord provides far more styling options including changing the name and avatar via webhook and sending color-coded embedded messages instead of plain generic ones.
评论 0
登录后参与评分
还没有评论,来抢沙发吧