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

CustomID Template Improvements #2528

Merged
merged 2 commits into from
Dec 14, 2022

Conversation

Cenngo
Copy link
Collaborator

@Cenngo Cenngo commented Dec 9, 2022

This PR aims to improve the performance Custom ID template matching without sacrificing any flexibility and introduce some QOL changes. Under-the-hood pattern generation logic is updated to reduce the chance of creating patterns with catastrophic backtracking.

The IF template generation logic now accepts Regex length quantifiers as wild cards to enable users to further improve the match evaluation performance. Any combination of *, {7,4}, {5}, {6,} can be used in Custom ID templates.

\ character can now be used to escape any of the aforementioned meta-characters.

And finally, since its not possible to create Regex patterns with optimal performance without knowing the intentions of the end-users and not sacrifice flexibility, you can now create your own regex patterns to suit your needs and force IF to use those patterns by setting the TreatNameAsRegex property of [ComponentInteractionAttribute] and [ModalInteractionAttribute]. Capturing groups can be used to inject variables into methods. You can use non-capturing or atomic groups to skip unneeded Custom ID variables and also increase efficiency.

@Cenngo Cenngo merged commit 3b107c2 into discord-net:dev Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants