{"id":35061092,"url":"https://github.com/murka/telegraf","last_synced_at":"2026-03-15T20:33:28.124Z","repository":{"id":55081980,"uuid":"328487795","full_name":"murka/telegraf","owner":"murka","description":null,"archived":false,"fork":false,"pushed_at":"2021-01-17T14:35:19.000Z","size":175,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-05-15T17:33:45.248Z","etag":null,"topics":["bot-api","middleware","session-middleware","telegraf","telegram-bots"],"latest_commit_sha":null,"homepage":"https://telegrafjs.org","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/murka.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-10T21:58:56.000Z","updated_at":"2021-02-11T13:45:46.000Z","dependencies_parsed_at":"2022-08-14T11:30:35.201Z","dependency_job_id":null,"html_url":"https://github.com/murka/telegraf","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/murka/telegraf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murka%2Ftelegraf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murka%2Ftelegraf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murka%2Ftelegraf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murka%2Ftelegraf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/murka","download_url":"https://codeload.github.com/murka/telegraf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murka%2Ftelegraf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28077512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-27T02:00:05.897Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot-api","middleware","session-middleware","telegraf","telegram-bots"],"created_at":"2025-12-27T10:32:26.657Z","updated_at":"2025-12-27T10:32:30.965Z","avatar_url":"https://github.com/murka.png","language":"HTML","readme":"![Telegraf](header.png)\r\n\r\n## Introduction\r\n\r\nBots are special [Telegram](https://telegram.org) accounts designed to handle messages automatically. \r\nUsers can interact with bots by sending them command messages in private or group chats. \r\nThese accounts serve as an interface for code running somewhere on your server.\r\n\r\n#### Features\r\n\r\n- Full [Telegram Bot API 4.8](https://core.telegram.org/bots/api) support\r\n- [Telegram Payment Platform](https://telegram.org/blog/payments)\r\n- [HTML5 Games](https://core.telegram.org/bots/api#games)\r\n- [Inline mode](https://core.telegram.org/bots/api#inline-mode)\r\n- Incredibly fast\r\n- [now](https://now.sh)/[Firebase](https://firebase.google.com/products/functions/)/[Glitch](https://dashing-light.glitch.me)/[Heroku](https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction)/[AWS **λ**](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html)/Whatever ready\r\n- `http/https/fastify/Connect.js/express.js` compatible webhooks\r\n- Easy to extend\r\n- `TypeScript` typings\r\n\r\n#### Installation\r\n\r\n```bash\r\n$ npm install telegraf@3.38.0 --save\r\n```\r\n\r\nor using yarn\r\n\r\n```bash\r\n$ yarn add telegraf@3.38.0\r\n```\r\n\r\n#### Example\r\n  \r\n```js\r\nconst { Telegraf } = require('telegraf')\r\n\r\nconst bot = new Telegraf(process.env.BOT_TOKEN)\r\nbot.start((ctx) =\u003e ctx.reply('Welcome'))\r\nbot.help((ctx) =\u003e ctx.reply('Send me a sticker'))\r\nbot.on('sticker', (ctx) =\u003e ctx.reply('👍'))\r\nbot.hears('hi', (ctx) =\u003e ctx.reply('Hey there'))\r\nbot.launch()\r\n```\r\n\r\n```js\r\nconst { Telegraf } = require('telegraf')\r\n\r\nconst bot = new Telegraf(process.env.BOT_TOKEN)\r\nbot.command('oldschool', (ctx) =\u003e ctx.reply('Hello'))\r\nbot.command('modern', ({ reply }) =\u003e reply('Yo'))\r\nbot.command('hipster', Telegraf.reply('λ'))\r\nbot.launch()\r\n```\r\n\r\nFor additional bot examples see [`examples`](https://github.com/telegraf/telegraf/tree/3.38.0/docs/examples) folder.\r\n\r\n**Community bots:**\r\n\r\n| Name | Description |\r\n| --- | --- |\r\n| [ChatAdmin](https://github.com/Khuzha/chatAdmin) | Helps to administer the chats  |\r\n| [BooksAndBot](https://github.com/dmtrbrl/BooksAndBot) | An inline bot that allows you to search for books and share them in a conversation. Powered by Goodreads  |\r\n| [CaptchaOnlyBot](https://github.com/Piterden/captcha_only_bot) | Configurable question \\w set of buttons on a new group user |\r\n| [ChannelHashBot](https://github.com/YouTwitFace/ChannelHashBot) | Keep track of hashtags that are sent in your group by forwarding them to a channel |\r\n| [ChatLinkerBot](https://github.com/jt3k/chat-linker) | The bridge between jabber and telegram |\r\n| [ChessBot](https://github.com/Piterden/chessbot) | Inline chess game in a message |\r\n| [CounterBot](https://github.com/leodj/telegram-counter-bot) | Keep track of multiple counters and increment, decrement, set and reset them to your hearts content  |\r\n| [DefendTheCastle](https://github.com/TiagoDanin/Defend-The-Castle) | Telegram Bot Game - Defend The Castle |\r\n| [EveMoviesBot](https://github.com/dmbaranov/evemovies-bot) | Track movie torrent releases and get notifications when it's there |\r\n| [GNU/LinuxIndonesiaBot](https://github.com/bgli/bglibot-js) | BGLI Bot a.k.a Miranda Salma |\r\n| [GoogleItBot](https://github.com/Edgar-P-yan/google-it-telegram-bot) | Instant inline search |\r\n| [GroupsAdminBot](https://github.com/Azhant/AdminBot) | Telegram groups administrator bot |\r\n| [KitchenTimerBot](https://github.com/DZamataev/kitchen-timer-bot) | Bot for setting up multiple timers for cooking |\r\n| [LyricsGramBot](https://github.com/lioialessandro/LyricsGramBot) | Song Lyrics |\r\n| [MangadexBot](https://github.com/ejnshtein/mangadex_bot) | Read manga from Mangadex |\r\n| [Memcoin](https://github.com/backmeupplz/memcoin) | Memcoin for the Memconomy |\r\n| [MetalArchivesBot](https://github.com/amiralies/metalarchives-telegram-bot) | Unofficial metal-archives.com bot |\r\n| [MidnaBot](https://github.com/wsknorth/midnabot) | Midnabot for telegram |\r\n| [Nyaa.si Bot](https://github.com/ejnshtein/nyaasi-bot) | Nyaa.si torrents |\r\n| [OCRToolBot](https://github.com/Piterden/tesseract-bot) | Tesseract text from image recognition |\r\n| [OneQRBot](https://github.com/Khuzha/oneqrbot) | Scan and generate QR |\r\n| [OrdisPrime](https://github.com/MaxTgr/Ordis-Prime) | A telegram bot helper for warframe |\r\n| [PodSearchBot](https://fazendaaa.github.io/podsearch_bot/) | TypeScript |\r\n| [RandomPassBot](https://github.com/Khuzha/randompassbot) | Generate a password |\r\n| [Randy](https://github.com/backmeupplz/randymbot) | Randy Marsh raffle Telegram bot |\r\n| [ReferalSystem](https://github.com/Khuzha/refbot) | Channels promoter |\r\n| [ScrobblerBot](https://github.com/drvirtuozov/scrobblerBot) | An unofficial Last.fm Scrobbler |\r\n| [Shieldy](https://github.com/backmeupplz/shieldy) | Telegram bot repository |\r\n| [SimpleRegBot](https://github.com/Khuzha/simpleRegBot) | Simple bot for registration users to any event |\r\n| [SpyfallGameBot](https://github.com/verget/telegram-spy-game) | Simple telegram bot for an interesting board game |\r\n| [StickersPlayBot](https://github.com/TiagoDanin/StickersPlayBot) | Search series covers stickers via inline |\r\n| [StoreOfBot](https://github.com/TiagoDanin/StoreOfBot) | Search, explore \u0026 discover the bests bots, channel or groups |\r\n| [SyntaxHighlighterBot](https://github.com/piterden/syntax-highlighter-bot) | A code highlighting tool for telegram chats |\r\n| [TelegrafRutrackerTransmission](https://github.com/DZamataev/telegraf-rutracker-transmission) | Bot for searching torrents at Rutracker and add them to your Transmission web service |\r\n| [TelegramTelegrafBot](https://github.com/Finalgalaxy/telegram-telegraf-bot) | Telegram bot example using Telegraf with easy configuration steps |\r\n| [Temply](https://github.com/backmeupplz/temply) |   |\r\n| [TereGramBot](https://github.com/juandjara/TereGramBot) | Simple telegram node bot with a few funny commands |\r\n| [TheGuardBot](https://github.com/TheDevs-Network/the-guard-bot) | Manage a network of related groups |\r\n| [ThemerBot](https://github.com/YouTwitFace/ThemerBot) | Create themes for Telegram based on colors chosen from a picture |\r\n| [TTgram](https://github.com/TiagoDanin/TTgram) | Receive and send Twitters used a Telegram Bot |\r\n| [Voicy](https://github.com/backmeupplz/voicy) |   |\r\n| [Watchy](https://github.com/backmeupplz/watchy) |   |\r\n| [YtSearchBot](https://github.com/Finalgalaxy/yt-search-bot) | Bot to share YouTube fetched videos from any channel |\r\n| [YTubevideoBot](https://github.com/n1ghtw0lff/YTubevideoBot) | Bot created to help you find and share any video from youtube |\r\n| [NodeRSSBot](https://github.com/fengkx/NodeRSSBot) | Bot to subscribe RSS feed which allows many configurations |\r\n| [BibleBot](https://github.com/Kriv-Art/BibleBot) | Bot to get bible verses |\r\n| [BitcoinDogBot](https://github.com/jibital/bitcoin-dog-bot) | Bitcoin prices, Technical analysis and Alerts! |\r\n| Send PR to add link to your bot |   |\r\n\r\n## Getting started\r\n\r\n#### Telegram token\r\n\r\nTo use the [Telegram Bot API](https://core.telegram.org/bots/api), \r\nyou first have to [get a bot account](https://core.telegram.org/bots) \r\nby [chatting with BotFather](https://core.telegram.org/bots#6-botfather).\r\n\r\nBotFather will give you a *token*, something like `123456789:AbCdfGhIJKlmNoQQRsTUVwxyZ`.\r\n\r\n#### Bot\r\n\r\nA Telegraf bot is an object containing an array of middlewares which are composed \r\nand executed in a stack-like manner upon request. Is similar to many other middleware systems \r\nthat you may have encountered such as Koa, Ruby's Rack, Connect.\r\n\r\n#### Middleware\r\n\r\nMiddleware is an essential part of any modern framework.\r\nIt allows you to modify requests and responses as they pass between the Telegram and your bot.\r\n\r\nYou can imagine middleware as a chain of logic connection your bot to the Telegram request.\r\n\r\nMiddleware normally takes two parameters (ctx, next), `ctx` is the context for one Telegram update, \r\n`next` is a function that is invoked to execute the downstream middleware. \r\nIt returns a Promise with a then function for running code after completion.\r\n\r\n```js\r\nconst bot = new Telegraf(process.env.BOT_TOKEN)\r\n\r\nbot.use(async (ctx, next) =\u003e {\r\n  const start = new Date()\r\n  await next()\r\n  const ms = new Date() - start\r\n  console.log('Response time: %sms', ms)\r\n})\r\n\r\nbot.on('text', (ctx) =\u003e ctx.reply('Hello World'))\r\nbot.launch()\r\n```\r\n\r\n##### Known middleware\r\n\r\n- [Internationalization](https://github.com/telegraf/telegraf-i18n)\r\n- [Redis powered session](https://github.com/telegraf/telegraf-session-redis)\r\n- [Local powered session (via lowdb)](https://github.com/RealSpeaker/telegraf-session-local)\r\n- [Rate-limiting](https://github.com/telegraf/telegraf-ratelimit)\r\n- [Menus via inline keyboards](https://github.com/EdJoPaTo/telegraf-inline-menu)\r\n- [Natural language processing via wit.ai](https://github.com/telegraf/telegraf-wit)\r\n- [Natural language processing via recast.ai](https://github.com/telegraf/telegraf-recast)\r\n- [Multivariate and A/B testing](https://github.com/telegraf/telegraf-experiments)\r\n- [Powerfull bot stats via Mixpanel](https://github.com/telegraf/telegraf-mixpanel)\r\n- [statsd integration](https://github.com/telegraf/telegraf-statsd)\r\n- [and more...](https://www.npmjs.com/search?q=telegraf-)\r\n\r\n#### Error handling\r\n\r\nBy default Telegraf will print all errors to `stderr` and rethrow error.\r\n\r\nTo perform custom error-handling logic use following snippet:\r\n\r\n```js\r\nconst bot = new Telegraf(process.env.BOT_TOKEN)\r\nbot.catch((err, ctx) =\u003e {\r\n  console.log(`Ooops, encountered an error for ${ctx.updateType}`, err)\r\n})\r\nbot.start((ctx) =\u003e {\r\n  throw new Error('Example error')\r\n})\r\nbot.launch()\r\n``` \r\n\r\n#### Context\r\n\r\nA Telegraf Context encapsulates telegram update.\r\nContext is created per request and contains following props:\r\n\r\n| Property | Description |\r\n| --- | --- |\r\n| ` ctx.telegram ` | Telegram client instance |\r\n| ` ctx.updateType ` | Update type (message, inline_query, etc.) |\r\n| `[ctx.updateSubTypes]` | Update subtypes (text, sticker, audio, etc.) |\r\n| `[ctx.message]` | Received message |\r\n| `[ctx.editedMessage]` | Edited message |\r\n| `[ctx.inlineQuery]` | Received inline query |\r\n| `[ctx.chosenInlineResult]` | Received inline query result |\r\n| `[ctx.callbackQuery]` | Received callback query |\r\n| `[ctx.shippingQuery]` | Shipping query |\r\n| `[ctx.preCheckoutQuery]` | Precheckout query |\r\n| `[ctx.channelPost]` | New incoming channel post of any kind — text, photo, sticker, etc. |\r\n| `[ctx.editedChannelPost]` | New version of a channel post that is known to the bot and was edited |\r\n| `[ctx.poll]` | New version of a anonymous poll that is known to the bot and was changed |\r\n| `[ctx.pollAnswer]` | This object represents an answer of a user in a non-anonymous poll. |\r\n| `[ctx.chat]` | Current chat info |\r\n| `[ctx.from]` | Sender info |\r\n| `[ctx.match]` | Regex match (available only for `hears`, `command`, `action`, `inlineQuery` handlers) |\r\n| ` ctx.webhookReply ` | Shortcut to `ctx.telegram.webhookReply` |\r\n\r\n```js\r\nbot.use((ctx) =\u003e {\r\n  console.log(ctx.message)\r\n})\r\n```\r\n\r\n##### Extending context\r\n\r\nThe recommended way to extend bot context:\r\n\r\n```js\r\nconst bot = new Telegraf(process.env.BOT_TOKEN)\r\n\r\nbot.context.db = {\r\n  getScores: () =\u003e { return 42 }\r\n}\r\n\r\nbot.on('text', (ctx) =\u003e {\r\n  const scores = ctx.db.getScores(ctx.message.from.username)\r\n  return ctx.reply(`${ctx.message.from.username}: ${scores}`)\r\n})\r\n\r\nbot.launch()\r\n```\r\n\r\n##### Shortcuts\r\n\r\nContext shortcuts for **message** update:\r\n\r\n| Shortcut | Bound to |\r\n| --- | --- |\r\n| `addStickerToSet`         | [`telegram.addStickerToSet`](#addstickertoset) |\r\n| `createNewStickerSet`     | [`telegram.createNewStickerSet`](#createnewstickerset) |\r\n| `deleteChatPhoto`         | [`telegram.deleteChatPhoto`](#deletechatphoto) |\r\n| `deleteMessage`           | [`telegram.deleteMessage`](#deletemessage) |\r\n| `deleteStickerFromSet`    | [`telegram.deleteStickerFromSet`](#deletestickerfromset) |\r\n| `exportChatInviteLink`    | [`telegram.exportChatInviteLink`](#exportchatinvitelink) |\r\n| `forwardMessage`          | [`telegram.forwardMessage`](#forwardmessage) |\r\n| `getChat`                 | [`telegram.getChat`](#getchat) |\r\n| `getChatAdministrators`   | [`telegram.getChatAdministrators`](#getchatadministrators) |\r\n| `getChatMember`           | [`telegram.getChatMember`](#getchatmember) |\r\n| `getChatMembersCount`     | [`telegram.getChatMembersCount`](#getchatmemberscount) |\r\n| `getMyCommands`           | [`telegram.getMyCommands`](#getmycommands) |\r\n| `getStickerSet`           | [`telegram.getStickerSet`](#getstickerset) |\r\n| `leaveChat`               | [`telegram.leaveChat`](#leavechat) |\r\n| `pinChatMessage`          | [`telegram.pinChatMessage`](#pinchatmessage) |\r\n| `reply`                   | [`telegram.sendMessage`](#sendmessage) |\r\n| `replyWithAudio`          | [`telegram.sendAudio`](#sendaudio) |\r\n| `replyWithChatAction`     | [`telegram.sendChatAction`](#sendchataction) |\r\n| `replyWithDice`           | [`telegram.sendDice`](#senddice) |\r\n| `replyWithDocument`       | [`telegram.sendDocument`](#senddocument) |\r\n| `replyWithGame`           | [`telegram.sendGame`](#sendgame) |\r\n| `replyWithHTML`           | [`telegram.sendMessage`](#sendmessage) |\r\n| `replyWithInvoice`        | [`telegram.sendInvoice`](#sendinvoice) |\r\n| `replyWithLocation`       | [`telegram.sendLocation`](#sendlocation) |\r\n| `replyWithMarkdown`       | [`telegram.sendMessage`](#sendmessage) |\r\n| `replyWithMediaGroup`     | [`telegram.sendMediaGroup`](#sendmediagroup) |\r\n| `replyWithPhoto`          | [`telegram.sendPhoto`](#sendphoto) |\r\n| `replyWithPoll`           | [`telegram.sendPoll`](#sendpoll) |\r\n| `replyWithQuiz`           | [`telegram.sendQuiz`](#sendquiz) |\r\n| `replyWithSticker`        | [`telegram.sendSticker`](#sendsticker) |\r\n| `replyWithVideo`          | [`telegram.sendVideo`](#sendvideo) |\r\n| `replyWithVideoNote`      | [`telegram.sendVideoNote`](#sendvideonote) |\r\n| `replyWithVoice`          | [`telegram.sendVoice`](#sendvoice) |\r\n| `setChatDescription`      | [`telegram.setChatDescription`](#setchatdescription) |\r\n| `setChatPhoto`            | [`telegram.setChatPhoto`](#setchatphoto) |\r\n| `setChatTitle`            | [`telegram.setChatTitle`](#setchattitle) |\r\n| `setMyCommands`           | [`telegram.setMyCommands`](#setmycommands) |\r\n| `setPassportDataErrors`   | [`telegram.setPassportDataErrors`](#setpassportdataerrors) |\r\n| `setStickerPositionInSet` | [`telegram.setStickerPositionInSet`](#setstickerpositioninset) |\r\n| `setStickerSetThumb`      | [`telegram.setStickerSetThumb`](#setstickersetthumb) |\r\n| `setStickerSetThumb`      | [`telegram.setStickerSetThumb`](#setstickersetthumb) |\r\n| `stopPoll`                | [`telegram.stopPoll`](#stoppoll) |\r\n| `unpinChatMessage`        | [`telegram.unpinChatMessage`](#unpinchatmessage) |\r\n| `uploadStickerFile`       | [`telegram.uploadStickerFile`](#uploadstickerfile) |\r\n| `unbanChatMember`         | [`telegram.unbanChatMember`](#unbanchatmember) |\r\n\r\nContext shortcuts for **callback_query** update:\r\n\r\n| Shortcut | Bound to |\r\n| --- | --- |\r\n| `addStickerToSet`         | [`telegram.addStickerToSet`](#addstickertoset) |\r\n| `answerCbQuery`           | [`telegram.answerCbQuery`](#answercbquery) |\r\n| `answerGameQuery`         | [`telegram.answerGameQuery`](#answergamequery) |\r\n| `createNewStickerSet`     | [`telegram.createNewStickerSet`](#createnewstickerset) |\r\n| `deleteChatPhoto`         | [`telegram.deleteChatPhoto`](#deletechatphoto) |\r\n| `deleteMessage`           | [`telegram.deleteMessage`](#deletemessage) |\r\n| `deleteStickerFromSet`    | [`telegram.deleteStickerFromSet`](#deletestickerfromset) |\r\n| `editMessageCaption`      | [`telegram.editMessageCaption`](#editmessagecaption) |\r\n| `editMessageMedia`        | [`telegram.editMessageMedia`](#editmessagemedia) |\r\n| `editMessageReplyMarkup`  | [`telegram.editMessageReplyMarkup`](#editmessagereplymarkup) |\r\n| `editMessageText`         | [`telegram.editMessageText`](#editmessagetext) |\r\n| `exportChatInviteLink`    | [`telegram.exportChatInviteLink`](#exportchatinvitelink) |\r\n| `forwardMessage`          | [`telegram.forwardMessage`](#forwardmessage) |\r\n| `getChat`                 | [`telegram.getChat`](#getchat) |\r\n| `getChatAdministrators`   | [`telegram.getChatAdministrators`](#getchatadministrators) |\r\n| `getChatMember`           | [`telegram.getChatMember`](#getchatmember) |\r\n| `getChatMembersCount`     | [`telegram.getChatMembersCount`](#getchatmemberscount) |\r\n| `getStickerSet`           | [`telegram.getStickerSet`](#getstickerset) |\r\n| `leaveChat`               | [`telegram.leaveChat`](#leavechat) |\r\n| `pinChatMessage`          | [`telegram.pinChatMessage`](#pinchatmessage) |\r\n| `reply`                   | [`telegram.sendMessage`](#sendmessage) |\r\n| `replyWithAnimation`      | [`telegram.sendAnimation`](#sendanimation) |\r\n| `replyWithAudio`          | [`telegram.sendAudio`](#sendaudio) |\r\n| `replyWithChatAction`     | [`telegram.sendChatAction`](#sendchataction) |\r\n| `replyWithDice`           | [`telegram.sendDice`](#senddice) |\r\n| `replyWithDocument`       | [`telegram.sendDocument`](#senddocument) |\r\n| `replyWithGame`           | [`telegram.sendGame`](#sendgame) |\r\n| `replyWithHTML`           | [`telegram.sendMessage`](#sendmessage) |\r\n| `replyWithInvoice`        | [`telegram.sendInvoice`](#sendinvoice) |\r\n| `replyWithLocation`       | [`telegram.sendLocation`](#sendlocation) |\r\n| `replyWithMarkdown`       | [`telegram.sendMessage`](#sendmessage) |\r\n| `replyWithMediaGroup`     | [`telegram.sendMediaGroup`](#sendmediagroup) |\r\n| `replyWithPhoto`          | [`telegram.sendPhoto`](#sendphoto) |\r\n| `replyWithPoll`           | [`telegram.sendPoll`](#sendpoll) |\r\n| `replyWithSticker`        | [`telegram.sendSticker`](#sendsticker) |\r\n| `replyWithVideo`          | [`telegram.sendVideo`](#sendvideo) |\r\n| `replyWithVideoNote`      | [`telegram.sendVideoNote`](#sendvideonote) |\r\n| `replyWithVoice`          | [`telegram.sendVoice`](#sendvoice) |\r\n| `setChatDescription`      | [`telegram.setChatDescription`](#setchatdescription) |\r\n| `setChatPhoto`            | [`telegram.setChatPhoto`](#setchatphoto) |\r\n| `setChatTitle`            | [`telegram.setChatTitle`](#setchattitle) |\r\n| `setStickerPositionInSet` | [`telegram.setStickerPositionInSet`](#setstickerpositioninset) |\r\n| `setStickerSetThumb`      | [`telegram.setStickerSetThumb`](#setstickersetthumb) |\r\n| `stopPoll`                | [`telegram.stopPoll`](#stoppoll) |\r\n| `unpinChatMessage`        | [`telegram.unpinChatMessage`](#unpinchatmessage) |\r\n| `uploadStickerFile`       | [`telegram.uploadStickerFile`](#uploadstickerfile) |\r\n| `unbanChatMember`         | [`telegram.unbanChatMember`](#unbanchatmember) |\r\n\r\nContext shortcuts for **inline_query** update:\r\n\r\n| Shortcut | Bound to |\r\n| --- | --- |\r\n| `answerInlineQuery` | [`telegram.answerInlineQuery`](#answerinlinequery) |\r\n\r\nContext shortcuts for **shipping_query** update:\r\n\r\n| Shortcut | Bound to |\r\n| --- | --- |\r\n| `answerShippingQuery` | [`telegram.answerShippingQuery`](#answershippingquery) |\r\n\r\nContext shortcuts for **pre_checkout_query** update:\r\n\r\n| Shortcut | Bound to |\r\n| --- | --- |\r\n| `answerPreCheckoutQuery` | [`telegram.answerPreCheckoutQuery`](#answerprecheckoutquery) |\r\n\r\n##### Shortcuts usage example\r\n\r\n```js\r\nconst bot = new Telegraf(process.env.BOT_TOKEN)\r\n\r\nbot.command('quit', (ctx) =\u003e {\r\n  // Explicit usage\r\n  ctx.telegram.leaveChat(ctx.message.chat.id)\r\n\r\n  // Using context shortcut\r\n  ctx.leaveChat()\r\n})\r\n\r\nbot.on('text', (ctx) =\u003e {\r\n  // Explicit usage\r\n  ctx.telegram.sendMessage(ctx.message.chat.id, `Hello ${ctx.state.role}`)\r\n\r\n  // Using context shortcut\r\n  ctx.reply(`Hello ${ctx.state.role}`)\r\n})\r\n\r\nbot.on('callback_query', (ctx) =\u003e {\r\n  // Explicit usage\r\n  ctx.telegram.answerCbQuery(ctx.callbackQuery.id)\r\n\r\n  // Using context shortcut\r\n  ctx.answerCbQuery()\r\n})\r\n\r\nbot.on('inline_query', (ctx) =\u003e {\r\n  const result = []\r\n  // Explicit usage\r\n  ctx.telegram.answerInlineQuery(ctx.inlineQuery.id, result)\r\n\r\n  // Using context shortcut\r\n  ctx.answerInlineQuery(result)\r\n})\r\n\r\nbot.launch()\r\n```\r\n\r\n#### State\r\n\r\nThe recommended namespace to share information between middlewares.\r\n\r\n```js\r\nconst bot = new Telegraf(process.env.BOT_TOKEN)\r\n\r\n// Naive authorization middleware\r\nbot.use((ctx, next) =\u003e {\r\n  ctx.state.role = getUserRole(ctx.message)\r\n  return next()\r\n})\r\n\r\nbot.on('text', (ctx) =\u003e {\r\n  return ctx.reply(`Hello ${ctx.state.role}`)\r\n})\r\n\r\nbot.launch()\r\n```\r\n\r\n#### Session\r\n\r\n```js\r\nconst session = require('telegraf/session')\r\n\r\nconst bot = new Telegraf(process.env.BOT_TOKEN)\r\nbot.use(session())\r\nbot.on('text', (ctx) =\u003e {\r\n  ctx.session.counter = ctx.session.counter || 0\r\n  ctx.session.counter++\r\n  return ctx.reply(`Message counter:${ctx.session.counter}`)\r\n})\r\n\r\nbot.launch()\r\n```\r\n\r\n**Note: For persistent sessions you can use any of [`telegraf-session-*`](https://www.npmjs.com/search?q=telegraf-session) middleware.**\r\n\r\n**Tip: To use same session in private chat with bot and in inline mode, use following session key resolver:**\r\n\r\n```js\r\n{\r\n  getSessionKey: (ctx) =\u003e {\r\n    if (ctx.from \u0026\u0026 ctx.chat) {\r\n      return `${ctx.from.id}:${ctx.chat.id}`\r\n    } else if (ctx.from \u0026\u0026 ctx.inlineQuery) {\r\n      return `${ctx.from.id}:${ctx.from.id}`\r\n    }\r\n    return null\r\n  }\r\n}\r\n```\r\n\r\n#### Update types\r\n\r\nSupported update types:\r\n\r\n- `message`\r\n- `edited_message`\r\n- `callback_query`\r\n- `inline_query`\r\n- `shipping_query`\r\n- `pre_checkout_query`\r\n- `chosen_inline_result`\r\n- `channel_post`\r\n- `edited_channel_post`\r\n\r\nAvailable update sub-types:\r\n\r\n- `text`\r\n- `audio`\r\n- `dice`\r\n- `document`\r\n- `photo`\r\n- `sticker`\r\n- `video`\r\n- `voice`\r\n- `contact`\r\n- `location`\r\n- `venue`\r\n- `forward`\r\n- `new_chat_members`\r\n- `left_chat_member`\r\n- `new_chat_title`\r\n- `new_chat_photo`\r\n- `delete_chat_photo`\r\n- `group_chat_created`\r\n- `migrate_to_chat_id`\r\n- `supergroup_chat_created`\r\n- `channel_chat_created`\r\n- `migrate_from_chat_id`\r\n- `pinned_message`\r\n- `game`\r\n- `video_note`\r\n- `invoice`\r\n- `successful_payment`\r\n- `connected_website`\r\n- `passport_data`\r\n- `poll`\r\n\r\n```js\r\n// Handle message update\r\nbot.on('message', (ctx) =\u003e {\r\n  return ctx.reply('Hello')\r\n})\r\n\r\n// Handle sticker or photo update\r\nbot.on(['sticker', 'photo'], (ctx) =\u003e {\r\n  console.log(ctx.message)\r\n  return ctx.reply('Cool!')\r\n})\r\n```\r\n[Official Docs](https://core.telegram.org/bots/api#message)\r\n\r\n#### Webhooks\r\n\r\n```js\r\nrequire('dotenv')\r\n\r\nconst bot = new Telegraf(process.env.BOT_TOKEN)\r\n\r\n// TLS options\r\nconst tlsOptions = {\r\n  key: fs.readFileSync('server-key.pem'),\r\n  cert: fs.readFileSync('server-cert.pem'),\r\n  ca: [\r\n    // This is necessary only if the client uses a self-signed certificate.\r\n    fs.readFileSync('client-cert.pem')\r\n  ]\r\n}\r\n\r\n// Set telegram webhook\r\n// The second argument is necessary only if the client uses a self-signed \r\n// certificate. Including it for a verified certificate may cause things to break.\r\nbot.telegram.setWebhook('https://server.tld:8443/secret-path', {\r\n  source: 'server-cert.pem'\r\n})\r\n\r\n// Start https webhook\r\nbot.startWebhook('/secret-path', tlsOptions, 8443)\r\n\r\n// Http webhook, for nginx/heroku users.\r\nbot.startWebhook('/secret-path', null, 5000)\r\n```\r\n\r\nUse webhookCallback() if you want to attach telegraf to existing http server\r\n\r\n```js\r\nrequire('http')\r\n  .createServer(bot.webhookCallback('/secret-path'))\r\n  .listen(3000)\r\n\r\nrequire('https')\r\n  .createServer(tlsOptions, bot.webhookCallback('/secret-path'))\r\n  .listen(8443)\r\n```\r\n\r\nExpress.js example integration\r\n\r\n```js\r\nconst { Telegraf } = require('telegraf')\r\nconst express = require('express')\r\nconst expressApp = express()\r\n\r\nconst bot = new Telegraf(process.env.BOT_TOKEN)\r\nexpressApp.use(bot.webhookCallback('/secret-path'))\r\nbot.telegram.setWebhook('https://server.tld:8443/secret-path')\r\n\r\nexpressApp.get('/', (req, res) =\u003e {\r\n  res.send('Hello World!')\r\n})\r\n\r\nexpressApp.listen(3000, () =\u003e {\r\n  console.log('Example app listening on port 3000!')\r\n})\r\n```\r\n\r\nFastify example integration\r\n\r\n```js\r\nconst { Telegraf } = require('telegraf')\r\nconst fastifyApp = require('fastify')()\r\n\r\nconst bot = new Telegraf(process.env.BOT_TOKEN)\r\n\r\nbot.on('text', ({ reply }) =\u003e reply('Hello'))\r\nfastifyApp.use(bot.webhookCallback('/secret-path'))\r\n// Set telegram webhook\r\n// npm install -g localtunnel \u0026\u0026 lt --port 3000\r\nbot.telegram.setWebhook('https://------.localtunnel.me/secret-path')\r\n\r\nfastifyApp.listen(3000, () =\u003e {\r\n  console.log('Example app listening on port 3000!')\r\n})\r\n```\r\n\r\nKoa.js example integration\r\n\r\n```js\r\nconst { Telegraf } = require('telegraf')\r\nconst Koa = require('koa')\r\nconst koaBody = require('koa-body')\r\n\r\nconst bot = new Telegraf(process.env.BOT_TOKEN)\r\nbot.telegram.setWebhook('https://server.tld:8443/secret-path')\r\n\r\nconst app = new Koa()\r\napp.use(koaBody())\r\napp.use(async (ctx, next) =\u003e {\r\n  if (ctx.method !== 'POST' || ctx.url !== '/secret-path') {\r\n    return next()\r\n  }\r\n  await bot.handleUpdate(ctx.request.body, ctx.response)\r\n  ctx.status = 200\r\n})\r\napp.use(async (ctx) =\u003e {\r\n  ctx.body = 'Hello World'\r\n})\r\n\r\napp.listen(3000)\r\n```\r\n\r\n#### Working with files\r\n\r\nSupported file sources:\r\n\r\n- `Existing file_id`\r\n- `File path`\r\n- `Url`\r\n- `Buffer`\r\n- `ReadStream`\r\n\r\nAlso you can provide optional name of file as `filename`.\r\n\r\n```js\r\nbot.on('message', (ctx) =\u003e {\r\n  // resend existing file by file_id\r\n  ctx.replyWithSticker('123123jkbhj6b')\r\n\r\n  // send file\r\n  ctx.replyWithVideo({ source: '/path/to/video.mp4' })\r\n\r\n  // send stream\r\n  ctx.replyWithVideo({\r\n    source: fs.createReadStream('/path/to/video.mp4')\r\n  })\r\n\r\n  // send buffer\r\n  ctx.replyWithVoice({\r\n    source: Buffer.alloc()\r\n  })\r\n\r\n  // send url via Telegram server\r\n  ctx.replyWithPhoto('https://picsum.photos/200/300/')\r\n\r\n  // pipe url content\r\n  ctx.replyWithPhoto({\r\n    url: 'https://picsum.photos/200/300/?random',\r\n    filename: 'kitten.jpg'\r\n  })\r\n})\r\n```\r\n\r\n#### Telegram Passport\r\n\r\nTo enable Telegram Passport support you can use [`telegram-passport`](https://www.npmjs.com/package/telegram-passport) package:\r\n\r\n```js\r\nconst { Telegraf } = require('telegraf')\r\nconst TelegramPassport = require('telegram-passport')\r\n\r\nconst bot = new Telegraf(process.env.BOT_TOKEN)\r\nconst passport = new TelegramPassport(\"PRIVATE_KEY_IN_PEM_FORMAT\")\r\n\r\nbot.on('passport_data', (ctx) =\u003e {\r\n  const decryptedPasswordData = passport.decrypt(ctx.passportData)\r\n  console.log(decryptedPasswordData)\r\n  return ctx.setPassportDataErrors([\r\n    { source: 'selfie', type: 'driver_license', file_hash: 'file-hash', message: 'Selfie photo is too low quality'}\r\n  ])\r\n})\r\n```\r\n\r\n#### Telegraf Modules\r\n\r\nTelegraf Modules is higher level abstraction for writing modular Telegram bots.\r\n\r\nModule is simple js file with exported Telegraf middleware:\r\n\r\n```js\r\nmodule.exports = (ctx) =\u003e ctx.reply('Hello from Telegraf Module!')\r\n```\r\n\r\n```js\r\nconst Composer = require('telegraf/composer')\r\n\r\nmodule.exports = Composer.mount(\r\n  'sticker', \r\n  (ctx) =\u003e ctx.reply('Wow, sticker')\r\n)\r\n```\r\n\r\nTo run modules you can use `telegraf` module runner, it allows you to start Telegraf module easily from the command line.\r\n\r\n```bash\r\n$ npm install telegraf -g\r\n```\r\n\r\n#### Telegraf CLI usage\r\n\r\n```\r\ntelegraf [opts] \u003cbot-file\u003e\r\n  -t  Bot token [$BOT_TOKEN]\r\n  -d  Webhook domain\r\n  -H  Webhook host [0.0.0.0]\r\n  -p  Webhook port [$PORT or 3000]\r\n  -s  Stop on error\r\n  -l  Enable logs\r\n  -h  Show this help message\r\n```\r\n\r\n##### Telegraf Module example\r\n\r\nCreate module with name `bot.js` and following content:\r\n\r\n```js\r\nconst Composer = require('telegraf/composer')\r\nconst PhotoURL = 'https://picsum.photos/200/300/?random'\r\n\r\nconst bot = new Composer()\r\nbot.start((ctx) =\u003e ctx.reply('Hello there!'))\r\nbot.help((ctx) =\u003e ctx.reply('Help message'))\r\nbot.command('photo', (ctx) =\u003e ctx.replyWithPhoto({ url: PhotoURL }))\r\n\r\nmodule.exports = bot\r\n```\r\n\r\nthen run it:\r\n\r\n```bash\r\n$ telegraf -t \"bot token\" bot.js\r\n```\r\n\r\n## API reference\r\n\r\n#### Telegraf\r\n\r\nTelegraf API reference\r\n\r\n```js\r\nconst { Telegraf } = require('telegraf')\r\n```\r\n\r\n##### Constructor\r\n\r\nInitialize new Telegraf bot.\r\n\r\n`const telegraf = new Telegraf(token, [options])`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| token | `string` | [Bot Token](https://core.telegram.org/bots#3-how-do-i-create-a-bot) |\r\n| [options] | `object` | Telegraf options |\r\n\r\nTelegraf options:\r\n\r\n```js\r\n{\r\n  telegram: {           // Telegram options\r\n    agent: null,        // https.Agent instance, allows custom proxy, certificate, keep alive, etc.\r\n    webhookReply: true  // Reply via webhook\r\n  },\r\n  username: ''          // Bot username (optional)\r\n  channelMode: false    // Handle `channel_post` updates as messages (optional)\r\n}\r\n```\r\n\r\n##### token\r\n\r\nUse this property to get/set bot token.\r\n\r\n`telegraf.token = [string]`\r\n\r\n##### webhookReply\r\n\r\nUse this property to control `reply via webhook` feature.\r\n\r\n`telegraf.webhookReply = [bool]`\r\n\r\n##### use\r\n\r\nRegisters a middleware.\r\n\r\n`telegraf.use(...middleware)`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| middleware | `function` | Middleware function |\r\n\r\n##### on\r\n\r\nRegisters middleware for provided update type.\r\n\r\n`telegraf.on(updateTypes, ...middleware)`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| updateTypes | `string/string[]` | Update type |\r\n| middleware | `function` | Middleware |\r\n\r\n##### hears\r\n\r\nRegisters middleware for handling `text` messages.\r\n\r\n`telegraf.hears(triggers, ...middleware)`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| triggers | `string/string[]/RegEx/RegEx[]/Function` | Triggers |\r\n| middleware | `function` | Middleware |\r\n\r\n##### command\r\n\r\nCommand handling.\r\n\r\n`telegraf.command(commands, ...middleware)`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| commands | `string/string[]` | Commands |\r\n| middleware | `function` | Middleware |\r\n\r\n##### start\r\n\r\nHandler for /start command.\r\n\r\n`telegraf.start(...middleware)`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| middleware | `function` | Middleware |\r\n\r\n##### help\r\n\r\nHandler for /help command.\r\n\r\n`telegraf.help(...middleware)`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| middleware | `function` | Middleware |\r\n\r\n##### settings\r\n\r\nHandler for /settings command.\r\n\r\n`telegraf.settings(...middleware)`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| middleware | `function` | Middleware |\r\n\r\n##### entity\r\n\r\nEntity handling.\r\n\r\n`telegraf.entity(entity, ...middleware)`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| entity | `string/string[]/RegEx/RegEx[]/Function` | Entity name |\r\n| middleware | `function` | Middleware |\r\n\r\n##### mention\r\n\r\nMention handling.\r\n\r\n`telegraf.mention(username, ...middleware)`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| username | `string/string[]` | Username |\r\n| middleware | `function` | Middleware |\r\n\r\n##### phone\r\n\r\nPhone number handling.\r\n\r\n`telegraf.phone(number, ...middleware)`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| number | `string/string[]` | Phone number |\r\n| middleware | `function` | Middleware |\r\n\r\n##### hashtag\r\n\r\nHashtag handling.\r\n\r\n`telegraf.hashtag(hashtag, ...middleware)`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| hashtag | `string/string[]` | Hashtag |\r\n| middleware | `function` | Middleware |\r\n\r\n##### cashtag\r\n\r\nCashtag handling.\r\n\r\n`telegraf.cashtag(cashtag, ...middleware)`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| cashtag | `string/string[]` | Cashtag |\r\n| middleware | `function` | Middleware |\r\n\r\n##### action\r\n\r\nRegisters middleware for handling `callback_data` actions with regular expressions.\r\n\r\n`telegraf.action(triggers, ...middleware)`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| triggers | `string/string[]/RegEx/RegEx[]` | Triggers |\r\n| middleware | `function` | Middleware |\r\n\r\n\r\n##### inlineQuery\r\n\r\nRegisters middleware for handling `inline_query` actions with regular expressions.\r\n\r\n`telegraf.inlineQuery(triggers, ...middleware)`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| triggers | `string/string[]/RegEx/RegEx[]` | Triggers |\r\n| middleware | `function` | Middleware |\r\n\r\n\r\n##### gameQuery\r\n\r\nRegisters middleware for handling `callback_data` actions with game query.\r\n\r\n`telegraf.gameQuery(...middleware)`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| middleware | `function` | Middleware |\r\n\r\n##### launch\r\n\r\nLaunch bot in long-polling or webhook mode. \r\n\r\n`telegraf.launch(options) =\u003e Promise`\r\n\r\n| Param | Type | Default | Description |\r\n| --- | --- | --- | --- |\r\n| [options] | `object` | Launch options |\r\n\r\nLaunch options:\r\n\r\n```js\r\n{\r\n  // Start bot in polling mode (Default)\r\n  // See startPolling reference\r\n  polling: { timeout, limit,  allowedUpdates,  stopCallback },\r\n\r\n  // Start bot in webhook mode\r\n  // See startWebhook reference\r\n  webhook: { domain, hookPath,  port,  host,  tlsOptions,  cb } \r\n}\r\n```\r\n\r\n##### startPolling\r\n\r\nStart poll updates.\r\n\r\n`telegraf.startPolling([timeout], [limit], [allowedUpdates], [stopCallback])`\r\n\r\n| Param | Type | Default | Description |\r\n| --- | --- | --- | --- |\r\n| [timeout] | `number` | 30 | Poll timeout in seconds |\r\n| [limit] | `number` | 100 | Limits the number of updates to be retrieved |\r\n| [allowedUpdates] | `string[]/string/null` | null | List the types of updates you want your bot to receive |\r\n| [stopCallback] | `function` | null | Polling stop callback |\r\n\r\n##### startWebhook\r\n\r\nStart listening @ `https://host:port/webhookPath` for Telegram calls.\r\n\r\n`telegraf.startWebhook(hookPath, [tlsOptions], port, [host])`\r\n\r\n| Param | Type | Description |\r\n| ---  | --- | --- |\r\n| hookPath | `string` | Webhook url path (see Telegraf.setWebhook) |\r\n| [tlsOptions] | `object` | [TLS server options](https://nodejs.org/api/tls.html#tls_tls_createserver_options_secureconnectionlistener). Pass null to use http |\r\n| port | `number` | Port number |\r\n| [host] | `string` | Hostname |\r\n\r\n##### stop\r\n\r\nStop Webhook and polling\r\n\r\n`telegraf.stop([callback]) =\u003e Promise`\r\n\r\n| Param | Type |\r\n| ---  | --- |\r\n| [callback] | function |\r\n\r\n##### webhookCallback\r\n\r\nReturn a callback function suitable for the http[s].createServer() method to handle a request. \r\nYou may also use this callback function to mount your telegraf app in a Connect/Express app.\r\n\r\n`telegraf.webhookCallback(webhookPath) =\u003e Function`\r\n\r\n| Param | Type | Description |\r\n| ---  | --- | --- |\r\n| webhookPath | `string` | Webhook url path (see Telegraf.setWebhook) |\r\n\r\n##### handleUpdate\r\n\r\nHandle raw Telegram update. \r\nIn case you use centralized webhook server, queue, etc.  \r\n\r\n`telegraf.handleUpdate(rawUpdate, [webhookResponse])`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| rawUpdate | `object` | Telegram update payload |\r\n| [webhookResponse] | `object` | [http.ServerResponse](https://nodejs.org/api/http.html#http_class_http_serverresponse) |\r\n\r\n##### Telegraf.compose\r\n\r\nCompose `middlewares` returning a fully valid middleware comprised of all those which are passed.\r\n\r\n`Telegraf.compose(middlewares) =\u003e function`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| middlewares | `function[]` | Array of middlewares |\r\n\r\n##### Telegraf.mount\r\n\r\nGenerates middleware for handling provided update types.\r\n\r\n`Telegraf.mount(updateTypes, ...middleware) =\u003e function`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| updateTypes | `string/string[]` | Update type |\r\n| middleware | `function` | middleware |\r\n\r\n##### Telegraf.hears\r\n\r\nGenerates middleware for handling `text` messages with regular expressions.\r\n\r\n`Telegraf.hears(triggers, ...middleware) =\u003e function`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| triggers | `string/string[]/RegEx/RegEx[]/Function/Function[]` | Triggers |\r\n| handler | `function` | Handler |\r\n\r\n##### Telegraf.action\r\n\r\nGenerates middleware for handling `callbackQuery` data with regular expressions.\r\n\r\n`Telegraf.action(triggers, ...middleware) =\u003e function`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| triggers | `string/string[]/RegEx/RegEx[]/Function/Function[]` | Triggers |\r\n| handler | `function` | Handler |\r\n\r\n##### Telegraf.inlineQuery\r\n\r\nGenerates middleware for handling `inlineQuery` data with regular expressions.\r\n\r\n`Telegraf.inlineQuery(triggers, ...middleware) =\u003e function`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| triggers | `string/string[]/RegEx/RegEx[]/Function/Function[]` | Triggers |\r\n| handler | `function` | Handler |\r\n\r\n##### Telegraf.passThru\r\n\r\nGenerates pass thru middleware.\r\n\r\n`Telegraf.passThru() =\u003e function`\r\n\r\n##### Telegraf.safePassThru\r\n\r\nGenerates safe version of pass thru middleware.\r\n\r\n`Telegraf.safePassThru() =\u003e function`\r\n\r\n##### Telegraf.optional\r\n\r\nGenerates optional middleware.\r\n\r\n`Telegraf.optional(test, ...middleware) =\u003e function`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| test | `truthy/function` | Value or predicate `(ctx) =\u003e bool` |\r\n| middleware | `function` | middleware |\r\n\r\n##### Telegraf.acl\r\n\r\nGenerates middleware for provided users only.\r\n\r\n`Telegraf.acl(userId, ...middleware) =\u003e function`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| userId | `string/string[]` | User id |\r\n| middleware | `function` | middleware |\r\n\r\n##### Telegraf.drop\r\n\r\nGenerates drop middleware.\r\n\r\n`Telegraf.drop(test) =\u003e function`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| test | `truthy/function` | Value or predicate `(ctx) =\u003e bool` |\r\n\r\n##### Telegraf.filter\r\n\r\nGenerates filter middleware.\r\n\r\n`Telegraf.filter(test) =\u003e function`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| test | `truthy/function` | Value or predicate `(ctx) =\u003e bool` |\r\n\r\n##### Telegraf.branch\r\n\r\nGenerates branch middleware.\r\n\r\n`Telegraf.branch(test, trueMiddleware, falseMiddleware) =\u003e function`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| test | `truthy/function` | Value or predicate `(ctx) =\u003e bool` |\r\n| trueMiddleware | `function` | true action  middleware |\r\n| falseMiddleware | `function` | false action middleware |\r\n\r\n\r\n##### Telegraf.email\r\n\r\nGenerates middleware for handling messages with `email` entity.\r\n\r\n`Telegraf.email(triggers, ...middleware) =\u003e function`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| triggers | `string/string[]/RegEx/RegEx[]/Function/Function[]` | Triggers |\r\n| handler | `function` | Handler |\r\n\r\n##### Telegraf.hashtag\r\n\r\nGenerates middleware for handling messages with `hashtag` entity.\r\n\r\n`Telegraf.hashtag(triggers, ...middleware) =\u003e function`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| triggers | `string/string[]/RegEx/RegEx[]/Function/Function[]` | Triggers |\r\n| handler | `function` | Handler |\r\n\r\n##### Telegraf.cashtag\r\n\r\nGenerates middleware for handling messages with `cashtag` entity.\r\n\r\n`Telegraf.cashtag(triggers, ...middleware) =\u003e function`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| triggers | `string/string[]/RegEx/RegEx[]/Function/Function[]` | Triggers |\r\n| handler | `function` | Handler |\r\n\r\n##### Telegraf.url\r\n\r\nGenerates middleware for handling messages with `url` entity.\r\n\r\n`Telegraf.url(triggers, ...middleware) =\u003e function`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| triggers | `string/string[]/RegEx/RegEx[]/Function/Function[]` | Triggers |\r\n| handler | `function` | Handler |\r\n\r\n##### Telegraf.phone\r\n\r\nGenerates middleware for handling messages with `phone` entity.\r\n\r\n`Telegraf.phone(triggers, ...middleware) =\u003e function`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| triggers | `string/string[]/RegEx/RegEx[]/Function/Function[]` | Triggers |\r\n| handler | `function` | Handler |\r\n\r\n##### Telegraf.textLink\r\n\r\nGenerates middleware for handling messages with `text_link` entity.\r\n\r\n`Telegraf.textLink(triggers, ...middleware) =\u003e function`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| triggers | `string/string[]/RegEx/RegEx[]/Function/Function[]` | Triggers |\r\n| handler | `function` | Handler |\r\n\r\n##### Telegraf.textMention\r\n\r\nGenerates middleware for handling messages with `text_mention` entity.\r\n\r\n`Telegraf.textMention(triggers, ...middleware) =\u003e function`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| triggers | `string/string[]/RegEx/RegEx[]/Function/Function[]` | Triggers |\r\n| handler | `function` | Handler |\r\n\r\n#### Telegram\r\n\r\nTelegram client API reference.\r\n\r\n```js\r\nconst Telegram = require('telegraf/telegram')\r\n```\r\n\r\n##### Constructor\r\n\r\nInitialize new Telegram client.\r\n\r\n`const telegram = new Telegram(token, [options])`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| token | `string` | [Bot Token](https://core.telegram.org/bots#3-how-do-i-create-a-bot) |\r\n| [options] | `object` | Telegram options |\r\n\r\nTelegram options:\r\n\r\n```js\r\n{\r\n  agent: null,        // https.Agent instance, allows custom proxy, certificate, keep alive, etc.\r\n  webhookReply: true  // Reply via webhook\r\n}\r\n```\r\n\r\n##### webhookReply\r\n\r\nUse this property to control `reply via webhook` feature.\r\n\r\n`telegram.webhookReply = [bool]`\r\n\r\n##### addStickerToSet\r\n\r\nUse this method to add a new sticker to a set created by the bot.\r\n\r\n`telegram.addStickerToSet(ownerId, name, stickerData) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#addstickertoset)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| ownerId | `string` | User identifier of sticker set owner |\r\n| name | `string` | Sticker set name |\r\n| stickerData | `Object` | Sticker data({png_sticker: 'stiker file', emojis: '😉', mask__position: '' }) |\r\n\r\n##### answerCbQuery\r\n\r\nUse this method to send answers to callback queries.\r\n\r\n`telegram.answerCbQuery(callbackQueryId, text, [showAlert], [extra]) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#answercallbackquery)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| callbackQueryId | `string` | Query id |\r\n| [text] | `string` | Notification text |\r\n| [showAlert] | `bool` | Show alert instead of notification |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#answercallbackquery) |\r\n\r\n##### answerGameQuery\r\n\r\nUse this method to send answers to game query.\r\n\r\n`telegram.answerGameQuery(callbackQueryId, url) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| callbackQueryId | `string` | Query id |\r\n| url | `string` | Notification text |\r\n\r\n##### answerShippingQuery\r\n\r\nUse this method to send answers to shipping query.\r\n\r\n`telegram.answerShippingQuery(shippingQueryId, ok, shippingOptions, [errorMessage]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| shippingQueryId | `string` | Shipping Query id |\r\n| ok | `bool` | Specify True if delivery to the specified address is possible |\r\n| shippingOptions | `object` | [Shipping Options](https://core.telegram.org/bots/api#answershippingquery) |\r\n| [errorMessage] | `string` | Error message in human readable form  |\r\n\r\n##### answerPreCheckoutQuery\r\n\r\nUse this method to send answers to shipping query.\r\n\r\n`telegram.answerPreCheckoutQuery(preCheckoutQueryId, ok, [errorMessage]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| preCheckoutQueryId | `string` | Shipping Query id |\r\n| ok | `bool` | Specify True if everything is alright (goods are available, etc.) |\r\n| [errorMessage] | `string` | Error message in human readable form  |\r\n\r\n##### answerInlineQuery\r\n\r\nUse this method to send answers to an inline query.\r\n\r\n`telegram.answerInlineQuery(inlineQueryId, results, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| inlineQueryId | `string` | Query id |\r\n| results | `object[]` | Results |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#answerinlinequery)|\r\n\r\n##### createNewStickerSet\r\n\r\nUse this method to create new sticker set owned by a user.\r\n\r\n`telegram.createNewStickerSet(ownerId, name, title, stickerData, [isMasks]) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#createnewstickerset)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| ownerId | `string` | User identifier of sticker set owner |\r\n| name | `string` | Sticker set name |\r\n| title | `string` | Sticker set title |\r\n| stickerData | `object` | Sticker data({png_sticker: 'stiker file', emojis: '😉', mask__position: '' }) |\r\n| [isMasks] | `bool` | Pass True, if a set of mask stickers should be created |\r\n\r\n##### deleteChatStickerSet\r\n\r\nUse this method to delete a group sticker set from a supergroup.\r\n\r\n`telegram.deleteChatStickerSet(chatId) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#deletechatstickerset)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n\r\n##### deleteMessage\r\n\r\nUse this method to delete bot messages.\r\n\r\n`telegram.deleteMessage(chatId, messageId) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#deletemessage)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| messageId | `string` | Message id |\r\n\r\n##### setStickerSetThumb\r\n\r\nUse this method to set the thumbnail of a sticker set.\r\n\r\n`telegram.setStickerSetThumb(name, userId, [thumb]) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#setstickersetthumb)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| name | `string` | Sticker set name |\r\n| userId | `string` | User identifier of the sticker set owner |\r\n| thumb | `File` | A PNG image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a TGS animation with the thumbnail up to 32 kilobytes in size |\r\n\r\n##### deleteStickerFromSet\r\n\r\nUse this method to delete a sticker from a set created by the bot.\r\n\r\n`telegram.deleteStickerFromSet(stickerId) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#deletestickerfromset)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| stickerId | `string` | File identifier of the sticker |\r\n\r\n##### editMessageCaption\r\n\r\nUse this method to edit captions of messages sent by the bot or via the bot.\r\n\r\n`telegram.editMessageCaption(chatId, messageId, inlineMessageId, caption, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| messageId | `string` | Message id |\r\n| inlineMessageId | `string` | Inline message id |\r\n| caption | `string` | Caption |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#editmessagecaption)|\r\n\r\n##### editMessageMedia\r\n\r\nUse this method to edit media of messages sent by the bot or via the bot.\r\n\r\n`telegram.editMessageMedia(chatId, messageId, inlineMessageId, media, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| messageId | `string` | Message id |\r\n| inlineMessageId | `string` | Inline message id |\r\n| media | `InputMedia` | [InputMedia](https://core.telegram.org/bots/api#inputmedia) |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#editmessagemedia)|\r\n\r\n##### editMessageLiveLocation\r\n\r\nUse this method to edit live location messages sent by the bot or via the bot.\r\n\r\n`telegram.editMessageLiveLocation(latitude, longitude, chatId, messageId, inlineMessageId, [markup]) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#editmessagelivelocation)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| latitude | `string` | Latitude of new location |\r\n| longitude | `string` | Longitude of new location |\r\n| chatId | `number/string` | Chat id |\r\n| messageId | `string` | Message id |\r\n| inlineMessageId | `string` | Inline message id |\r\n| [markup] | `object` | Keyboard markup |\r\n\r\n##### editMessageReplyMarkup\r\n\r\nUse this method to edit only the reply markup of messages sent by the bot or via the bot.\r\n\r\n`telegram.editMessageReplyMarkup(chatId, messageId, inlineMessageId, markup, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| messageId | `string` | Message id |\r\n| inlineMessageId | `string` | Inline message id |\r\n| markup | `object` | Keyboard markup |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#editmessagereplymarkup)|\r\n\r\n##### editMessageText\r\n\r\nUse this method to edit text messages sent by the bot or via the bot.\r\n\r\n`telegram.editMessageText(chatId, messageId, inlineMessageId, text, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| messageId | `string` | Message id |\r\n| inlineMessageId | `string` | Inline message id |\r\n| text | `string` | Message |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#editmessagetext)|\r\n\r\n##### forwardMessage\r\n\r\nForwards message.\r\n\r\n`telegram.forwardMessage(chatId, fromChatId, messageId, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Target Chat id |\r\n| fromChatId | `number/string` | Source Chat id |\r\n| messageId | `number` | Message id |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#forwardmessage)|\r\n\r\n\r\n##### sendCopy\r\n\r\nSends message copy.\r\n\r\n`telegram.sendCopy(chatId, message, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Target Chat id |\r\n| message | `object` | Message |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#sendmessage)|\r\n\r\n##### getWebhookInfo\r\n\r\nUse this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty.\r\n\r\n`telegram.getWebhookInfo() =\u003e Promise`\r\n\r\n##### getChat\r\n\r\nUse this method to get up to date information about the chat (current name of the user for one-on-one conversatio\r\nns, current username of a user, group or channel, etc.).\r\n\r\n`telegram.getChat(chatId) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#getchat)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n\r\n##### getChatAdministrators\r\n\r\nUse this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.\r\n\r\n`telegram.getChatAdministrators(chatId) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#getchatadministrators)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n\r\n##### setGameScore\r\n\r\nUse this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited Message, otherwise returns True. Returns an error, if the new score is not greater than the user's current score in the chat.\r\n\r\n`telegram.setGameScore(userId, score, inlineMessageId, chatId, messageId, [editMessage], [force]) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#setgamescore)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| userId | `number` | Target User id |\r\n| score | `number` | Target User id |\r\n| inlineMessageId | `string` | Inline message id |\r\n| chatId | `number/string` | Target Chat id |\r\n| messageId | `number/string` | Message id |\r\n| [editMessage] | `boolean` | edit target message, default value is True |\r\n| [force] | `boolean` | Pass True, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters |\r\n\r\n##### getGameHighScores\r\n\r\nUse this method to get data for high score tables. Will return the score of the specified user and several of his neighbors in a game. On success, returns an Array of GameHighScore objects.\r\n\r\n`telegram.getGameHighScores(userId, inlineMessageId, chatId, messageId) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#getgamehighscores)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| userId | `number`\\ | Target User id |\r\n| inlineMessageId | `string` | Inline message id |\r\n| chatId | `number/string` | Target Chat id |\r\n| messageId | `number/string` | Message id |\r\n\r\n##### getChatMember\r\n\r\nUse this method to get information about a member of a chat.\r\n\r\n`telegram.getChatMember(chatId, userId) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#getchatmember)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| userId | `number` |   User identifier |\r\n\r\n##### getChatMembersCount\r\n\r\nUse this method to get the number of members in a chat.\r\n\r\n`telegram.getChatMembersCount(chatId) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#getchatmemberscount)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n\r\n##### getFile\r\n\r\nReturns basic info about a file and prepare it for downloading.\r\n\r\n`telegram.getFile(fileId) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#getfile)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| fileId | `string` | File id |\r\n\r\n##### getFileLink\r\n\r\nReturns link to file.\r\n\r\n`telegram.getFileLink(fileId) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| fileId | `string/object` | File id or file object |\r\n\r\n##### getMe\r\n\r\nReturns basic information about the bot.\r\n\r\n`telegram.getMe() =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#getme)\r\n\r\n##### getMyCommands\r\n\r\nUse this method to get the current list of the bot's commands. \r\nRequires no parameters. Returns Array of BotCommand on success.\r\n\r\n`telegram.getMyCommands() =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#getmycommands)\r\n\r\n##### getStickerSet\r\n\r\nUse this method to get a sticker set.\r\n\r\n`telegram.getStickerSet(name) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| name | `string` | Short name of the sticker set |\r\n[Official documentation](https://core.telegram.org/bots/api#getstickerset)\r\n\r\n##### getUserProfilePhotos\r\n\r\nReturns profiles photos for provided user.\r\n\r\n`telegram.getUserProfilePhotos(userId, [offset], [limit]) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#getuserprofilephotos)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| userId | `number` | Chat id |\r\n| [offset] | `number` | Offset |\r\n| [limit] | `number` | Limit |\r\n\r\n##### setChatPermissions\r\n\r\nUse this method to set default chat permissions for all members.\r\n\r\n`telegram.setChatPermissions(chatId, permissions) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| permissions | `object` | [New default chat permissions](https://core.telegram.org/bots/api#chatpermissions)|\r\n\r\n##### kickChatMember\r\n\r\nUse this method to kick a user from a group or a supergroup.\r\n\r\n`telegram.kickChatMember(chatId, userId, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| userId | `number` | User id |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#kickchatmember)|\r\n\r\n##### restrictChatMember\r\n\r\nUse this method to restrict a user in a supergroup. \r\n\r\n`telegram.restrictChatMember(chatId, userId, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| userId | `number` | User id |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#restrictchatmember)|\r\n\r\n##### promoteChatMember\r\n\r\nUse this method to promote or demote a user in a supergroup or a channel.\r\n\r\n`telegram.promoteChatMember(chatId, userId, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| userId | `number` | User id |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#promotechatmember)|\r\n\r\n##### setChatAdministratorCustomTitle\r\n\r\nNew custom title for the administrator; 0-16 characters, emoji are not allowed\r\n\r\n`telegram.setChatAdministratorCustomTitle(chatId, userId, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| userId | `number` | User id |\r\n| title | `string` | Custom title |\r\n\r\n##### exportChatInviteLink\r\n\r\nUse this method to export an invite link to a supergroup or a channel.\r\n\r\n`telegram.exportChatInviteLink(chatId) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#exportchatinvitelink)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n\r\n##### setChatPhoto\r\n\r\nUse this method to set a new profile photo for the chat.\r\n\r\n`telegram.setChatPhoto(chatId, photo) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#setchatphoto)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| photo | `File` | New chat photo |\r\n\r\n##### deleteChatPhoto\r\n\r\nUse this method to delete a chat photo.\r\n\r\n`telegram.deleteChatPhoto(chatId) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#deletechatphoto)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n\r\n##### setChatTitle\r\n\r\nUse this method to change the title of a chat.\r\n\r\n`telegram.setChatTitle(chatId, title) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#setchattitle)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| title | `string` | New chat title, 1-255 characters |\r\n\r\n##### setChatDescription\r\n\r\nUse this method to change the description of a supergroup or a channel.\r\n\r\n`telegram.setChatDescription(chatId, description) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#setchattitle)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| description | `string` | New chat description, 0-255 characters |\r\n\r\n##### setChatStickerSet\r\n\r\nUse this method to set a new group sticker set for a supergroup. \r\n\r\n`telegram.setChatStickerSet(chatId, stickerSetName) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#setchatstickerset)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| stickerSetName | `string` | Name of the sticker set |\r\n\r\n##### pinChatMessage\r\n\r\nUse this method to pin a message in a supergroup.\r\n\r\n`telegram.pinChatMessage(chatId, messageId, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| messageId | `number` | Message id |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#pinchatmessage)|\r\n\r\n##### unpinChatMessage\r\n\r\nUse this method to unpin a message in a supergroup chat.\r\n\r\n`telegram.unpinChatMessage(chatId) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#unpinchatmessage)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n\r\n##### leaveChat\r\n\r\nUse this method for your bot to leave a group, supergroup or channel.\r\n\r\n`telegram.leaveChat(chatId) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#leavechat)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n\r\n##### deleteWebhook\r\n\r\nRemoves webhook integration.\r\n\r\n`telegram.deleteWebhook() =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#deletewebhook)\r\n\r\n##### sendAudio\r\n\r\nSends audio.\r\n\r\n`telegram.sendAudio(chatId, audio, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| audio | `File` | Document |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#sendaudio)|\r\n\r\n\r\n##### sendGame\r\n\r\nSends game.\r\n\r\n`telegram.sendGame(chatId, gameName, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| gameName | `String` | Game short name |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#sendgame)|\r\n\r\n##### sendChatAction\r\n\r\nSends chat action.\r\n\r\n`telegram.sendChatAction(chatId, action) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| action | `string` | [Chat action](https://core.telegram.org/bots/api#sendchataction) |\r\n\r\n##### sendContact\r\n\r\nSends document.\r\n\r\n`telegram.sendContact(chatId, phoneNumber, firstName, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| phoneNumber | `string` | Contact phone number |\r\n| firstName | `string` | Contact first name |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#sendcontact)|\r\n\r\n##### sendDice\r\n\r\nSends dice.\r\n\r\n`telegram.sendDice(chatId, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#senddice)|\r\n\r\n##### sendDocument\r\n\r\nSends document.\r\n\r\n`telegram.sendDocument(chatId, doc, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| doc | `File` | Document |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#senddocument)|\r\n\r\n##### sendLocation\r\n\r\nSends location.\r\n\r\n`telegram.sendLocation(chatId, latitude, longitude, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| latitude | `number` | Latitude |\r\n| longitude | `number` | Longitude |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#sendlocation)|\r\n\r\n##### sendMessage\r\n\r\nSends text message.\r\n\r\n`telegram.sendMessage(chatId, text, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| text | `string` | Message |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#sendmessage)|\r\n\r\n##### sendPhoto\r\n\r\nSends photo.\r\n\r\n`telegram.sendPhoto(chatId, photo, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| photo | `File` | Photo |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#sendphoto)|\r\n\r\n##### sendMediaGroup\r\n\r\nSends media album.\r\n\r\n`telegram.sendMediaGroup(chatId, media, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| media | `InputMedia[]` | Media array |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#sendmediagroup)|\r\n\r\n##### sendSticker\r\n\r\nSends sticker.\r\n\r\n`telegram.sendSticker(chatId, sticker, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| sticker | `File` | Document |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#sendsticker)|\r\n\r\n##### setStickerPositionInSet\r\n\r\nUse this method to move a sticker in a set created by the bot to a specific position.\r\n\r\n`telegram.setStickerPositionInSet(sticker, position) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| sticker | `string` | File identifier of the sticker |\r\n| position | `number` | New sticker position in the set, zero-based |\r\n\r\n##### sendVenue\r\n\r\nSends venue information.\r\n\r\n`telegram.sendVenue(chatId, latitude, longitude, title, address, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| latitude | `number` | Latitude |\r\n| longitude | `number` | Longitude |\r\n| title | `string` | Venue title |\r\n| address | `string` | Venue address |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#sendvenue)|\r\n\r\n##### sendInvoice\r\n\r\nSends invoice.\r\n\r\n`telegram.sendInvoice(chatId, invoice) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| invoice | `object` | [Invoice object](https://core.telegram.org/bots/api#sendinvoice) |\r\n\r\n##### sendVideo\r\n\r\nSends video.\r\n\r\n`telegram.sendVideo(chatId, video, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| video | `File` | Document |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#sendvideo)|\r\n\r\n##### sendAnimation\r\n\r\nSends video.\r\n\r\n`telegram.sendAnimation(chatId, animation, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| animation | `File` | Document |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#sendanimation)|\r\n\r\n##### sendVideoNote\r\n\r\nSends round video.\r\n\r\n`telegram.sendVideoNote(chatId, video, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| video | `File` | Video note file |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#sendvideonote)|\r\n\r\n##### sendVoice\r\n\r\nSends voice.\r\n\r\n`telegram.sendVoice(chatId, voice, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| voice | `File/string` | File, file id or HTTP URL |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#sendvoice)|\r\n\r\n##### sendPoll\r\n\r\nSends anonymous poll.\r\n\r\n`telegram.sendPoll(chatId, question, options, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| question | `string` | Poll question |\r\n| options | `string[]` | Answer options |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#sendpoll)|\r\n\r\n##### setMyCommands\r\n\r\nUse this method to change the list of the bot's commands\r\n\r\n`telegram.setMyCommands(commands) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| commands | `object[]` | [List of bot commands](https://core.telegram.org/bots/api#setmycommands) |\r\n\r\n##### sendQuiz\r\n\r\nSends quiz.\r\n\r\n`telegram.sendQuiz(chatId, question, options, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| question | `string` | Poll question |\r\n| options | `string[]` | Answer options |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#sendpoll)|\r\n\r\n\r\n##### stopPoll\r\n\r\nStops anonymous poll.\r\n\r\n`telegram.stopPoll(chatId, messageId, [extra]) =\u003e Promise`\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| messageId | `string` | Poll message id |\r\n| options| `string[]` | Answer options |\r\n| [extra] | `object` | [Extra parameters](https://core.telegram.org/bots/api#stoppoll)|\r\n\r\n##### stopMessageLiveLocation\r\n\r\nUse this method to stop updating a live location message sent by the bot or via the bot (for inline bots) before live_period expires.\r\n\r\n`telegram.stopMessageLiveLocation(chatId, messageId, inlineMessageId, [markup]) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#stopmessagelivelocation)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| messageId | `string` | Message id |\r\n| inlineMessageId | `string` | Inline message id |\r\n| [markup] | `object` | Keyboard markup |\r\n\r\n##### uploadStickerFile\r\n\r\nUse this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods.\r\n\r\n`telegram.uploadStickerFile(ownerId, stickerFile) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#uploadstickerfile)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| ownerId | `string` | User identifier of sticker file owner |\r\n| stickerFile | `File` | Png image with the sticker |\r\n\r\n##### setWebhook\r\n\r\nSpecifies an url to receive incoming updates via an outgoing webhook.\r\n\r\n`telegram.setWebhook(url, [cert], [maxConnections], [allowedUpdates]) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#setwebhook)\r\n\r\n| Param | Type | Description |\r\n| ---  | --- | --- |\r\n| url  | `string` | Public url for webhook |\r\n| [cert] | `File` | SSL public certificate |\r\n| [maxConnections] | `number` | Maximum allowed number of simultaneous HTTPS connections to the webhook |\r\n| [allowedUpdates] | `string[]` | List the types of updates you want your bot to receive |\r\n\r\n##### unbanChatMember\r\n\r\nUse this method to unban a previously kicked user in a supergroup.\r\n\r\n`telegram.unbanChatMember(chatId, userId) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#unbanchatmember)\r\n\r\n| Param | Type | Description |\r\n| --- | --- | --- |\r\n| chatId | `number/string` | Chat id |\r\n| userId | `number` | User id |\r\n\r\n\r\n##### setPassportDataErrors\r\n\r\nInforms a user that some of the Telegram Passport elements they provided contains errors. \r\nThe user will not be able to re-submit their Passport to you \r\nuntil the errors are fixed (the contents of the field for which you returned the error must change).\r\n\r\n`telegram.setPassportDataErrors(errors) =\u003e Promise`\r\n[Official documentation](https://core.telegram.org/bots/api#setpassportdataerrors)\r\n\r\n| Param | Type | Description |\r\n| ---  | --- | --- |\r\n| [errors] | `PassportElementError[]` | An array describing the errors |\r\n\r\n#### Extra\r\n\r\nTelegram message options helper, [see examples](https://github.com/telegraf/telegraf/tree/3.38.0/docs/examples/).\r\n\r\n#### Markup\r\n\r\nTelegram markup helper, [see examples](https://github.com/telegraf/telegraf/tree/3.38.0/docs/examples/).\r\n\r\n#### Stage\r\n\r\nSimple scene-based control flow middleware.\r\n\r\n```js\r\nconst { Telegraf } = require('telegraf')\r\nconst session = require('telegraf/session')\r\nconst Stage = require('telegraf/stage')\r\nconst Scene = require('telegraf/scenes/base')\r\nconst { leave } = Stage\r\n\r\n// Greeter scene\r\nconst greeter = new Scene('greeter')\r\ngreeter.enter((ctx) =\u003e ctx.reply('Hi'))\r\ngreeter.leave((ctx) =\u003e ctx.reply('Bye'))\r\ngreeter.hears(/hi/gi, leave())\r\ngreeter.on('message', (ctx) =\u003e ctx.reply('Send `hi`'))\r\n\r\n// Create scene manager\r\nconst stage = new Stage()\r\nstage.command('cancel', leave())\r\n\r\n// Scene registration\r\nstage.register(greeter)\r\n\r\nconst bot = new Telegraf(process.env.BOT_TOKEN)\r\nbot.use(session())\r\nbot.use(stage.middleware())\r\nbot.command('greeter', (ctx) =\u003e ctx.scene.enter('greeter'))\r\nbot.startPolling()\r\n```\r\n\r\nScenes related context props and functions:\r\n\r\nMore documentation on Scenes and Stages, [see issue](https://github.com/telegraf/telegraf/issues/705).\r\n\r\n```js\r\nbot.on('message', (ctx) =\u003e {\r\n  ctx.scene.state                                    // Current scene state (persistent)\r\n  ctx.scene.enter(sceneId, [defaultState, silent])   // Enter scene\r\n  ctx.scene.reenter()                                // Reenter current scene\r\n  ctx.scene.leave()                                  // Leave scene\r\n}) \r\n```\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmurka%2Ftelegraf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmurka%2Ftelegraf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmurka%2Ftelegraf/lists"}