Longman\TelegramBot\DB::insertInlineQueryRequest PHP Method

insertInlineQueryRequest() public static method

Insert inline query request into database
public static insertInlineQueryRequest ( InlineQuery $inline_query ) : boolean
$inline_query Longman\TelegramBot\Entities\InlineQuery
return boolean If the insert was successful
    public static function insertInlineQueryRequest(InlineQuery $inline_query)
    {
        if (!self::isDbConnected()) {
            return false;
        }
        try {
            $sth = self::$pdo->prepare('
                INSERT IGNORE INTO `' . TB_INLINE_QUERY . '`
                (`id`, `user_id`, `location`, `query`, `offset`, `created_at`)
                VALUES
                (:inline_query_id, :user_id, :location, :query, :param_offset, :created_at)
            ');
            $date = self::getTimestamp();
            $inline_query_id = $inline_query->getId();
            $from = $inline_query->getFrom();
            $user_id = null;
            if ($from instanceof User) {
                $user_id = $from->getId();
                self::insertUser($from, $date);
            }
            $location = $inline_query->getLocation();
            $query = $inline_query->getQuery();
            $offset = $inline_query->getOffset();
            $sth->bindParam(':inline_query_id', $inline_query_id, PDO::PARAM_INT);
            $sth->bindParam(':user_id', $user_id, PDO::PARAM_INT);
            $sth->bindParam(':location', $location, PDO::PARAM_STR);
            $sth->bindParam(':query', $query, PDO::PARAM_STR);
            $sth->bindParam(':param_offset', $offset, PDO::PARAM_STR);
            $sth->bindParam(':created_at', $date, PDO::PARAM_STR);
            return $sth->execute();
        } catch (PDOException $e) {
            throw new TelegramException($e->getMessage());
        }
    }