我正在尝试弄清楚如何使用Twitter4J使用Twitter4J发布Twitter4J的推文线程。我猜它会以某种方式使用 StatusUpdate
类,但文档有点稀疏。有什么指示吗?
您应该将 inReplyToStatusId 设置为第一条推文之后每条推文的最新发布状态 ID。inReplyToStatusId 的默认值为 -1。
例:
long inReplyToStatusId = -1
int counter = 0
int threadLimit = 5
while (counter < threadLimit){
StatusUpdate statusUpdate = new StatusUpdate(Integer.toString(counter));
statusUpdate.setInReplyToStatusId(inReplyToStatusId);
Status updatedStatus = twitter.updateStatus(statusUpdate);
inReplyToStatusId = updatedStatus.getId();
counter++;
}