Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

telenode-js

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

telenode-js - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

13

examples/inlineKeyboard.js

@@ -27,2 +27,9 @@ const Telenode = require('../src/bot');

bot.onButton('', callbackQuery => {
bot.sendTextMessage(
'The random button was pressed, it was targeted via the button handler with empty string parameter',
callbackQuery.message.chat.id,
);
});
const inlineKeyboard = [

@@ -45,2 +52,8 @@ [

],
[
{
text: 'Random button (onButton with empty string)',
callback_data: 'random',
},
],
];

2

package.json
{
"name": "telenode-js",
"version": "1.2.1",
"version": "1.3.0",
"description": "Lightweight Telegram API framework for Node.js",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -14,2 +14,3 @@ const { runServer } = require('./server');

this.buttonHandlers = {};
this.anyButtonHandler = null;
this.#baseUrl = 'https://api.telegram.org/bot' + apiToken;

@@ -91,3 +92,8 @@ this.#secretToken = secretToken;

buttonHandler(callbackQuery);
return;
}
// Similar to the text message handler, this should be the final step to validate that no matches occurred
if (this.anyButtonHandler) {
this.anyButtonHandler(callbackQuery);
}
}

@@ -111,6 +117,10 @@

onButton(buttonDataTrigger, handler) {
if (!buttonDataTrigger || typeof buttonDataTrigger !== 'string') {
if (typeof buttonDataTrigger !== 'string') {
return;
}
this.buttonHandlers[buttonDataTrigger] = handler;
if (buttonDataTrigger === '') {
this.anyButtonHandler = handler;
} else {
this.buttonHandlers[buttonDataTrigger] = handler;
}
}

@@ -117,0 +127,0 @@

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