我有一个Twitter机器人,该机器人发布的简短文本有时超过一条推文的字符数限制。当它超过限制时,我希望该机器人以全文形式将多条推文发布为一个帖子。我在他们的API文档中看不到任何用于执行此操作的文档。关于如何实现此目标的任何想法?
我的机器人是用PHP编写的,并使用此类: https://github.com/J7mbo/twitter-api-php
答案 0 :(得分:0)
此线程可能{永远()?)不可用:Is there any api update for tweet thread(storm) feature which recently released in twitter?
我已经对该主题进行了多次Google搜索,但没有找到一篇文章介绍如何使用API创建多条推文线程。 API documentation中的类似搜索没有任何结果。对于如何利用这种功能,我有很多好主意,这可能就是为什么它不存在的原因……它也有太多被滥用的可能性。
答案 1 :(得分:0)
您可以使用reply
创建线程。
这是java上的例子
https://gist.github.com/ivamluz/6284531#file-twitter4j-post-reply-java
public static void replyTo(List<Status> tweets) {
Twitter twitter = new TwitterFactory().getInstance();
Status reply = null;
for (Status tweet : tweets) {
try {
reply = twitter.updateStatus(new StatusUpdate(UUID.randomUUID() + " - @" + tweet.getUser().getScreenName() + " this is a reply to your tweet.").inReplyToStatusId(tweet.getId()));
System.out.println("Posted reply " + reply.getId() + " in response to tweet " + reply.getInReplyToStatusId());
} catch (TwitterException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}