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

node-telegram-cache-chat-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

node-telegram-cache-chat-messages

Node module which helps your bot to cache messages in Telegram chat

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Node-telegram-cache-chat-messages

Build Status

Node module which helps your bot to cache text messages in Telegram chat.

Install:

npm install node-telegram-cache-chat-messages

Use:

Node-telegram-cache-chat-messages initially works with node-telegram-bot-api.

const TelegramBot = require('node-telegram-bot-api');
const TelegramCacheChatMessages = require('node-telegram-cache-chat-messages');

const bot = new TelegramBot(BOT_TOKEN);
const casheMessages = new TelegramCacheChatMessages({
  bot,
  all: true,
  edited: true
});

bot.onText(/command/, msg => {
  const chatId = msg.chat.id;
  const messages = casheMessages.messages(chatId);
  // do something with messages. For example resend last message:
  const lastMessage = messages[messages.length - 1];

  bot.sendMessage(chatId, lastMessage);
});

Options:

new TelegramCacheChatMessages({
  bot: <you bot instance> // previously created bot via node-telegram-bot-api
  all: <boolean> // [default: false] false means that you cache only last message, true is that you cache all messages
  edited: <boolean> // [default: true] false means that you cache only messages, true is that you cache edited messages too
});

Note:

  • After using your commands cached messages will be cleared. This is done to avoid serious memory overflow
  • Node-telegram-cache-chat-messages doesn't process messages with non text content
  • Node-telegram-cache-chat-messages doesn't cache other bots messages

FAQs

Package last updated on 07 Feb 2018

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