Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Bot authorization:
const Bot = require('nk-ntba');
let bot = new Bot('API token of your bot');
Events for listening updates:
message
edited_message
channel_post
edited_channel_post
inline_query
chosen_inline_result
callback_query
shipping_query
pre_checkout_query
poll
poll_answer
my_chat_member
chat_member
chat_join_request
reply_to_message
For specific types of messages:
text
animation
audio
channel_chat_created
contact
delete_chat_photo
dice
document
game
group_chat_created
invoice
left_chat_member
location
migrate_from_chat_id
migrate_to_chat_id
new_chat_member
new_chat_photo
new_chat_title
passport_data
photo
pinned_message
poll
sticker
successful_payment
supergroup_chat_created
video
video_note
voice
voice_chat_started
voice_chat_ended
voice_chat_participants_invited
voice_chat_scheduled
message_auto_delete_timer_changed
chat_invite_link
chat_member_updated
To use specific types of messages in listener you should write event with prefix message.
, for example message.text
.
Adding a listener to some event:
bot.setCallback('your event', callback);
Removing a listener:
bot.removeCallback('your event');
Starting listener:
bot.start({
short_polling: 500
});
or
bot.start({
long_polling: 60
});
Webhookes are not available yet.
Stoping listener:
bot.stop();
Downloading file by file_id
:
const fs = require('fs');
const Bot = require('nk-ntba');
let bot = new Bot('API token of your bot');
(async () => {
await bot.downloadFile('your file_id', fs.createWriteStream('your file'));
})();
All other methods are async and need await
or .then
constructions (.catch
is not used, promise is always resolved).
You can check available methods in source code of this library.
Example of echo bot:
const Bot = require('nk-ntba');
let bot = new Bot('API token of your bot');
bot.setCallback('message.text', async (msg) => {
let cid = msg.chat.id;
let msgid = msg.message_id;
let tx = msg.text;
let r = await bot.sendMessage(cid, `You sent: ${tx}`);
setTimeout(() => {
bot.deleteMessage(cid, msgid);
bot.deleteMessage(cid, r.message_id);
bot.sendMessage(cid, `Messages were deleted after 5 sec`);
}, 5000);
});
bot.listen({
long_polling: 300
});
FAQs
Telegram bot api library for NodeJS. Developer's telegram: @NekitKuzmenko
The npm package nk-ntba receives a total of 2 weekly downloads. As such, nk-ntba popularity was classified as not popular.
We found that nk-ntba demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.