Skip to content

Commit

Permalink
Merge branch 'master' of github.com:grickit/Gambot
Browse files Browse the repository at this point in the history
  • Loading branch information
grickit committed May 11, 2018
2 parents 41ce1bd + 83b2ec4 commit 2fd7a90
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion scripts/FeedReddit.pl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ sub fetch_json {
if($json && scalar($json->{'data'}->{'children'}[0])) {
my $actually_reported = 0;
my %subscribers;
my $latest_timestamp = 0;

foreach my $i (1..scalar(@{$json->{'data'}->{'children'}})) {
my $post = $json->{'data'}->{'children'}[-$i]->{'data'};
Expand All @@ -57,13 +58,15 @@ sub fetch_json {
my $short_url = "https://redd.it/${name}";
my $lcsubreddit = lc($subreddit);

if($post->{'created_utc'} >= $latest_timestamp) { $latest_timestamp = $post->{'created_utc'}; }

if(!$subscribers{$lcsubreddit}) { $subscribers{$lcsubreddit} = $core->value_get('feed_subscriptions:reddit',$lcsubreddit); }
foreach my $channel (split(',',$subscribers{$lcsubreddit})) {
$core->server_send("PRIVMSG ${channel} :\x02${subreddit}:\x02 ${title} (by \x0303${author}\x0F) ${short_url}",1);
}
}

if($actually_reported) { $core->value_set('feed_metadata:reddit','last_reported',$json->{'data'}->{'children'}[0]->{'data'}->{'created_utc'},1); }
if($actually_reported) { $core->value_set('feed_metadata:reddit','last_reported',$latest_timestamp,1); }
}

#value_delete>feed_metadata_reddit>last_reported
Expand Down
6 changes: 5 additions & 1 deletion scripts/StreamReader/StreamTwitter.pl
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@
$feeds{'Wesnoth'} = 292527834;
$feeds{'jeb_'} = 24166202;
$feeds{'Dinnerbone'} = 83820762;
$feeds{'SeargeDP'} = 381007605;
#$feeds{'SeargeDP'} = 381007605;
$feeds{'shikadilord'} = 165991694;
$feeds{'StatusMinecraft'} = 901296078;
$feeds{'kairibot'} = 369296792;
$feeds{'_grum'} = 432311300;
$feeds{'frogatto'} = 162971133;
$feeds{'_ladyagnes'} = 993681445;
$feeds{'MiaLem_n'} = 606616765;

my %mojangles;
$mojangles{'716689700'} = 'PoiPoiChen';
Expand Down Expand Up @@ -68,6 +70,8 @@
$mojangles{'8032822'} = 'mollstam';
$mojangles{'381007605'} = 'SeargeDP';
$mojangles{'2150950224'} = 'themogminer';
$mojangles{'993681445'} = '_ladyagnes';
$mojangles{'606616765'} = 'MiaLem_n';

my $url = 'https://stream.twitter.com/1.1/statuses/filter.json';
my $follow = uri_escape(join(',',values(%feeds)));
Expand Down

0 comments on commit 2fd7a90

Please sign in to comment.