projects
/
lab.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* get user's timeline
[lab.git]
/
twitter
/
twitterbot.pl
diff --git
a/twitter/twitterbot.pl
b/twitter/twitterbot.pl
old mode 100644
(file)
new mode 100755
(executable)
index
e4d1b62
..
ccd2c5a
--- a/
twitter/twitterbot.pl
+++ b/
twitter/twitterbot.pl
@@
-19,10
+19,7
@@
if (! defined $conf) {
}
my $stat = loadconf("$Bin/status.yml");
if (! defined $stat) {
}
my $stat = loadconf("$Bin/status.yml");
if (! defined $stat) {
- $stat = {
- # do not set to 0
- since_id => 1,
- };
+ $stat = {};
}
my $bot = login($conf);
}
my $bot = login($conf);
@@
-33,12
+30,12
@@
if (! $bot->authorized) {
my %tweets;
my $tweet;
my %tweets;
my $tweet;
-$tweet = or_search($bot, $conf->{hashtag}, $stat->{since_id});
+$tweet = or_search($bot, $conf->{hashtag}, $stat->{search});
if ($tweet) {
%tweets = (%tweets, %$tweet);
}
if ($tweet) {
%tweets = (%tweets, %$tweet);
}
-$tweet = mentions_ids($bot, $stat->{since_id});
+$tweet = mentions_ids($bot, $stat->{mention});
if ($tweet) {
%tweets = (%tweets, %$tweet);
}
if ($tweet) {
%tweets = (%tweets, %$tweet);
}
@@
-61,7
+58,7
@@
foreach my $id (sort keys %tweets) {
next;
}
next;
}
- $stat->{since_id} = $id;
+ $stat->{$tweets{$id}} = $id;
}
if (%tweets) {
}
if (%tweets) {
@@
-112,7
+109,7
@@
sub or_search {
my $bot = shift @_;
my $keywords = shift @_;
my $bot = shift @_;
my $keywords = shift @_;
- my $since_id = shift @_;
+ my $since_id = shift @_ || 1;
my $key = "";
foreach my $word (@$keywords) {
my $key = "";
foreach my $word (@$keywords) {
@@
-161,7
+158,7
@@
sub mentions_ids {
# or undef (none is found)
my $bot = shift @_;
# or undef (none is found)
my $bot = shift @_;
- my $since_id = shift @_;
+ my $since_id = shift @_ || 1;
my $res;
eval {
my $res;
eval {