lain.pl 730 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/perl
  2. #
  3. use File::Find::Rule;
  4. use Net::Twitter;
  5. use Try::Tiny;
  6. my $nt = Net::Twitter->new(
  7. traits => [qw/API::RESTv1_1/],
  8. consumer_key => "",
  9. consumer_secret => "",
  10. access_token => "",
  11. access_token_secret => "",
  12. );
  13. # Get files from "lain" folder
  14. my @files = File::Find::Rule->in("lain");
  15. my $size = @files;
  16. my $x;
  17. # Worst code you have seen probably, but nobody is going to read this, so i don't really care.
  18. while(1) {
  19. UPLOAD:
  20. $x = int(rand($size));
  21. my $Filename = '"'.$files[$x].'"';
  22. system("cp -v $Filename file");
  23. try {
  24. $nt->update_with_media({status=>"", media=>["file"]});
  25. }
  26. catch {
  27. goto UPLOAD;
  28. };
  29. sleep 1800;
  30. }