his.js

Telegram bot for /his/ threads.
git clone git://git.knutsen.co/his.js
Log | Files | Refs | LICENSE

commit afa66baccce41c233f19c77c45df718edddad251
parent 40309ff546abc98d716292fd2c428ea9f860228c
Author: Daniel <23189912+danyisill@users.noreply.github.com>
Date:   Wed, 29 Jul 2020 22:50:11 +0300

Create his.js
Diffstat:
Ahis.js | 17+++++++++++++++++
1 file changed, 17 insertions(+), 0 deletions(-)

diff --git a/his.js b/his.js @@ -0,0 +1,17 @@ +var https = require('https'), posted = require('./posted.json'); +https.get('https://a.4cdn.org/his/threads.json', res => { + var j = '' + res.on('data', c => j += c) + res.on('end', () => { + var newThreads = JSON.parse(j).map(e => e.threads).flat().filter(e => e.replies > 50 && !posted.includes(e.no)) + if(newThreads.length){ + newThreads.forEach(thread => { + posted.push(thread.no) + console.log(thread.no) + //First entry in posted.json has to be the API token. + https.get(`https://api.telegram.org/bot${posted[0]}/sendMessage?chat_id=@his50replies&text=https://boards.4channel.org/his/thread/` + thread.no) + }) + require('fs').writeFileSync('./posted.json', JSON.stringify(posted)) + } + }) +})