function sendTweet(status) {
var twitterKeys= {
TWITTER_CONSUMER_KEY: "x",
TWITTER_CONSUMER_SECRET: "x",
TWITTER_ACCESS_TOKEN: "x",
TWITTER_ACCESS_SECRET: "x"
};
var props = PropertiesService.getScriptProperties();
props.setProperties(twitterKeys);
twit = new Twitter.OAuth(props);
var service = new Twitter.OAuth(props);
if ( service.hasAccess() ) {
var response = twit.sendTweet(status);
if (response) {
Logger.log("Tweet ID " + response.id_str);
} else {
// Tweet could not be sent
// Go to View -> Logs to see the error message
}
}
}
sendTweet("test");
但是我遇到的问题是出现了这个错误:
TypeError: Cannot read property "text" from undefined. (line 293, file "twitter", project "Twitter lib")
第293行来自"Twitter lib"库的21版本(MKvHYYdYA4G5JJHj7hxIcoh8V4oX7X1M_)。
尽管出现错误,实际上“test”消息已经发布到推特上了。有人知道如何解决吗?