MiraWaNeko / DiscordIntegration

Communicate between Minecraft and Discord
https://discordintegration.net
GNU Affero General Public License v3.0
88 stars 41 forks source link

messageIgnoreRegex support #201

Open a404error opened 4 years ago

a404error commented 4 years ago

Base informations

Minecraft version: 1.12.2

DiscordIntegration version: DiscordIntegration-mc1.12.2-3.0.5.jar

Server type and version: Forge/Spigot/Sponge forge-1.12.2-14.23.5.2847

Link to pastebin with (censored) config: Optional

Expected behavior

"messageIgnoreRegex": ["[Server] executed list"],

The value should prevent this message from being sent to discord. Though, I'm not entirely sure if this is correct, but it did pass JSON validation. Config/Wiki isn't updated to reflect this parameter and any examples.

Actual behavior

My server is flooded with [Server] executed list messages.

Steps to reproduce

OmgImAlexis commented 4 years ago

@Chikachi what's the correct way to add regex? I can't find anything at all in this repo apart from an issue or two stating it was being added. I've tried commandIgnoreRegex and messageIgnoreRegex as the fields with no success.

All I want is the ftb commands to stop spamming my discord but still have everything else echoed so I can keep an eye on things while I'm not playing.

"commandIgnoreRegex": [
    "list",
    "/list/",
    "\/list\/",
    "\/list"
]
OmgImAlexis commented 4 years ago

For anyone that stumbles onto this issue here's the Java that handles it, maybe someone can workout the correct format from the code.

https://github.com/Chikachi/DiscordIntegrationCore/blob/2ecff7707c733df9cf5f54c9f259cabbc0db5b72/src/main/java/chikachi/discord/core/config/minecraft/MinecraftGenericConfig.java#L60-L85

a404error commented 4 years ago

@OmgImAlexis I ended up discovering that if you use Multicraft (dedicated or from a hosting provider), it has a "feature" called Crash Detection. All it does is execute the /list command roughly every 3 min to see if the server is alive. If you're dedicated, you can simply disable this setting in the config. I had to contact customer support as I didn't have access to that setting (I have Apex hosting). No more /list spam in discord though! I'm very positive that the first 2 list commands you have are correct. I played around with it more after I opened this issue and did the same thing. Syntactically, the Java code you linked looks correct, but I don't play in Java. Background is in .Net web dev. I assume it's the way the value(s) are being passed around though. A disconnect is happening somewhere.