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

Replace --enable-slash with --alias #148

Merged
merged 1 commit into from Nov 13, 2011
Merged

Replace --enable-slash with --alias #148

merged 1 commit into from Nov 13, 2011

Conversation

Vrtak-CZ
Copy link
Contributor

@Vrtak-CZ Vrtak-CZ commented Nov 6, 2011

XMPP Clients reserved slash for command so i think better then --enable-slash is --alias for define custom alias (in XMPP MUC is "standardized" '!' for bot commands).

@atmos
Copy link
Contributor

atmos commented Nov 6, 2011

Can we add a new opt-parse argument that keeps backwards compat and have --alias default to / or something?

@Vrtak-CZ
Copy link
Contributor Author

Vrtak-CZ commented Nov 7, 2011

Something like this?

if @enableSlash
newRegex = new RegExp("^(?:\/|#{@name}[:,]?)\\s*(?:#{pattern})", modifiers)
if @alias
alias = @alias.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&") # escape alias for regexp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get why this is necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not coffee-script / javascprit guru (stil learning). But i think this need if define alias with standard regexp modificator e.g. [abc].

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You would need to escape the @alias when you put things like ? or any other regex special character in the alias. I can't think of a cleaner way to do this in Javascript.

@atmos
Copy link
Contributor

atmos commented Nov 7, 2011

Almost! :D

@tombell
Copy link
Contributor

tombell commented Nov 13, 2011

Any update on this?

@atmos
Copy link
Contributor

atmos commented Nov 13, 2011

@tombell go ahead and merge it in if you can. It'll just have to wait for 2.0

tombell pushed a commit that referenced this pull request Nov 13, 2011
…h-alias

Add --alias (--enable-slash is deprecated)
@tombell tombell merged commit a39b823 into hubotio:master Nov 13, 2011
@markstory
Copy link
Contributor

Thanks for merging this, having more control over the aliases is really helpful for xmpp bots.

glucero pushed a commit to ProCern/hubot that referenced this pull request Aug 20, 2012
…ash-with-alias

Add --alias (--enable-slash is deprecated)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants