3 # Copyright (c) 2012 ISHIKAWA Mutsumi <ishikawa@hanzubon.jp>
4 # This program is covered by the GNU General Public License 2
6 package Mubot4FB::Tweet;
11 use Net::Twitter::Lite;
16 use base 'Mubot4FB::Common';
21 $me->{twitter} = Net::Twitter::Lite->new(consumer_key => $me->{cfg}->{twitter}->{consumer_key},
22 consumer_secret => $me->{cfg}->{twitter}->{consumer_secret},
23 legacy_list_api => 0);
25 $me->{twitter}->access_token($me->{cfg}->{twitter}->{access_token});
26 $me->{twitter}->access_token_secret($me->{cfg}->{twitter}->{access_secret});
28 return $me->{twitter};
32 my ($me, $text, $uri, $in_reply_to) = @_;
34 $text = substr($text, 0, 110) . '...' if (length($text) > 110);
36 my $o = {status => $text . ' ' . $uri};
37 $o->{in_reply_to_status_id} = $in_reply_to if (defined $in_reply_to);
40 eval {$status = $me->{twitter}->update($o)};
45 my ($me, $tweet_id) = @_;
47 eval {$status = $me->{twitter}->destroy_status($tweet_id)};