59 lines
1.4 KiB
Perl
59 lines
1.4 KiB
Perl
#!/bin/perl
|
|
|
|
#Client-Schlüssel 8aJzHkVjpomU2UUl_W8G_90Syb3P9Eg5xK61Nwti85o
|
|
#Client-Secret v6zxkyQ1oNVr4RbB50w9dIancWDKhpXRgxG_4dej0eo
|
|
#Dein Zugangs-Token KkfiWIzBCAAiVOff9OHK0ka8fCsA-RAP-1TS9a_1Fks
|
|
|
|
use Mastodon::Client;
|
|
|
|
my $post;
|
|
my $listing;
|
|
|
|
sub help() {
|
|
print "\$ ./toot.pl <public|direct|private|unlistes> 'toot'\n";
|
|
exit 1;
|
|
}
|
|
|
|
if ($ARGV[0] ne "public" and
|
|
$ARGV[0] ne "direct" and
|
|
$ARGV[0] ne "private" and
|
|
$ARGV[0] ne "unlisted" ){
|
|
help ();
|
|
}
|
|
|
|
$listing = $ARGV[0];
|
|
$post = $ARGV[1];
|
|
|
|
if ($post) {
|
|
my $client = Mastodon::Client->new(
|
|
instance => 'hessen.social',
|
|
name => 'perltoot',
|
|
client_id => '8aJzHkVjpomU2UUl_W8G_90Syb3P9Eg5xK61Nwti85o',
|
|
client_secret => 'v6zxkyQ1oNVr4RbB50w9dIancWDKhpXRgxG_4dej0eo',
|
|
access_token => 'KkfiWIzBCAAiVOff9OHK0ka8fCsA-RAP-1TS9a_1Fks',
|
|
coerce_entities => 1,
|
|
);
|
|
$client->post_status($post, { visibility => $listing });
|
|
} else {
|
|
help ();
|
|
}
|
|
|
|
0;
|
|
__END__
|
|
|
|
#$client->post_status('So, werde euch jetzt #Toot|s per #Perl reinballern! @rdfhrn') if $ARGV[0];
|
|
|
|
|
|
#$client->post_status('And now in secret...',
|
|
# { visibility => 'unlisted' }
|
|
#)
|
|
|
|
# Streaming interface might change!
|
|
#my $listener = $client->stream( 'public' );
|
|
#$listener->on( update => sub {
|
|
# my ($listener, $status) = @_;
|
|
# printf "%s said: %s\n",
|
|
# $status->account->display_name,
|
|
# $status->content;
|
|
#});
|
|
#$listener->start; |