else {
lineReplyMessage(replyToken, [
{
"type": "text",
"text": "Hello, user"
},
{
"type": "text",
"text": "May I help you?"
}
]);
return;
}
function myFunction() {
let service = get_rows_service();
let botMessageText = "school-123";
// 存放符合條件的物件
let matchedObjects = [];
// 遍歷資料
service.forEach(item => {
// 檢查 enable 屬性是否為 '是'
if (item.enable === '是') {
// 將 keyword 轉成陣列
let keywords = item.keyword.split('|');
// 檢查陣列中是否包含 botMessageText
if (keywords.some(keyword => botMessageText.includes(keyword))) {
matchedObjects.push(item);
}
}
});
// 輸出符合條件的物件
console.log(matchedObjects);
}