Skip to content

dvs-crcr/tg-broadcast-limits

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tg-broadcast-limits

NPM Version

Node.js module that helps sending Telegram bulk messages without hitting limits and 429 errors.

Install

$ npm i @crcr/tg-broadcast-limits

Usage

See the examples/ folder for detailed example.

const TelegramApi = require('./TelegramApi'); // telegram api example
const TBL = require('@crcr/tg-broadcast-limits').default;
// OR USE: 
// import { default as TBL } from '@crcr/tg-broadcast-limits'

const chatIds = [1, 2, 3];  // Array of chat ids ;)
const token = '123:heLLoworldtGBRoadCaStLimiTS'; // Telegram bot api token

function broadcast(token, chatIds, text) {
  const tbl = new TBL()
  chatIds.forEach((chatId) => {
    tbl.push(chatId, TelegramApi.sendMessage.bind(this), token, chatId, text);
  })
}

broadcast(token, chatIds, 'Hello from dvs!');

Telegram Broadcast limits

Used limit values:

  • 20 msg per minute in same group;
  • 1 msg per second in same chat;
  • 30 msg per second in any chat.

You can read about the limits on the official Telegram website.

License

MIT

About

Node.js module that helps sending Telegram bulk messages without hitting limits and 429 errors. ✉️

Topics

Resources

License

Stars

Watchers

Forks