diff options
| author | Jules Laplace <carbon@melanarchy.org> | 2013-08-02 17:23:25 -0500 |
|---|---|---|
| committer | Jules Laplace <carbon@melanarchy.org> | 2013-08-02 17:23:25 -0500 |
| commit | e76b691e78e273226cba9284cb8cd22a423319ed (patch) | |
| tree | a58d22f69869fe2bf3885f81bdda4952f87ff6d7 /bucky2/rest/goathead.pl | |
| parent | 753f60c7d4769fa72d3b910e491f37db6f130898 (diff) | |
bucky2
Diffstat (limited to 'bucky2/rest/goathead.pl')
| -rwxr-xr-x | bucky2/rest/goathead.pl | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/bucky2/rest/goathead.pl b/bucky2/rest/goathead.pl new file mode 100755 index 0000000..347dfae --- /dev/null +++ b/bucky2/rest/goathead.pl @@ -0,0 +1,67 @@ +#!/usr/bin/perl +use lib "../lib"; +use Rest::Twitter; +use Data::Dumper; +my $twitter = new Rest::Twitter; +$twitter->auth("goatflayer","onetimeonly"); +my $url_file = "../tmp/goat-data.txt"; +my $tweet_file = "../tmp/goat-tweet.txt"; + +while (1) + { + my $which = int rand 10; + if ($which < 6) + { + my $tweet = get_next_tweet($url_file); + if ($tweet) + { + $twitter->tweet_post("#nsfw #tasteless " . $tweet); + sleep 3600*(5+rand(5)); + } + else + { print "\n\n\n\nNo more tweets!\n"; exit; } + } + else + { + my $tweet = get_next_tweet($tweet_file); + if ($tweet) + { + $twitter->tweet_post($tweet); + sleep 600 * (4+rand(4)); + } + } + } + +sub coin_toss + { + my (@faces) = @_; + my $face = uc $faces[ int rand scalar @faces ]; +# my $face_string = join "/", @faces; + return $face; + } +sub get_next_tweet + { + my ($file) = @_; + open TWEETS, $file; + my @tweets = <TWEETS>; + close TWEETS; + my $picked = int rand scalar @tweets; + my $tweet = ''; + open TWEETS, ">$file"; + for (my $i = 0; $i < scalar @tweets; $i++) + { + if ($i == $picked) + { + $tweet = $tweets[$i]; + chomp $tweet; + } + else + { + print TWEETS $tweets[$i]; + } + } + close TWEETS; + return $tweet; + } +1; + |
