-
Notifications
You must be signed in to change notification settings - Fork 2
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
Core - Add a way for all handlers to specify a Regex object instead of just a string #34
Comments
Not sure what the best way to go about this is; should we pass in RegexOptions to MessageHandler, or a full-blown Regex object? The probably with the latter is the part where we liquefy strings here in MessageHandler. |
I think the best way to handle this one is to pass in RegexOptions to the MessageHandler object, instead of a Regex object, since we'll just recreate the Regex anyways after liquefying the string. This does, however, create a problem. This makes the constructor for MessageHandler take in a lot of things. I think we should create a MessageHandlerConfig and pass that into the constructor. Add a Validate() function and set sane default values. It will also clean up some things from codacy since we'll get rid of default parameters. We should extend this to all handler types, so we only have one breaking change instead of many. |
This task is completed, MessageHandler now has a MessageHandlerConfig. MessageHandlerConfig has a RegexOptions property. MessageHandler takes in this while constructing the regex: Regex lineRegex = new Regex(
Parsing.LiquefyStringWithIrcConfig(
this.LineRegex,
remoteUser,
args.IrcConfig.Nick,
channel
),
this.RegexOptions // HERE
); Wiki has also been updated. Closing. |
A user may wish to include RegexOptions, which we can't do if we can only pass in a string.
The text was updated successfully, but these errors were encountered: