Created
April 27, 2018 01:24
-
-
Save chalkpe/5aafff198ca0eaf1c394aaa4d9f23709 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const axios = require('axios') | |
| const chatId = ??? | |
| const token = '???' | |
| const api = 'https://api.telegram.org' | |
| const page = 'https://www.ubuntu.com/download/desktop' | |
| const delay = t => new Promise((res, rej) => setTimeout(res, t)) | |
| async function wow () { | |
| while (true) { | |
| try { | |
| const {data} = await axios.get(page) | |
| if (data.includes('18.04')) break | |
| console.log(new Date().toISOString(), 'not yet') | |
| await delay(3000) | |
| } catch (err) { | |
| console.error(err) | |
| } | |
| } | |
| console.log(new Date().toISOString(), 'wow! released!') | |
| await axios.get(`${api}/bot${token}/sendMessage`, { | |
| params: { | |
| chat_id: chatId, | |
| text: 'wow Ubuntu 18.04 is released! ' + page | |
| } | |
| }) | |
| } | |
| wow() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment