Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Regular expression (regex) support for excludedCommands list #247

Closed
2 tasks done
Xujiayao opened this issue Jul 24, 2024 · 1 comment
Closed
2 tasks done
Labels
enhancement New feature or request

Comments

@Xujiayao
Copy link
Owner

Checks

Description

This increases the flexibility of the excludedCommands list, allowing users to set it freely.

Inspiration from Discord: (by @Janne252)

image

Hey! I think the line https://github.com/Xujiayao/Discord-MC-Chat/blob/master/src/main/java/com/xujiayao/discord_mc_chat/minecraft/MinecraftEventListener.java#L171 should also check for command == excludedCommand, .i.e.

for (String excludedCommand : CONFIG.generic.excludedCommands) {
    if (command.startsWith(excludedCommand + " ") || command == excludedCommand) {
        return;
    }
}

so that commands that don't have any arguments can also be ignored. Otherwise it's impossible to ignore commands that don't have any agruments, e.g. /list.

@Xujiayao Xujiayao added the enhancement New feature or request label Jul 24, 2024
@Xujiayao
Copy link
Owner Author

Xujiayao commented Jul 24, 2024

The new excludedCommands list is:

"excludedCommands": [
  "\\/msg ([^@].*)",
  "\\/tell ([^@].*)",
  "\\/tellraw ([^@].*)",
  "\\/w ([^@].*)",
  "\\/teammsg (.*)",
  "\\/tm (.*)"
],

i.e. /tell @a Test will not be excluded, /tell Xujiayao Test will be excluded.

To exclude /list without (and only without) arguments, simply add \\/list to the list.

Included \\/teammsg (.*) and \\/tm (.*) in the list, which provides an example of normal excluding for other users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant