Open delbertina opened 3 years ago
Discordsrv and cmi work perfect together. Might wrong configs in one of them by your site?
Whats wrong with your regex?
'[^\u0000-\u007F]+
that will do nothing
Hete you have a one for the words ass
- \b(?i)(a+(\W|_?)+s+(\W|_?)+s+([^ioIO]|$))
Discordsrv and cmi work perfect together. Might wrong configs in one of them by your site?
I mean, you're partially correct. Everything worked perfectly for me until I tried setting up the chat filter stuff.
Whats wrong with your regex?
'[^\u0000-\u007F]+
that will do nothing
What exactly do you mean by "do nothing"? There's nothing wrong with it, I've been using that and a few other filters to test the bugs I encountered. If you don't believe me, here's a site to test it out yourself quickly. It catches unicode characters such as í .
Cmi chatfilter might work a bit different then you know it from others
b(?i)(a+(\W|_?)+s+(\W|_?)+s+([^ioIO]|$))
A nice site for simply chatfilter you can find here
https://dkalaxdk.github.io/CMIRegexFilter/
So whats the issue with cmi chat? Works fine. Diesnt your townChat dont work with the chatfilter that is made for cmi chat? Well than you need to ask townychat dev to add a hook for cmi chatfilters
Cmi chatfilter might work a bit different then you know it from others
b(?i)(a+(\W|_?)+s+(\W|_?)+s+([^ioIO]|$))
A nice site for simply chatfilter you can find here https://dkalaxdk.github.io/CMIRegexFilter/
Don't think I'm following what you're trying to say. My issues are not with the filtering functionality itself. The chat filter feature correctly catches messages that need to be filtered. My issues are the 2 situations in my original post about InformChat not working with all filter type and filter type others not canceling the message event.
Doesnt your townChat dont work with the chatfilter that is made for cmi chat? Well than you need to ask townychat dev to add a hook for cmi chatfilters
With cmi chat it works fine on our server. Also the hook with Discord SRV works like wanted here. So i see the Problem more that the chatfilters that are made for cmichat might dont get listen correct from your townychat.
Here an example from our chatfilters
banswearing03:
Enabled: true
Group: swearing
InformConsole: true
Regex:
- 卐
ReplaceWith: '&4I want to get banned!'
BlockType: none
includePrivateMessages: true
msgToStaff: '&4!&6[playerName] &4was swearing forbitten.'
Commands:
- ban [playerName]
swearing18:
Enabled: true
Group: swearing
InformConsole: true
Regex:
- \b(?i)(s+(\W|_?)+a+(\W|_?)+c+(\W|_?)+k+(\W|_?)+g+(\W|_?)+e+(\W|_?)+s+(\W|_?)+i+(\W|_?)+c+(\W|_?)+h+(\W|_?)+t+)
ReplaceWith: ✪✪✪✪✪
BlockType: none
includePrivateMessages: true
msgToStaff: '&4!&6[playerName] &4used a swearword.'
Commands:
- cmi msg [senderName] &eswearing is not allowed. An admin has been informed!
Note: admins and op or people with * might bypass filters because of their permission to bypass them.
About the types: Type Others will post it in Discord Because thats how discord reads a not canceled meassage. This issue was reported to discordsrv devs as well. About inform: works fine if your staff has the permission for it. This will inform the staff in chat. Dont know if this works with townychat, aggain you might need to inform the dev of townChat for a hook there...?
Here the original example
ChatFilter:
Enabled: true
Deny:
ipBlock:
# If not set to true, this filter will not be used
Enabled: false
# Defines filter group and defines required permission node to bypass this filter: cmi.chatfilter.bypass.[groupName]
Group: Advertising
# When set to true, each time player triggers filter, console will receive information about who triggered it, which filter and with what message
InformConsole: false
# Regex expression to filter by. How to use regex https://regexone.com/
Regex:
- ''
# With what we need to replace word, if not defined found expression will not be changed
ReplaceWith: ''
# possible: none, others, all
# Where 'none' means everyone will receive this message
# 'others' means that sender will get message but not other players, this is usefull to prevent advertising and silently block it
# 'all' means that no one will receive sent message
BlockType: none
# When enabled rule will be applied to private messages
includePrivateMessages: true
# Players with cmi.chatfilter.inform permission will receive defined message when rule is broken
msgToStaff: '&4!&6[playerName] &4advertising with: &r[message]'
# List of commands to perform when rule is broken. Use [senderName] to include message sender name. Supports global variables same as locale file
Commands: []
Type Others will post it in Discord Because thats how discord reads a not canceled meassage. This issue was reported to discordsrv devs as well.
Do you have a link to the ticket for this being reported? Maybe there was a misunderstanding when resolving the ticket? Seems out of character for Scarsz with all the chat plugins DiscordSRV has changes to specifically support they wouldn't try to support CMI if that is the only avenue to fix the bug.
About inform: works fine if your staff has the permission for it. This will inform the staff in chat. Dont know if this works with townychat, aggain you might need to inform the dev of townChat for a hook there...?
You're talking about the msg to staff, I'm talking about the InformConsole boolean config value in each filter.
You're talking about the msg to staff, I'm talking about the InformConsole boolean config value in each filter.
we used this before and it was working fine. but we took it out because it was not nessesary for us anymore to get an extra information in console and console log...well to be honest.. we have the inform console taken out since over one year now, so i dont know if its still working or not
Description of issue: When using the chat filter feature, some settings cause unexpected outcomes. I am using TownyChat for the that formatting and integration with DiscordSRV. Have tried enabling DiscordSRV support in the CMI config and also disabling ClickHoverMessages as some other tickets suggested to no avail.
I really like the innovative idea of having the bad actors not know their f bombs and n words are only being shown to them via the 'others' block type. Also really love how the chat filter feature is setup such that someone saying the n word can have different commands run on them than someone who says the a word for instance. So I'm hoping maybe the issues I've come across are easy to fix because I would really like to use the chat filtering within CMI and not have to find a new plugin for just chat filtering. :)
Situation # 1 - InformConsole = true and BlockType = all
Result: Triggering this filter does not inform console
Situation # 2 - BlockType = others
Results: Triggering this filter does not cancel the chat event so DiscordSRV sends the message to the discord chat.
CONFIG SECTION (DELETE IF NOT RELEVANT):
Cmi Version (using
/cmi version
): 9.0.2.1 Server Type (Spigot/Paperspigot/etc): Paper Server Version (using/ver
): 1.16.5 Build # 777 Relevant plugins (Delete if this isn't needed): DiscordSRV 1.23.0 TownyChat 0.88