setiawanhu/laravel-madeline-proto

TelegramObject Constructor Not Accepting Array or Empty Argument

Closed this issue · 3 comments

Hello,
Firstly, thank you for this package.
But I got an error and couldn't find a solution.

When I used array arguments;

$payload = new TelegramObject([
    'peer' = '@your_username',
    'message' = 'Your Message'
]);
Messages::sendMessage($payload);

I'm getting this error:

ErrorException
Array to string conversion

When I used Object arguments;

$payload = new TelegramObject();
$payload->peer = '@your_username';
$payload->message = 'Your Message';
Messages::sendMessage($payload);

I'm getting:

ArgumentCountError
Too few arguments to function Hu\MadelineProto\TelegramObject::__construct(), 0 passed in /Users/ilkerkocatepe/Desktop/PROJELER/telegram/routes/web.php on line 27 and exactly 1 expected

MadelineProto::getClient() is working correctly.
Thank you.
Best regards.

Edit: I'm using Laravel 8 and PHP 7.4

Hello, thanks for reaching out!

I made a little mistake when defining the TelegramObject constructor. I'll fix it right away as a new minor update.

Best regards!

Thank you for your attention.

Fixed at #12