1.0.1 • Published 4 years ago

telegram-bot-min v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

Telegram Bot API

Install

npm i --save telegram-bot-min

Usage

const TelegramBot = require('telegram-bot-min')
const tgbot = new TelegramBot(token)
const botInfo = await tgbot.getMe()

Init

new TelegramBot(token)

Methods

request(method, data, optionsagent?)

getMe()

getWebhookInfo()

getUpdates(optionsoffset, limit, timeout, allowedUpdates?)

getFile(fileId)

getUserProfilePhotos(userId, optionsoffset, limit?)

getChat(chatId)

getChatAdministrators(chatId)

getChatMembersCount(chatId)

getChatMember(chatId, userId)

getMyCommands()

getStickerSet(name)

getGameHighScores(chatId, messageId, userId)

getInlineGameHighScores(inlineMessageId, userId)

setWebhook(url, optionscertificate, maxConnections, allowedUpdates?)

deleteWebhook()

sendChatAction(chatId, action)

kickChatMember(chatId, userId, optionsuntilDate?)

unbanChatMember(chatId, userId)

restrictChatMember(chatId, userId, permissions, optionsuntilDate?)

promoteChatMember(chatId, userId, optionscanChangeInfo, canPostMessages, canEditMessages, canDeleteMessages, canInviteUsers, canRestrictMembers, canPinMessages, canPromoteMembers?)

setChatAdministratorCustomTitle(chatId, userId, customTitle)

removeChatAdministratorCustomTitle(chatId, userId)

setChatPermissions(chatId, permissions)

setChatPhoto(chatId, photo)

deleteChatPhoto(chatId)

setChatTitle(chatId, title)

setChatDescription(chatId, description)

removeChatDescription(chatId)

pinChatMessage(chatId, messageId, optionsdisableNotification?)

unpinChatMessage(chatId)

leaveChat(chatId)

setChatStickerSet(chatId, stickerSetName)

deleteChatStickerSet(chatId)

answerCallbackQuery(callbackQueryId, optionstext, showAlert, url, cacheTime?)

setMyCommands(commands)

deleteMessage(chatId, messageId)

createNewStickerSet(userId, name, title, pngSticker, emojis, optionscontainsMasks, maskPosition?)

createNewAnimatedStickerSet(userId, name, title, tgsSticker, emojis, optionscontainsMasks, maskPosition?)

addStickerToSet(userId, name, pngSticker, emojis, optionsmaskPosition?)

addAnimatedStickerToSet(userId, name, tgsSticker, emojis, optionsmaskPosition?)

setStickerPositionInSet(sticker, position)

deleteStickerFromSet(sticker)

setStickerSetThumb(userId, name, thumb)

answerInlineQuery(inlineQueryId, results, optionscacheTime, isPersonal, nextOffset, switchPmText, switchPmParameter?)

answerShippingQuery(shippingQueryId, shippingOptions)

answerShippingQueryError(shippingQueryId, errorMessage)

answerPreCheckoutQuery(preCheckoutQueryId)

answerPreCheckoutQueryError(preCheckoutQueryId, errorMessage)

setPassportDataErrors(userId, errors)

setGameScore(chatId, messageId, userId, score, optionsforce, disableEditMessage?)

setInlineGameScore(inlineMessageId, userId, score, optionsforce, disableEditMessage?)

sendMessage(chatId, text, optionsparseMode, disableWebPagePreview, disableNotification, replyToMessageId, replyMarkup?)

forwardMessage(fromChatId, messageId, chatId, optionsdisableNotification?)

sendPhoto(chatId, photo, optionscaption, parseMode, disableNotification, replyToMessageId, replyMarkup?)

sendAudio(chatId, audio, optionsthumb, caption, parseMode, duration, performer, title, disableNotification, replyToMessageId, replyMarkup?)

sendDocument(chatId, document, optionsthumb, caption, parseMode, disableNotification, replyToMessageId, replyMarkup?)

sendVideo(chatId, video, optionsthumb, caption, parseMode, duration, width, height, supportsStreaming, disableNotification, replyToMessageId, replyMarkup?)

sendAnimation(chatId, animation, optionsthumb, caption, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup?)

sendVoice(chatId, voice, optionscaption, parseMode, duration, disableNotification, replyToMessageId, replyMarkup?)

sendVideoNote(chatId, videoNote, optionsthumb, duration, length, disableNotification, replyToMessageId, replyMarkup?)

sendMediaGroup(chatId, media, optionsdisableNotification, replyToMessageId?)

sendLocation(chatId, latitude, longitude, optionslivePeriod, disableNotification, replyToMessageId, replyMarkup?)

editMessageLiveLocation(chatId, messageId, latitude, longitude, optionsreplyMarkup?)

editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, optionsreplyMarkup?)

stopMessageLiveLocation(chatId, messageId, optionsreplyMarkup?)

stopInlineMessageLiveLocation(inlineMessageId, optionsreplyMarkup?)

sendVenue(chatId, latitude, longitude, title, address, optionsfoursquareId, foursquareType, disableNotification, replyToMessageId, replyMarkup?)

sendContact(chatId, phoneNumber, firstName, optionslastName, vcard, disableNotification, replyToMessageId, replyMarkup?)

sendPoll(chatId, question, pollOptions, optionsisAnonymous, type, allowsMultipleAnswers, correctOptionId, isClosed, disableNotification, replyToMessageId, replyMarkup?)

sendDice(chatId, optionsdisableNotification, replyToMessageId, replyMarkup?)

exportChatInviteLink(chatId)

editMessageText(chatId, messageId, text, optionsparseMode, disableWebPagePreview, replyMarkup?)

editInlineMessageText(inlineMessageId, text, optionsparseMode, disableWebPagePreview, replyMarkup?)

editMessageCaption(chatId, messageId, caption, optionsparseMode, replyMarkup?)

removeMessageCaption(chatId, messageId, optionsreplyMarkup?)

editInlineMessageCaption(inlineMessageId, caption, optionsparseMode, replyMarkup?)

removeInlineMessageCaption(inlineMessageId, optionsreplyMarkup?)

editMessageMedia(chatId, messageId, media, optionsreplyMarkup?)

editInlineMessageMedia(inlineMessageId, media, optionsreplyMarkup?)

editMessageReplyMarkup(chatId, messageId, replyMarkup)

removeMessageReplyMarkup(chatId, messageId)

editInlineMessageReplyMarkup(inlineMessageId, replyMarkup)

removeInlineMessageReplyMarkup(inlineMessageId)

stopPoll(chatId, messageId, optionsreplyMarkup?)

sendSticker(chatId, sticker, optionsdisableNotification, replyToMessageId, replyMarkup?)

uploadStickerFile(userId, pngSticker)

sendInvoice(chatId, title, description, optionspayload, providerToken, startParameter, currency, prices, providerData, photoUrl, photoSize, photoWidth, photoHeight, needName, needPhoneNumber, needEmail, needShippingAddress, sendPhoneNumberToProvider, sendEmailToProvider, isFlexible, disableNotification, replyToMessageId, replyMarkup)

sendGame(chatId, gameShortName, optionsdisableNotification, replyToMessageId, replyMarkup?)

serialize(data) // from camelCase to snake_case

deserialize(data) // from snake_case to camelCase