public StatusUpdate inReplyToStatusId(long inReplyToStatusId) { setInReplyToStatusId(inReplyToStatusId); return this; }
String answer = "replying to @" + userNick + ": ..."; StatusUpdate statusReply = new StatusUpdate(answer); statusReply.setInReplyToStatusId(statusId); try { twitter.updateStatus(statusReply); } catch (TwitterException ex) { // handle exception }
/** * Asynchronously sends a reply to a tweet. * * @param content The content of the reply * @param medias The attachments to upload and link in the reply * @param inReplyTo The tweet that this is in reply to * * @return A {@link CompletionStage} to follow the status of the asynchronous request */ public CompletionStage<Status> sendReply(final String content, final List<File> medias, final long inReplyTo) { return prepareNewTweet(content, medias).thenApplyAsync( update -> { LOG.debug("Set inReplyTo for status update {} as : {}", update, inReplyTo); update.setInReplyToStatusId(inReplyTo); return update; }, TWITTER_EXECUTOR ).thenApplyAsync( update -> sessionManager.doWithCurrentTwitter(twitter -> twitter.updateStatus(update)).get(), TWITTER_EXECUTOR ); }
private void replyTo(final Status status, final String reply, final boolean prefix) throws TwitterException { final String message; if (prefix) { message = "@" + status.getUser().getScreenName() + " " + reply; } else { message = reply; } final StatusUpdate statusUpdate = new StatusUpdate(message); statusUpdate.setInReplyToStatusId(status.getId()); twitter.updateStatus(statusUpdate); }
public static void reply(long inReplyToStatusId,String text,double latitude,double longitude,TwitterFactory factory) throws TwitterException { AccessToken accessToken = loadAccessToken(); Twitter twitter = factory.getInstance(); twitter.setOAuthConsumer(consumerKey, consumerSecrate); twitter.setOAuthAccessToken(accessToken); StatusUpdate stat= new StatusUpdate(text); stat.setInReplyToStatusId(inReplyToStatusId); GeoLocation location= new GeoLocation(latitude, longitude); stat.setLocation(location); twitter.updateStatus(stat); }'
StatusUpdate update = new StatusUpdate(status); if (inReplyTo > 0) { update.setInReplyToStatusId(inReplyTo);