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

Fix: Aliased command not received arguments #857

Merged
merged 1 commit into from
Oct 19, 2021
Merged

Fix: Aliased command not received arguments #857

merged 1 commit into from
Oct 19, 2021

Conversation

arispati
Copy link

I've the same issue with #837 that using alias command not received arguments.

After checking, it turns out that the problem is in the regex in the prepareRegex function in the Telegram\Bot\Commands\Command class.

Example:

class ExampleCommand extends Command
{
    protected $name = 'example';
    protected $aliases = ['e'];
    protected $pattern = '{code}';
}

/example text

%/example(?:@.+?bot)?\s+?(?P<code>[^ ]++)%si

/e text

%/example(?:@.+?bot)?\s+?(?P<code>[^ ]++)%si

as you can see, the regex use command name instead of the alias name

@irazasyed irazasyed merged commit 120447a into irazasyed:develop Oct 19, 2021
@irazasyed
Copy link
Owner

Thanks

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.

2 participants