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

Nesting random tag inside random tag #10

Open
ghost opened this issue Oct 27, 2016 · 1 comment
Open

Nesting random tag inside random tag #10

ghost opened this issue Oct 27, 2016 · 1 comment

Comments

@ghost
Copy link

ghost commented Oct 27, 2016

Hi. If I try to insert random tag inside random tag:
+ <bot name>
* <get it> == undefined => {random}
^ {random}Yes?|Yea?{/random}|
^ Yea?{/random}
- What's up?
I'm getting this output:
Yea?|Yea?{/random}
I'm using default response in begin block:
* <bot mood> == happy => {ok}
If I use that code in begin block:
* <bot mood> == happy => {random}
^ {ok}|{ok}|{ok}|{ok}|{ok}|{ok}|{ok}|{ok}|{ok}|{ok}|{ok}|{ok}|{ok}|{ok}|
^ {ok} :)|{ok} :)|
^ {ok} ;)|{ok} ;)|
^ {ok} :P|
^ {ok} ;P{/random}
The response is even more strange:
Yea?|Yea?|Yea?{/random}|Yea?|Yea?{/random}|Yea?|Yea?{/random}|Yea?|Yea?{/random}|Yea?|Yea?{/random}|Yea?|Yea?{/random}|Yea?|Yea?{/random}|Yea?|Yea?{/random}|Yea?|Yea?{/random}|Yea?|Yea?{/random}|Yea?|Yea?{/random}|Yea?|Yea?{/random}|Yea?|Yea?{/random}|Yea?|Yea?{/random} :)|Yea?|Yea?{/random} :)|Yea?|Yea?{/random} ;)|Yea?|Yea?{/random} ;)|Yea?|Yea?{/random} :P|Yea?|Yea?{/random} ;P{/random}

@kirsle
Copy link
Member

kirsle commented Oct 27, 2016

Yeah this isn't supported.

The random tags are found by a regexp like {random}(.+?){/random}, so if you had embedded random tags, the closing tag of the inner random would match with the opening tag of the outer random.

{random}{random}Yes?|Yea?{/random}|Yea?{/random}

The first iteration of the regexp would match {random}{random}Yes?|Yea?{/random} with the inner text being {random}Yes?|Yea? which it would then pick a random result from (one of which contains another random tag which might go on to confuse the bot even further).

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

No branches or pull requests

1 participant