Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Commit

Permalink
updated option to send without preview
Browse files Browse the repository at this point in the history
  • Loading branch information
the-robot committed Feb 17, 2020
1 parent d9991c7 commit 93e6d1e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/tasks/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,19 @@ const broadcastCountryCases = async () => {
}

const broadcastLatestNews = async (news) => {
const message = `<a href="${news.link}">${news.title}</a> <code>(${news.articleSource.short_name})</code>\n\n`;
const message = `<a href="${news.link}">${news.title}</a> <code>(${news.articleSource.short_name})</code>`;
const channels = await getTelegramChannels();
if (!channels || channels.length === 0) {
return;
}

// send broadcast message to subscribed channels
for (let i=0; i < channels.length; i++) {
sendMessage(channels[i].name, message, {parse_mode : "HTML"});
if (channels[i].sendWithPreview) {
sendMessage(channels[i].name, message, {parse_mode : "HTML"});
} else {
sendMessage(channels[i].name, message, {parse_mode: "HTML", disable_web_page_preview: true});
}
}
};

Expand Down

0 comments on commit 93e6d1e

Please sign in to comment.