From 28e9c8b4c449034aedf0f3b55d93432ef4113122 Mon Sep 17 00:00:00 2001 From: Yago Date: Sun, 20 Mar 2016 20:14:56 +0100 Subject: [PATCH] Generated doc --- README.md | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e5e5fa2..5a44b47 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ Once they are generated, the `crt.pem` can be provided to `telegramBot.setWebHoo ## API Reference + ## TelegramBot TelegramBot @@ -79,6 +80,7 @@ TelegramBot * [.onReplyToMessage(chatId, messageId, callback)](#TelegramBot+onReplyToMessage) + ### new TelegramBot(token, [options]) Both request method to obtain messages are implemented. To use standard polling, set `polling: true` on `options`. Notice that [webHook](https://core.telegram.org/bots/api#setwebhook) will need a SSL certificate. @@ -97,12 +99,14 @@ Emits `message` when a message arrives. | [options.webHook.cert] | String | | PEM certificate (public) to webHook server. | + ### telegramBot.getMe() ⇒ Promise Returns basic information about the bot in form of a `User` object. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#getme + ### telegramBot.setWebHook(url, [cert]) Specify an url to receive incoming updates via an outgoing webHook. @@ -115,6 +119,7 @@ Specify an url to receive incoming updates via an outgoing webHook. | [cert] | String | stream.Stream | PEM certificate key (public). | + ### telegramBot.getUpdates([timeout], [limit], [offset]) ⇒ Promise Use this method to receive incoming updates using long polling @@ -129,6 +134,7 @@ Use this method to receive incoming updates using long polling | [offset] | Number | String | Identifier of the first update to be returned. | + ### telegramBot.sendMessage(chatId, text, [options]) ⇒ Promise Send text message. @@ -142,6 +148,7 @@ Send text message. | [options] | Object | Additional Telegram query options | + ### telegramBot.answerInlineQuery(inlineQueryId, results, [options]) ⇒ Promise Send answers to an inline query. @@ -155,6 +162,7 @@ Send answers to an inline query. | [options] | Object | Additional Telegram query options | + ### telegramBot.forwardMessage(chatId, fromChatId, messageId) ⇒ Promise Forward messages of any kind. @@ -167,6 +175,7 @@ Forward messages of any kind. | messageId | Number | String | Unique message identifier | + ### telegramBot.sendPhoto(chatId, photo, [options]) ⇒ Promise Send photo @@ -180,6 +189,7 @@ Send photo | [options] | Object | Additional Telegram query options | + ### telegramBot.sendAudio(chatId, audio, [options]) ⇒ Promise Send audio @@ -193,6 +203,7 @@ Send audio | [options] | Object | Additional Telegram query options | + ### telegramBot.sendDocument(chatId, doc, [options]) ⇒ Promise Send Document @@ -206,6 +217,7 @@ Send Document | [options] | Object | Additional Telegram query options | + ### telegramBot.sendSticker(chatId, sticker, [options]) ⇒ Promise Send .webp stickers. @@ -219,6 +231,7 @@ Send .webp stickers. | [options] | Object | Additional Telegram query options | + ### telegramBot.sendVideo(chatId, video, [options]) ⇒ Promise Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). @@ -232,6 +245,7 @@ Use this method to send video files, Telegram clients support mp4 videos (other | [options] | Object | Additional Telegram query options | + ### telegramBot.sendVoice(chatId, voice, [options]) ⇒ Promise Send voice @@ -245,6 +259,7 @@ Send voice | [options] | Object | Additional Telegram query options | + ### telegramBot.sendChatAction(chatId, action) ⇒ Promise Send chat action. `typing` for text messages, @@ -261,6 +276,7 @@ Send chat action. | action | String | Type of action to broadcast. | + ### telegramBot.getUserProfilePhotos(userId, [offset], [limit]) ⇒ Promise Use this method to get a list of profile pictures for a user. Returns a [UserProfilePhotos](https://core.telegram.org/bots/api#userprofilephotos) object. @@ -275,6 +291,7 @@ Returns a [UserProfilePhotos](https://core.telegram.org/bots/api#userprofilephot | [limit] | Number | Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100. | + ### telegramBot.sendLocation(chatId, latitude, longitude, [options]) ⇒ Promise Send location. Use this method to send point on the map. @@ -290,6 +307,7 @@ Use this method to send point on the map. | [options] | Object | Additional Telegram query options | + ### telegramBot.getFile(fileId) ⇒ Promise Get file. Use this method to get basic info about a file and prepare it for downloading. @@ -303,12 +321,14 @@ Attention: link will be valid for 1 hour. | fileId | String | File identifier to get info about | + ### telegramBot.getFileLink(fileId) ⇒ Promise Get link for file. Use this method to get link for file for subsequent use. Attention: link will be valid for 1 hour. -This method is a sugar extension of the (getFile)[#getfilefileid] method, which returns just path to file on remote server (you will have to manually build full uri after that). +This method is a sugar extension of the (getFile)[#getfilefileid] method, +which returns just path to file on remote server (you will have to manually build full uri after that). **Kind**: instance method of [TelegramBot](#TelegramBot) **Returns**: Promise - promise Promise which will have *fileURI* in resolve callback @@ -319,6 +339,7 @@ This method is a sugar extension of the (getFile)[#getfilefileid] method, which | fileId | String | File identifier to get info about | + ### telegramBot.downloadFile(fileId, downloadDir) ⇒ Promise Downloads file in the specified folder. This is just a sugar for (getFile)[#getfilefiled] method @@ -332,6 +353,7 @@ This is just a sugar for (getFile)[#getfilefiled] method | downloadDir | String | Absolute path to the folder in which file will be saved | + ### telegramBot.onText(regexp, callback) Register a RegExp to test against an incomming text message. @@ -343,6 +365,7 @@ Register a RegExp to test against an incomming text message. | callback | function | Callback will be called with 2 parameters, the `msg` and the result of executing `regexp.exec` on message text. | + ### telegramBot.onReplyToMessage(chatId, messageId, callback) Register a reply to wait for a message response. @@ -352,6 +375,6 @@ Register a reply to wait for a message response. | --- | --- | --- | | chatId | Number | String | The chat id where the message cames from. | | messageId | Number | String | The message id to be replied. | -| callback | function | Callback will be called with the reply message. | +| callback | function | Callback will be called with the reply message. | * * *