summary refs log tree commit diff
path: root/index.js
diff options
context:
space:
mode:
authormyk bilokonsky <mbilokonsky@gmail.com>2017-04-10 01:34:49 +0200
committermyk bilokonsky <mbilokonsky@gmail.com>2017-04-10 01:34:49 +0200
commit5b886f9dc093d2133dc0a8a414bdde7be5df7cc6 (patch)
tree30c762e4d359e7c1daa934581d3e3368480bd231 /index.js
parent4b759a22394fa5d042528b4e08303640bacc8c99 (diff)
api and readme
Diffstat (limited to 'index.js')
-rw-r--r--index.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/index.js b/index.js
index 9d46a85..68facd4 100644
--- a/index.js
+++ b/index.js
@@ -1,7 +1,7 @@
 var mastodon = require('mastodon');
 var pg = require('pg');
 
-var query = `SELECT id, favourites_count 
+var query = `SELECT id 
 FROM statuses 
 WHERE favourites_count > (
   SELECT avg(favourites_count) 
@@ -35,9 +35,7 @@ function cycle() {
         return console.error('error running query', err);
       }
 
-      result.rows.forEach(function(row) {
-        console.dir(row);
-      });
+      boost(result.rows);
 
       // disconnect the client
       client.end(function (err) {
@@ -47,4 +45,16 @@ function cycle() {
   });
 }
 
-cycle();
\ No newline at end of file
+var M = new mastodon({
+  access_token: process.env.AMBASSADOR_TOKEN
+});
+
+
+var boosted = {};
+function boost(rows) {
+  console.log('Boosting the following:');
+  console.dir(rows);
+}
+
+cycle();
+setInterval(cycle, 1000 * 60 * 15);
\ No newline at end of file