Google Scripts to Telegram - if语句在比较字符串时出现问题

时间:2018-04-30 17:44:06

标签: if-statement google-apps-script

function sendText(id,text) {
  if(text == "hiii"){
    var url = telegramUrl + "/sendMessage?chat_id=" + id + "&text=" + "sup?";
  } else{ 
    var url = telegramUrl + "/sendMessage?chat_id=" + id + "&text=" + "yo yo yo";
    var response = UrlFetchApp.fetch(url);
    Logger.log(response.getContentText());
  }
}

我的问题是,在Google Scripts(Google表格的后端)中,我有这个函数从电报中读取消息,如果消息显示为“hiii”,它应该响应“sup?”。目前我的代码不执行此操作,而只执行else语句。

0 个答案:

没有答案