Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
extension-telegram-node-bot
Advanced tools
extension-telegram-node-bot base on telegram-node-bot
base on telegram-node-bot
To install the stable version:
npm install --save extension-telegram-node-bot
This assumes you are using npm as your package manager. If you don’t, you can access these files on unpkg, download them, or point your package manager to them.
const BotExtension = require('extension-telegram-node-bot')
Request telegram-node-bot in global variable
global.Telegram = require('telegram-node-bot')
Add extension
tg.addScopeExtension(BotExtension.runCustomForm)
tg.addScopeExtension(BotExtension.runCustomInlineMenu)
Form Config
const config = {
title: 'Order Pizza', // Title Form
confirm: {
text: 'confirm', // button
message: (result) => {
return `You name is ${result.name}`
+`\nPizza is ${result.pizza}`
+`\nSize is ${result.size}`
+`\nLocation \u2714`
+`\nComment${result.addcomment ? `: ${result.comment}` : ' \u2717'}`
},
resize_keyboard: true
},
back: {
text: 'Back' // button
},
cancel: {
text: 'Cancel', // button
message: 'You canceled order pizza',
callback: ($) => {
console.log('cancel')
}
}
}
Form base item
name: {
text: 'You name', // Question
question: true, // If you need symbol "?" set true
error: 'Sorry, you name is incorrect',
extramess: 'Only 3 symbel', // Extra message
keyboard: [
[$.message.from.firstName]
],
validator: (message, callback) => {
if(message.text)
return callback(true, message.text)
else callback(false)
},
keyboardonly: false // If you want only keybord value, set true
}
Form select item
pizza: {
text: 'Type Pizza',
question: true,
error: 'Please select type pizza',
keyboard: [
['Chicken BBQ', 'Chicken Club'],
['The Meats','Supreme']
],
keyboardonly: true,
select: true,
selectCallback: {
object: (button) => {
var object
if(button == 'Chicken BBQ')
object = 'pizza1'
if(button == 'Chicken Club')
object = 'pizza2'
if(button == 'The Meats')
object = 'pizza3'
if(button == 'Supreme')
object = 'pizza4'
return object
},
pizza1: {
size: {
text: 'Size Chicken BBQ',
question: true,
error: 'Please select Size Chicken BBQ',
keyboard: [
['small', 'medium'],
['large']
],
keyboardonly: true
}
},
pizza2: {
size: {
text: 'Size Chicken Club',
question: true,
error: 'Please select Size Chicken Club',
keyboard: [
['small', 'medium'],
['large']
],
keyboardonly: true
}
},
pizza3: {
size: {
text: 'Size The Meats',
question: true,
error: 'Please select Size The Meats',
keyboard: [
['small', 'medium'],
['large']
],
keyboardonly: true
}
},
pizza4: {
size: {
text: 'Size Supreme',
question: true,
error: 'Please select Size Supreme',
keyboard: [
['small', 'medium'],
['large']
],
keyboardonly: true
}
}
}
}
Form confirm item
addcomment: {
text: 'You want write comment',
question: true,
error: 'Please select yes or no',
keyboard: [
['Yes', 'No']
],
keyboardonly: true,
confirm: true,
confirmCallback: {
status: (button) => {
if (button === "Yes")
return true
else
return false
},
ok: {
comment: {
text: 'Write comment',
question: false,
error: 'Please try again, you can send only text',
validator: (message, callback) => {
if (message.text) {
callback(true, message.text)
return
}
callback(false)
}
}
}
}
}
Full code
$.runCustomForm({
config: {
title: 'Order Pizza', // Title Form
confirm: {
text: 'confirm',
message: (result) => {
return `You name is ${result.name}`
+`\nPizza is ${result.pizza}`
+`\nSize is ${result.size}`
+`\nLocation \u2714`
+`\nComment${result.addcomment ? `: ${result.comment}` : ' \u2717'}`
},
resize_keyboard: true
},
back: {
text: 'Back'
},
cancel: {
text: 'Cancel',
message: 'You canceled order pizza',
callback: ($) => {
console.log('cancel')
}
}
},
form: { // Body form
name: {
text: 'You name', // Question
question: true, // If you need symbol "?" set true
error: 'Sorry, you name is incorrect',
keyboard: [
[$.message.from.firstName]
],
validator: (message, callback) => {
if(message.text)
return callback(true, message.text)
else callback(false)
},
keyboardonly: false, // If you want only keybord value, set true
resize_keyboard: true
},
pizza: {
text: 'Type Pizza',
question: true,
error: 'Please select type pizza',
keyboard: [
['Chicken BBQ', 'Chicken Club'],
['The Meats','Supreme']
],
keyboardonly: true,
select: true,
selectCallback: {
object: (button) => {
var object
if(button == 'Chicken BBQ')
object = 'pizza1'
if(button == 'Chicken Club')
object = 'pizza2'
if(button == 'The Meats')
object = 'pizza3'
if(button == 'Supreme')
object = 'pizza4'
return object
},
pizza1: {
size: {
text: 'Size Chicken BBQ',
question: true,
error: 'Please select Size Chicken BBQ',
keyboard: [
['small', 'medium'],
['large']
],
keyboardonly: true
}
},
pizza2: {
size: {
text: 'Size Chicken Club',
question: true,
error: 'Please select Size Chicken Club',
keyboard: [
['small', 'medium'],
['large']
],
keyboardonly: true
}
},
pizza3: {
size: {
text: 'Size The Meats',
question: true,
error: 'Please select Size The Meats',
keyboard: [
['small', 'medium'],
['large']
],
keyboardonly: true
}
},
pizza4: {
size: {
text: 'Size Supreme',
question: true,
error: 'Please select Size Supreme',
keyboard: [
['small', 'medium'],
['large']
],
keyboardonly: true
}
}
}
},
location: {
text: 'Location for Delivery',
question: true,
error: 'You send incorrect location',
validator: (message, callback) => {
if(message.location) {
callback(true, message.location)
return
}
callback(false)
}
},
addcomment: {
text: 'You want write comment',
question: true,
error: 'Please select yes or no',
keyboard: [
['Yes', 'No']
],
keyboardonly: true,
confirm: true,
confirmCallback: {
status: (button) => {
if (button === "Yes")
return true
else
return false
},
ok: {
comment: {
text: 'Write comment',
question: false,
error: 'Please try again, you can send only text',
validator: (message, callback) => {
if (message.text) {
callback(true, message.text)
return
}
callback(false)
}
}
}
}
}
}
}, (result) => {
$.sendMessage(`${result.name}! you send form`)
})
Single Menu
$.runCustomInlineMenu({
title: 'My Cars',
items: {
message: 'BMW x6',
menu: [
[
{
text: 'Sell',
callback: (callbackQuery, message) => {
console.log('Sell')
}
},
{
text: 'Buy',
callback: (callbackQuery, message) => {
console.log('Buy')
}
}
],
[
{
text: 'Contact',
callback: (callbackQuery, message) => {
console.log('Contact')
}
}
]
]
}
})
Many menu
$.runCustomInlineMenu({
title: 'My Cars',
items: [{
message: 'BMW x6',
menu: [
[
{
text: 'Sell',
callback: (callbackQuery, message) => {
console.log('Sell')
}
},
{
text: 'Buy',
callback: (callbackQuery, message) => {
console.log('Buy')
}
}
],
[
{
text: 'Contact',
callback: (callbackQuery, message) => {
console.log('Contact')
}
}
]
]
},
{
message: 'Mazda 6',
menu: [
[
{
text: 'Sell',
callback: (callbackQuery, message) => {
console.log('Sell')
}
},
{
text: 'Buy',
callback: (callbackQuery, message) => {
console.log('Buy')
}
}
],
[
{
text: 'Contact',
callback: (callbackQuery, message) => {
console.log('Contact')
}
}
]
]
},
{
message: 'Audi a6',
menu: [
[
{
text: 'Sell',
callback: (callbackQuery, message) => {
console.log('Sell')
}
},
{
text: 'Buy',
callback: (callbackQuery, message) => {
console.log('Buy')
}
}
],
[
{
text: 'Contact',
callback: (callbackQuery, message) => {
console.log('Contact')
}
}
]
]
}
]
})
FAQs
extension-telegram-node-bot base on telegram-node-bot
We found that extension-telegram-node-bot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.