Inheritance: extends TelegramBot\Api\BaseType, implements TelegramBot\Api\TypeInterface
Exemple #1
0
 /**
  * A simple method for testing your bot's auth token.Requires no parameters.
  * Returns basic information about the bot in form of a User object.
  *
  * @return \TelegramBot\Api\Types\User
  * @throws \TelegramBot\Api\Exception
  * @throws \TelegramBot\Api\InvalidArgumentException
  */
 public function getMe()
 {
     return User::fromResponse($this->call('getMe'));
 }
Exemple #2
0
 public function saveUser(User $user)
 {
     Logger::log(LOG_DEBUG, "saving user " . $user->getId());
     $this->db->prepare('INSERT INTO tg_users (id, first_name, last_name, username) VALUES (:id, :first_name, :last_name, :username) ON DUPLICATE KEY UPDATE first_name=:first_name, last_name=:last_name, username=:username')->execute(array('id' => $user->getId(), 'first_name' => $user->getFirstName(), 'last_name' => $user->getLastName(), 'username' => $user->getUsername()));
     $this->user_id = $user->getId();
 }