iT邦幫忙

0

我想要突破500則回應的限制 下面的 function push 要改成line notify或是reply的應如何改

  • 分享至 

  • xImage

var channel_access_token = "J/nm4ATItIgJsu/+vI5M9GJ6mJfumLuxw/0WQGn+tZNW7TRyLQ4Q3D2xK6ak4wcy2NY10d/ya4uH3cQW3zCVU9KHBYQbZ++uR7hF2OS2LAS5CTC9qewNH+jdOnuQ7iwdB04t89/1O/w1cDnyilFU="
var ss = SpreadsheetApp.openById("1qfCsLiOnluxVmUZ_lIEiOvBmiwoKw6X0hEE"); //試算表ID
var sheet = ss.getSheetByName("工作表1"); //要讀取工作列的名稱
var data = sheet.getRange(2,2); //存對話資料的儲存格 (2,1)表示為試算表的A2

function doPost(e) {

var posted_json = JSON.parse(e.postData.contents);
var events = posted_json.events;

events.forEach(function(event) {

  ME=event.source.userId; //使用者的userId

  if(event.message.type == "text"){
   
      data.setValue(event.message.text);
    
      Utilities.sleep(1000);  //延遲1秒後再執行之後的程式,為的是讓試算表來的及翻譯
    
      var reply = sheet.getRange(2,4).getValue(); //預設要回話資料的儲存格 (3,4)表示為試算表的D3
      var reply1= sheet.getRange(3,4).getValue();
      var reply2= sheet.getRange(4,4).getValue();
      var reply3= sheet.getRange(5,4).getValue();
      var reply4= sheet.getRange(6,4).getValue();
      var reply5= sheet.getRange(7,4).getValue();
      push_message(ME,reply);push_message(ME,reply1);push_message(ME,reply2);push_message(ME,reply3);push_message(ME,reply4);push_message(ME,reply5);; 
   }    

});
};

//下面是po訊息的函數
function push_message(to,msg) {
var postData = {
"to": to,
"messages": [{
"type": "text",
"text": msg,
}]
};

var url = "https://api.line.me/v2/bot/message/push";
var headers = {
"Content-Type": "application/json",
'Authorization': 'Bearer ' + channel_access_token,
};

var options = {
"mevar channel_access_token = "J/nm4ATItIgJsu/EhufLOtoOMUQnWbBssdri2z+vI5M9GJ6mJfumLuxw/0WQGn+tZNW7TRyLQ4Q3D2xK6ak4wcy2NY10d/ya4uH3cQW3zCVU9KHBYQbZ++uR7hF2OS2LAS5CTC9qewNH+jdOnuQ7iwdB04t89/1O/w1cDnyilFU="
var ss = SpreadsheetApp.openById("1qfCsLiOnluxVm_ouzUZ_lIEiOvBmiwoKw6X0qQZ0hEE"); //試算表ID
var sheet = ss.getSheetByName("工作表1"); //要讀取工作列的名稱
var data = sheet.getRange(2,2); //存對話資料的儲存格 (2,1)表示為試算表的A2

function doPost(e) {

var posted_json = JSON.parse(e.postData.contents);
var events = posted_json.events;

events.forEach(function(event) {

  ME=event.source.userId; //使用者的userId

  if(event.message.type == "text"){
   
      data.setValue(event.message.text);
    
      Utilities.sleep(1000);  //延遲1秒後再執行之後的程式,為的是讓試算表來的及翻譯
    
      var reply = sheet.getRange(2,4).getValue(); //預設要回話資料的儲存格 (3,4)表示為試算表的D3
      var reply1= sheet.getRange(3,4).getValue();
      var reply2= sheet.getRange(4,4).getValue();
      var reply3= sheet.getRange(5,4).getValue();
      var reply4= sheet.getRange(6,4).getValue();
      var reply5= sheet.getRange(7,4).getValue();
      push_message(ME,reply);push_message(ME,reply1);push_message(ME,reply2);push_message(ME,reply3);push_message(ME,reply4);push_message(ME,reply5);; 
   }    

});
};

//下面是po訊息的函數
function push_message(to,msg) {
var postData = {
"to": to,
"messages": [{
"type": "text",
"text": msg,
}]
};

var url = "https://api.line.me/v2/bot/message/push";
var headers = {
"Content-Type": "application/json",
'Authorization': 'Bearer ' + channel_access_token,
};

var options = {
"method": "post",
"headers": headers,
"payload": JSON.stringify(postData)
};
var response = UrlFetchApp.fetch(url, options);
}
thod": "post",
"headers": headers,
"payload": JSON.stringify(postData)
};
var response = UrlFetchApp.fetch(url, options);
}

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答