![](/img/trans.png)
[英]How can I fix my jsonp callback to address the “unexpected token” error, using angularjs $http?
[英]can I be shown how to fix my syntax error : "unexpected token var line 65"?
(1:) 我正在寫一個 webhook 腳本。 (2:) 使用“google 表格”及其腳本編輯器。 它不喜歡我使用以下語法的方式。
`function sendMessage(message, channel)
{
if(webhooks(channel))
var url = webhooks[channel];
else {
Logger.log("Error Sending Message to Channel " + channel);
return "NoStoredWebhookException";
}
var payload = JSON.stringify({content: message});
Logger.log(options, null, 2);
UrlFetchApp.fetch("https://discord.com/api/webhooks/1069728124704653413/_h9KQdxqenUWGSSE5xR91QgBU28bdcUcY2yGslu83KezXvUTEv7BlJzvYo-mVTBv5_ye", options);
var webhooks = {
test: "Obtain a webhook for the channel you'd like and put it here."
var params = {
headers: {"Content-Type": "application/x-www-form-urlencoded"},
method: "POST",
payload: payload,
muteHttpExceptions: true
};
var res = UrlFetchApp.fetch(url, params);
Logger.log(res.getContentText());
}`
您沒有關閉 webhook 上的第二個大括號 object
var webhooks = {
test: "Obtain a webhook for the channel you'd like and put it here."
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.