twitter4j.Status.isRetweeted()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中twitter4j.Status.isRetweeted()方法的一些代码示例,展示了Status.isRetweeted()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Status.isRetweeted()方法的具体详情如下:
包路径:twitter4j.Status
类名称:Status
方法名:isRetweeted

Status.isRetweeted介绍

[英]Test if the status is retweeted
[中]测试状态是否被转发

代码示例

代码示例来源:origin: Tristan971/Lyrebird

/**
 * Determines whether a given tweet is a retweet made by the current user. Twitter's API really is unhelpful on this
 * side so we mostly take an educated guess here, although it should be enough in most cases.
 *
 * @param status the tweet to test against
 *
 * @return true if and only if the given status is a retweet made by the current user
 */
public boolean isRetweetByCurrentUser(final Status status) {
  if (status.isRetweet()) {
    final Status retweetedStatus = status.getRetweetedStatus();
    return retweetedStatus.isRetweeted() ||
        retweetedStatus.isRetweetedByMe() ||
        sessionManager.isCurrentUser(status.getUser());
  } else {
    return false;
  }
}

代码示例来源:origin: Tristan971/Lyrebird

@Override
public void initialize() {
  setUpInteractionActions();
  targetStatus.addListener((o, prev, cur) -> {
    updateRetweetVisual(cur.isRetweet() ? cur.getRetweetedStatus().isRetweeted() : cur.isRetweeted());
    updateLikeVisual(cur.isFavorited());
  });
}

代码示例来源:origin: jcustenborder/kafka-connect-twitter

.put("InReplyToScreenName", status.getInReplyToScreenName())
.put("Favorited", status.isFavorited())
.put("Retweeted", status.isRetweeted())
.put("FavoriteCount", status.getFavoriteCount())
.put("Retweet", status.isRetweet())

代码示例来源:origin: Tristan971/Lyrebird

/**
 * Checks whether a given tweet has been retweeted by the current user.
 * <p>
 * PSA : I don't care that you can retweet your own tweets. This is stupid and you should never do it. Will never
 * allow a PR "fixing" that pass.
 *
 * @param tweet the tweet to check
 *
 * @return Whether the given tweet had not yet been retweeted by the current user.
 */
public boolean notYetRetweeted(final Status tweet) {
  return !sessionManager.doWithCurrentTwitter(twitter -> {
    final Status updatedTweet = twitter.showStatus(tweet.getId());
    final Status originalStatus = updatedTweet.isRetweet() ? updatedTweet.getRetweetedStatus() : updatedTweet;
    return originalStatus.isRetweeted();
  }).get();
}

相关文章