TelegramBot / Api

Native PHP Wrapper for Telegram BOT API
MIT License
1.1k stars 325 forks source link

Undefined index: last_name #11

Closed halenharper closed 9 years ago

halenharper commented 9 years ago

Hi, I am using Laravel 5 for my app. Message successfully send, but after send I see error: ErrorException in BaseType.php line 46: Undefined index: last_name

  1. in BaseType.php line 46
  2. at HandleExceptions->handleError('8', 'Undefined index: last_name', '/Users/fedarpiashko/partsmarket24-demo/vendor/telegram-bot/api/src/BaseType.php', '46', array('data' => array('id' => '127273129', 'first_name' => 'pmt5_bot', 'username' => 'pmt5_bot'), 'key' => 'last_name', 'item' => true, 'method' => 'setLastName')) in BaseType.php line 46
iGusev commented 9 years ago

Tell more about the situation when an error occurs

halenharper commented 9 years ago

my Controller:

<?php namespace App\Http\Controllers\Admin_new_spares;

use \TelegramBot\Api\BotApi as TG;

class NewSparesController extends Controller {

    public function update()
    {
        $telegram_noty = new TG(env('TELEGRAM_BOT_TOKEN'));
        $telegram_noty->sendMessage('user_id', 'message_text');
        return redirect()->route('admin_new_spares.new_spares.index');
    }
}

Message was send, but after I see Error. If i comment line 46 in BaseType.php - NO ERROR

iGusev commented 9 years ago

Do you use the latest version?

halenharper commented 9 years ago

Oh, I am sorry. My bad. I used v.1.0. After update to v2.2.1 - all OK! Thank you.