What's a tweetstorm?
And this is the inner loop of it.
- my @tweetstorm_text ; # previously generated. URL shortening and numbering are assumed
- my $screen_name ; #your screen name as text
- my $status_id ; #created but not set, so first tweet won't be a reply-to
- for my $status ( @tweetstorm_text } ) {
- my $tweet ; # the object containing the twee
- $tweet->{status} = $status ;
- $tweet->{in_reply_to_status_id} = $status_id if $status_id ;
- if ( $twit->update($tweet) ) { #if Tweet is successful
- # we get your profile, which contains your most recent tweet
- # $status_id gets set to the ID of that tweet, which then
- # gets used for the next tweet.
- my $profiles
- = $twit->lookup_users( { screen_name => $config->{user} } ) ;
- my $profile = shift @$profiles ;
- my $prev = $profile->{status} ;
- $status_id = $profile->{status}->{id} ;
- }
- }
So, that's it. I've thrown the whole thing on GitHub if you want to play with it yourself.
No comments:
Post a Comment