Chat Filter

插件

· 作者 Tesla6426

一款简单但高度可配置的插件,用于过滤服务器聊天内容。应与大多数聊天插件兼容。

0 本站下载 0 关注 更新于 1 年前

最新 1.0.0 · 1.21.5 · Bukkit / Paper

一键开服(送7天)

聊天过滤器

简介

Chat Filter 是一款简单但高度可配置的插件,它使用正则表达式来扫描和处理消息。它支持无限数量的类别中的无限数量模式,每个类别在匹配时都可以执行命令并通知相应的管理人员。

功能:

  • 静音和取消静音玩家
  • 无限数量的过滤类别
  • 每个类别拥有无限的正则表达式模式
  • 根据匹配的类别执行命令
  • 记录违反过滤规则的行为并提供 Discord 链接
  • 内置性能分析器以进行优化
  • 与其他聊天插件广泛兼容
  • 所有配置均可自定义

试用 GlowCraft 的过滤器

config.yml
# Chat Filter by _txsla and NBT Archives
# This plugin uses MiniMessage to parse messaged
# https://docs.advntr.dev/minimessage


# [   REGISTER FILTER CATEGORIES ]
# Add a category here to register it
# The plugin will not recognize categories that are not listed here
# Permission 'chatfilter.filter.bypass' will bypass these filters
# It is recommended that you put more important categories first on the list.
# Messages are filtered from first category in this list to last, so if two filters both match the pattern [a-zA-Z]\.(\.com|\.net), only the one listed first will be triggered
# The 'gamersafer' list is the official list of GamerSafer.com
registered-categories:
  - 'demo-websites'
  - 'demo-all_caps'
  - 'gamersafer'


# [  SPAM LIMITER   ]
# Every time a player sends a message, it increments a counter
# Every x milliseconds that counter is decremented
# If a player hits the max messages on their counter, their messages are not shown to other players
# Permission `chatfilter.spam.bypass` will bypass this limiter
spam-limiter:
  enabled: true
  ghost: true # send player their own messages, so they do not know they are muted
  count-repeats: true # should repeat messages increment twice? ADD THIS LATER
  counter-ceiling: 5 # if a player's message counter goes above this number, their messages will be hidden to other players
  decrement-timer: 3000 # milliseconds between message counter decrements
  ghost-player: true # should we show the player their cancelled message, so they do not know they are currently muted?


# This is the message format sent to ghosted players.
# Can also be used to tell players to slow down
# Placeholders:
# %PLAYER% - player who sent the message
# %MESSAGE% - player's message
# %SERVER% - server that player is in
# %WORLD% - world that player is on
ghost-format: "[GHOSTED] <white><%PLAYER%> %MESSAGE%</white>"

# Server Mute settings
# Muted players' messages can not be s
mute:
  # should mods be required ot provide a reason?
  require-reason: true
  # show muted player's their messages
  ghost-player: true


# [   NOTIFY   ]
# Notify a player when someone triggers a filter
# Players with permission 'chatfilter.notify' will be notified
# Placeholders:
# %PLAYER% - violator's username
# %MESSAGE% - message that triggered the filter
# %CATEGORY% - filter category that got triggered
# %PATTERN% - regex pattern that matched
# %RECIPIENT% - player who is receiving the message
notify:
  enabled: false
  message: '<click:suggest_command:"/chatfilter mute %PLAYER% 1h %category% violation"><hover:show_text:"category: <red>%CATEGORY%</red><newline>pattern: <red>%PATTERN%</red><newline><grey>click to mute %player%</grey>"><red>@%RECIPIENT% </red><dark_red>|</dark_red><white> %PLAYER% : %MESSAGE%'


# logs violations
log:
  # Log Message Placeholders:
  # %PLAYER% - player that triggered the filter
  # %MESSAGE% - message that triggered the filter
  # %CATEGORY% - category of filter that got triggered
  # %PATTERN% - regex pattern that matched
  message-format: "%PLAYER% has violated filter %CATEGORY% with message %MESSAGE%"
  to-file: true
  to-discord: false
  webhook: "WEBHOOK URL"


# Should scan times be timed?
# Use this to optimise your regex patterns
profile: false


# enable debug console output
debug: false

filter.yml
# This filter uses regex to match messages and will not work if you set up your expressions correctly
# PATTERNS ARE CASE SENSITIVE, design your regex accordingly

# Resources:
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Cheatsheet
# https://regex101.com/


# Action tag allowed arguments:
# 'notify' - notify user as specified in config.yml under notify
# (only put one of the below per category)
# 'cancel' - cancel the message
# 'ghost' - return message to sender but hide message from other players
# 'ignore' - does not cancel or modify the message, but still runs the commands


# Placeholders for commands (case-sensitive)
# %PLAYER%     - offending player's username
# %UUID%       - offending player's UUID
# %MESSAGE%    - message that triggered the violation
# %PATTERN%    - pattern that matched the offending text
# %CATEGORY% - filter category that got triggered
# %WORLD%      - world that offending player was in
# %IP%         - player's IP address, useful for auto IP BANS


# You must add the category to the list in config.yml to enable
categories:
  # Name of category
  example:
    # Whether this category is enabled by default
    enabled: false
    # Action to be taken when violation occurs
    action:
      - 'cancel'
      - 'notify'
    # These commands are executed as console when a player triggers the filter
    commands:
      - '/ban %PLAYER%'
    # Regex patterns for the filter to match
    regex:
      - 'pattern-1'
      - 'pattern-2'
      - 'pattern-3'

你可以添加无限数量的分类

这是一个用于屏蔽聊天中网站的示例分类

demo-websites: enabled: false action: - 'cancel' commands: - '/chatfilter mute %PLAYER% 5m Chat Filter' regex: - 'https?://' - '[\w\d-]+.(net|com|org)' - '[\d]+.[\d]+.[\d]+.[\d]+'

demo-all_caps: enabled: false action: - 'cancel' commands: - '/chatfilter mute %PLAYER% 1h Chat Filter' regex: - '^[A-Z\s]+$'

GamerSafer 正则表达式列表不可修改,因为它使用的是 GamerSafer 的官方列表

如果此过滤器出现问题,请在 ChatFilter 的 GitHub 页面上提交问题报告

gamersafer: enabled: false action: - 'cancel' - 'notify' commands: '/mute %PLAYER% 1h' # 过滤器的严格程度应该是多少? # 0:精确匹配,不区分大小写 # 1:匹配额外字母,不区分大小写 # 2:匹配空格、额外字母,不区分大小写 strictness: 1 # 对于有太多误报的词语 exclude: - 'cok' - 'iap' - 'sm' - 'ho' - 'hell'


</details>
<details>
<summary>命令</summary>

<pre><code>
chatfilter
  |disable <filter> - 禁用某个分类
  |enable <filter> - 启用某个分类
  |status <filter> - 获取过滤器的状态信息
  |mute <player> <duration> <reason> - 禁言某玩家
  |unmute <player> - 解除某玩家的禁言
  |debug
  |  |enable - 在不更改配置的情况下启用控制台调试输出
  |  |disable - 在不更改配置的情况下停止控制台调试输出
  |  \query - 输出调试输出是开启还是关闭
  |profile
  |  |enable - 在不更改配置的情况下启用内置分析器
  |  |disable - 在不更改配置的情况下禁用内置分析器
  |  \query - 返回分析器是否已启用
</pre></code>
</details>

# 支持
如果你遇到任何错误,请[创建支持工单](https://github.com/Tesla6426/Advanced-Restart/issues/new)。

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源