View index.js
This file contains 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 getValue = (path, obj) => { | |
const newPath = path.replace(/\]/g, ''); | |
const arrayPath = newPath.split(/[\[\.]+/) || newPath; | |
return arrayPath.reduce((obj, k) => (obj ? obj[k] : obj), obj); | |
}; | |
const doFilterObject = (rawData, filterKey) => | |
filterKey.reduce((acc, cur) => { | |
const isNested = new RegExp(/\[|\./, 'g').test(cur); | |
const newData = isNested ? getValue(cur, rawData) : rawData[cur]; |
View index.js
This file contains 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 chatIdList = ['xxx','yyy','zzz']; | |
const botToken = 'xxx'; | |
const message = 'your message here'; | |
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); | |
(async () => { | |
for (let i = 0; i < chatIdList.length; i++) { | |
fetch(`https://api.telegram.org/bot${botToken}/sendMessage?chat_id=${chatIdList[i]}&text=${message}&parse_mode=markdown`) | |
.then(response => response.json()) | |
.then(response => { | |
console.log({ status: `${chatIdList[i]}: ${response.ok}` }); |
View settings.json
This file contains 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
// place it on your workspace .vscode folder | |
{ | |
// EDITOR | |
// ---------------------------------------- | |
"editor.defaultFormatter": "dbaeumer.vscode-eslint", | |
"[javascript]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" }, | |
"[typescript]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" }, | |
"[vue]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" }, | |
"[scss]": { "editor.defaultFormatter": "stylelint.vscode-stylelint" }, | |
"[css]": { "editor.defaultFormatter": "stylelint.vscode-stylelint" }, |