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

Cant math Document command (then need catch file) #1406

Closed
Xakki opened this issue Jul 16, 2023 · 2 comments
Closed

Cant math Document command (then need catch file) #1406

Xakki opened this issue Jul 16, 2023 · 2 comments

Comments

@Xakki
Copy link

Xakki commented Jul 16, 2023

https://github.com/php-telegram-bot/core/blob/d9484af72a39e10913a60d2c6c9ceffb61d624d1/src/Telegram.php#L584C37-L584C37

I think it must be like this

protected function getCommandFromType(string $type): string
    {
        return mb_strtolower(str_replace('_', '', $type));
    }

Before, i try this example https://github.com/php-telegram-bot/example-bot/blob/master/Commands/Other/UploadCommand.php , but its not work (for me)

Use Laravel 10

@Xakki
Copy link
Author

Xakki commented Jul 17, 2023

After this fix, this command will work correctly

class DocumentCommand extends UserCommand
{
    /**
     * @var string
     */
    protected $name = 'document';

    /**
     * @var string
     */
    protected $description = 'Upload and save files';

    /**
     * @var string
     */
    protected $usage = '/document';
....

@noplanman
Copy link
Member

@Xakki Thanks for your report.

The line of code you are referring to shouldn't make a difference, as the command itself gets lowercased later in the code anyway.

How are you executing your command? Did you test with the exact UploadCommand code, when it didn't work?

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

2 participants