
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
A simple Promise
based wrapper over Telegram Bot API with additional features.
npm install tg-yarl
const api = require('tg-yarl')('YOUR_TELEGRAM_BOT_TOKEN');
api.setWebhook('https://example.com/bot', './certificate.pem');
api.getMe().then(res => console.log(res.body));
api
.sendPhoto('chatId', './anonim.jpg', {caption: 'Anonymous'})
.then(res => console.log(res.body));
All methods return a Promise
.
A simple method for testing your bot's auth token. Returns basic information about the bot in form of a User object.
Specify an url to receive incoming updates via an outgoing webhook.
To use a self-signed certificate, you need to upload your public key certificate using certificate
parameter.
Use this method to receive incoming updates using long polling.
Send text message.
@channelusername
)Markdown
, if you want Telegram apps to show bold, italic and inline URLs in your bot's message.Forward messages of any kind.
@channelusername
)@channelusername
)Send photo.
@channelusername
)file_id
. See InputFile object for more info.Send audio.
@channelusername
)file_id
. See InputFile object for more info.Send document.
@channelusername
)file_id
. See InputFile object for more info.Send .webp stickers.
@channelusername
)file_id
. See InputFile object for more info.Send video.
@channelusername
)file_id
. See InputFile object for more info.Send voice.
@channelusername
)file_id
. See InputFile object for more info.Send location.
@channelusername
)Send chat action.
typing
for text messages, upload_photo
for photos, record_video
or upload_video
for videos, record_audio
or upload_audio
for audio files, upload_document
for general files, find_location
for location data.
@channelusername
)Use this method to get a list of profile pictures for a user.
Use this method to get basic info about a file and prepare it for downloading.
Use this method to send answers to an inline query. On success, True is returned.
No more than 50 results per query are allowed.
Download file to specified path.
WritableStream
or new WritableStream
will be created with specified path.api.downloadFile('AgADAgADjagxGxAR6gbMzfh8LDtkU-9GhCoABOmH973MjLOBq7sAAgI', './file.jpg');
Custom keyboard.
Note: This method is chainable.
If you just want to hide the keyboard, then do this:
api.setKeyboard().sendMessage('chatId', 'Text');
//or
api.setKeyboard(true);
api.sendMessage('chatId', 'Text');
If you want to hide the keyboard to specific users only, then do this:
api.setKeyboard(true, true).sendMessage('chatId', 'Text');
//or
api.setKeyboard(true, true);
api.sendMessage('chatId', 'Text');
Note: This method is chainable.
For path
, file_id
, Buffer
and local Stream
just pass into variable:
var inputFile = './file.png'; //path
//or
var inputFile = 'AgADAgADjagxGxAR6gbMzfh8LDtkU-9GhCoABOmH973MjLOBq7sAAgI'; //file_id
//or
var inputFile = new Buffer(); //Buffer
//or
var inputFile = require('fs').createReadStream('./file.png'); //local Stream
api.sendPhoto('chatId', inputFile);
For remote Stream
:
var inputFile = {
value: require('https').request('https://avatars1.githubusercontent.com/u/2401029'),
filename: 'image.jpg'
};
api.sendPhoto('chatId', inputFile);
The MIT License (MIT)
Copyright (c) 2015 Alexey Bystrov
FAQs
A simple Promise based wrapper over Telegram Bot Api with additional features.
The npm package tg-yarl receives a total of 1 weekly downloads. As such, tg-yarl popularity was classified as not popular.
We found that tg-yarl 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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.