繁体   English   中英

使用Twitter4j发布Twitter线程

[英]Posting twitter thread using 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++;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM