1.0.1 • Published 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()
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)
deleteWebhook()
sendChatAction(chatId, action)
kickChatMember(chatId, userId, optionsuntilDate?)
unbanChatMember(chatId, userId)
restrictChatMember(chatId, userId, permissions, optionsuntilDate?)
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)
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)
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?)
forwardMessage(fromChatId, messageId, chatId, optionsdisableNotification?)
editMessageLiveLocation(chatId, messageId, latitude, longitude, optionsreplyMarkup?)
editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, optionsreplyMarkup?)
stopMessageLiveLocation(chatId, messageId, optionsreplyMarkup?)
stopInlineMessageLiveLocation(inlineMessageId, optionsreplyMarkup?)
exportChatInviteLink(chatId)
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?)
uploadStickerFile(userId, pngSticker)
serialize(data) // from camelCase to snake_case
deserialize(data) // from snake_case to camelCase