/** * 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')); }
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(); }