New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

telegraf-ignore-old-messages

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

telegraf-ignore-old-messages

The crash-preventing middleware for Telegram bots

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

telegraf-ignore-old-messages

Dependencies

Ignores old messages in Telegram chats.

Why? POV:

Your bot was off for an hour • Each of 1000 users sent 2 messages in that time • Bot wakes up and gets all the updates • Tries to reply to 2000 messages simultaneously • most probably crashes the server

Quick start

First, run npm i telegraf-ignore-old-messages. Then, in your Telegraf app:

const { Telegraf } = require('telegraf')
const ignoreOldMessages = require('telegraf-ignore-old-messages')

const bot = new Telegraf(process.env.BOT_TOKEN)

const skipAfter = 5
// the message skipping interval in minutes. Defaults to 1.

bot.use(
  ignoreOldMessages(skipAfter)
)

// ...

bot.launch()

ignoreOldMessages should be connected first, before all the other message-related middlewares

Caught a Bug?

  1. Fork this repository to your own GitHub account and then clone it to your local device
  2. Link the package to the global module directory: npm link
  3. Within the Telegraf app you want to test your local development instance of telegraf-ignore-old-messages, just link it to the dependencies: npm link telegraf-ignore-old-messages. Instead of the default one from npm, Node.js will now use your clone of the middleware!

Keywords

FAQs

Package last updated on 14 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc