Telegram

Semua berkenaan dengan method dari bot api telegram

RESUME

Table resume semua properti yang melekat pada bot.telegram.


bot.telegram dapat juga disingkat menjadi bot.tg

variable bot bisa apa saja. Oleh karena dalam list ini, cukup dituliskan method telegram agar disesuaikan dengan variable penyertanya sendiri.

callApi

Main method to call api telegram.

telegram.callApi(method, data)
Param Type Description
method string method of Bot Api Telegram
data json params of Bot Api Telegram

addStickerToSet

Use this method to add a new sticker to a set created by the bot.

telegram.addStickerToSet(ownerId, name, stickerData) 👉🏼 📑

Param Type Description
ownerId string User identifier of sticker set owner
name string Sticker set name
stickerData Object Sticker data({png_sticker: ‘stiker file’, emojis: ‘😉’, mask__position: '' })

answerCallbackQuery

alias untuk answerCbQuery

answerCbQuery

Use this method to send answers to callback queries.

telegram.answerCbQuery(callbackQueryId, text, [showAlert], [extra]) 👉🏼 📑

Param Type Description
callbackQueryId string Query id
[text] string Notification text
[showAlert] bool Show alert instead of notification
[extra] object Extra parameters

answerGameQuery

Use this method to send answers to game query.

telegram.answerGameQuery(callbackQueryId, url)

Param Type Description
callbackQueryId string Query id
url string Notification text

answerShippingQuery

Use this method to send answers to shipping query.

telegram.answerShippingQuery(shippingQueryId, ok, shippingOptions, [errorMessage])

Param Type Description
shippingQueryId string Shipping Query id
ok bool Specify True if delivery to the specified address is possible
shippingOptions object Shipping Options
[errorMessage] string Error message in human readable form

answerPreCheckoutQuery

Use this method to send answers to shipping query.

telegram.answerPreCheckoutQuery(preCheckoutQueryId, ok, [errorMessage])

Param Type Description
preCheckoutQueryId string Shipping Query id
ok bool Specify True if everything is alright (goods are available, etc.)
[errorMessage] string Error message in human readable form

answerInlineQuery

Use this method to send answers to an inline query.

telegram.answerInlineQuery(inlineQueryId, results, [extra])

Param Type Description
inlineQueryId string Query id
results object[] Results
[extra] object Extra parameters

approveChatJoinRequest

Use this method to approve a chat join request.

telegram.approveChatJoinRequest(chatId, userId, [extra])

Param Type Description
chatId number/string Chat id
userId number User id
[extra] object Extra parameters

banChatSenderChat

Use this method to ban a channel chat in a supergroup or a channel.

banChatSenderChat(chatId, senderChatId, extra) 👉🏼 📑

Param Type Description
chatId number/string Chat id
senderChatId number Sender id
[extra] object Extra parameters

createNewStickerSet

Use this method to create new sticker set owned by a user.

telegram.createNewStickerSet(ownerId, name, title, stickerData, [isMasks]) 👉🏼 📑

Param Type Description
ownerId string User identifier of sticker set owner
name string Sticker set name
title string Sticker set title
stickerData object Sticker data({png_sticker: ‘stiker file’, emojis: ‘😉’, mask__position: '' })
[isMasks] bool Pass True, if a set of mask stickers should be created

declineChatJoinRequest

Use this method to decline a chat join request.

telegram.declineChatJoinRequest(chatId, userId, [extra])

Param Type Description
chatId number/string Chat id
userId number User id
[extra] object Extra parameters

deleteChatStickerSet

Use this method to delete a group sticker set from a supergroup.

telegram.deleteChatStickerSet(chatId) 👉🏼 📑

Param Type Description
chatId number/string Chat id

deleteMessage

Use this method to delete bot messages.

telegram.deleteMessage(chatId, messageId) 👉🏼 📑

Param Type Description
chatId number/string Chat id
messageId string Message id

setStickerSetThumb

Use this method to set the thumbnail of a sticker set.

telegram.setStickerSetThumb(name, userId, [thumb]) 👉🏼 📑

Param Type Description
name string Sticker set name
userId string User identifier of the sticker set owner
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

deleteStickerFromSet

Use this method to delete a sticker from a set created by the bot.

telegram.deleteStickerFromSet(stickerId) 👉🏼 📑

Param Type Description
stickerId string File identifier of the sticker

editMessageCaption

Use this method to edit captions of messages sent by the bot or via the bot.

telegram.editMessageCaption(chatId, messageId, inlineMessageId, caption, [extra])

Param Type Description
chatId number/string Chat id
messageId string Message id
inlineMessageId string Inline message id
caption string Caption
[extra] object Extra parameters

editMessageMedia

Use this method to edit media of messages sent by the bot or via the bot.

telegram.editMessageMedia(chatId, messageId, inlineMessageId, media, [extra])

Param Type Description
chatId number/string Chat id
messageId string Message id
inlineMessageId string Inline message id
media InputMedia InputMedia
[extra] object Extra parameters

editMessageLiveLocation

Use this method to edit live location messages sent by the bot or via the bot.

telegram.editMessageLiveLocation(latitude, longitude, chatId, messageId, inlineMessageId, [markup]) 👉🏼 📑

Param Type Description
latitude string Latitude of new location
longitude string Longitude of new location
chatId number/string Chat id
messageId string Message id
inlineMessageId string Inline message id
[markup] object Keyboard markup
[extra] object Extra parameters

editMessageReplyMarkup

Use this method to edit only the reply markup of messages sent by the bot or via the bot.

telegram.editMessageReplyMarkup(chatId, messageId, inlineMessageId, markup, [extra])

Param Type Description
chatId number/string Chat id
messageId string Message id
inlineMessageId string Inline message id
markup object Keyboard markup
[extra] object Extra parameters

editMessageText

Use this method to edit text messages sent by the bot or via the bot.

telegram.editMessageText(chatId, messageId, inlineMessageId, text, [extra])

Param Type Description
chatId number/string Chat id
messageId string Message id
inlineMessageId string Inline message id
text string Message
[extra] object Extra parameters

forwardMessage

Forwards message.

telegram.forwardMessage(chatId, fromChatId, messageId, [extra])

Param Type Description
chatId number/string Target Chat id
fromChatId number/string Source Chat id
messageId number Message id
[extra] object Extra parameters

sendCopy

Sends message copy.

telegram.sendCopy(chatId, message, [extra])

Param Type Description
chatId number/string Target Chat id
message object Message
[extra] object Extra parameters

copyMessage

Use this method to copy messages of any kind.

telegram.copyMessage(chatId, message, [extra])

Param Type Description
chatId number/string Target Chat id
fromChatId number/string Source Chat id
messageId number Message id
[extra] object Extra parameters

getWebhookInfo

Use 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.

telegram.getWebhookInfo()

getChat

Use this method to get up to date information about the chat (current name of the user for one-on-one conversatio ns, current username of a user, group or channel, etc.).

telegram.getChat(chatId) 👉🏼 📑

Param Type Description
chatId number/string Chat id

getChatAdministrators

Use 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.

telegram.getChatAdministrators(chatId) 👉🏼 📑

Param Type Description
chatId number/string Chat id

setGameScore

Use 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.

telegram.setGameScore(userId, score, inlineMessageId, chatId, messageId, [editMessage], [force]) 👉🏼 📑

Param Type Description
userId number Target User id
score number Target User id
inlineMessageId string Inline message id
chatId number/string Target Chat id
messageId number/string Message id
[editMessage] boolean edit target message, default value is True
[force] boolean Pass True, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters

getGameHighScores

Use 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.

telegram.getGameHighScores(userId, inlineMessageId, chatId, messageId) 👉🏼 📑

Param Type Description
userId number\ Target User id
inlineMessageId string Inline message id
chatId number/string Target Chat id
messageId number/string Message id

getChatMember

Use this method to get information about a member of a chat.

telegram.getChatMember(chatId, userId) 👉🏼 📑

Param Type Description
chatId number/string Chat id
userId number User identifier

getChatMembersCount

Use this method to get the number of members in a chat.

telegram.getChatMembersCount(chatId) 👉🏼 📑

Param Type Description
chatId number/string Chat id

getFile

Returns basic info about a file and prepare it for downloading.

telegram.getFile(fileId) 👉🏼 📑

Param Type Description
fileId string File id

Returns link to file.

telegram.getFileLink(fileId)

Param Type Description
fileId string/object File id or file object

getMe

Returns basic information about the bot.

telegram.getMe() 👉🏼 📑

getMyCommands

Use this method to get the current list of the bot’s commands. Requires no parameters. Returns Array of BotCommand on success.

telegram.getMyCommands() 👉🏼 📑

getStickerSet

Use this method to get a sticker set.

telegram.getStickerSet(name)

Param Type Description
name string Short name of the sticker set
👉🏼 📑

getUserProfilePhotos

Returns profiles photos for provided user.

telegram.getUserProfilePhotos(userId, [offset], [limit]) 👉🏼 📑

Param Type Description
userId number Chat id
[offset] number Offset
[limit] number Limit

setChatPermissions

Use this method to set default chat permissions for all members.

telegram.setChatPermissions(chatId, permissions)

Param Type Description
chatId number/string Chat id
permissions object New default chat permissions

banChatMember

Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc.

telegram.banChatMember(chatId, userId, [extra])

Param Type Description
chatId number/string Chat id
userId number User id
[extra] object Extra parameters

restrictChatMember

Use this method to restrict a user in a supergroup.

telegram.restrictChatMember(chatId, userId, [extra])

Param Type Description
chatId number/string Chat id
userId number User id
[extra] object Extra parameters

promoteChatMember

Use this method to promote or demote a user in a supergroup or a channel.

telegram.promoteChatMember(chatId, userId, [extra])

Param Type Description
chatId number/string Chat id
userId number User id
[extra] object Extra parameters

setChatAdministratorCustomTitle

New custom title for the administrator; 0-16 characters, emoji are not allowed

telegram.setChatAdministratorCustomTitle(chatId, userId, [extra])

Param Type Description
chatId number/string Chat id
userId number User id
title string Custom title

Use this method to export an invite link to a supergroup or a channel.

telegram.exportChatInviteLink(chatId) 👉🏼 📑

Param Type Description
chatId number/string Chat id

setChatPhoto

Use this method to set a new profile photo for the chat.

telegram.setChatPhoto(chatId, photo) 👉🏼 📑

Param Type Description
chatId number/string Chat id
photo File New chat photo

deleteChatPhoto

Use this method to delete a chat photo.

telegram.deleteChatPhoto(chatId) 👉🏼 📑

Param Type Description
chatId number/string Chat id

setChatTitle

Use this method to change the title of a chat.

telegram.setChatTitle(chatId, title) 👉🏼 📑

Param Type Description
chatId number/string Chat id
title string New chat title, 1-255 characters

setChatDescription

Use this method to change the description of a supergroup or a channel.

telegram.setChatDescription(chatId, description) 👉🏼 📑

Param Type Description
chatId number/string Chat id
description string New chat description, 0-255 characters

setChatStickerSet

Use this method to set a new group sticker set for a supergroup.

telegram.setChatStickerSet(chatId, stickerSetName) 👉🏼 📑

Param Type Description
chatId number/string Chat id
stickerSetName string Name of the sticker set

pinChatMessage

Use this method to pin a message in a supergroup.

telegram.pinChatMessage(chatId, messageId, [extra])

Param Type Description
chatId number/string Chat id
messageId number Message id
[extra] object Extra parameters

unpinChatMessage

Use this method to unpin a message in a supergroup chat.

telegram.unpinChatMessage(chatId) 👉🏼 📑

Param Type Description
chatId number/string Chat id
[extra] object Extra parameters

unpinAllChatMessages

Use this method to clear the list of pinned messages in a chat

telegram.unpinAllChatMessages(chatId) 👉🏼 📑

Param Type Description
chatId number/string Chat id

leaveChat

Use this method for your bot to leave a group, supergroup or channel.

telegram.leaveChat(chatId) 👉🏼 📑

Param Type Description
chatId number/string Chat id

deleteWebhook

Removes webhook integration.

telegram.deleteWebhook() 👉🏼 📑

Param Type Description
[extra] object Extra parameters

sendAudio

Sends audio.

telegram.sendAudio(chatId, audio, [extra])

Param Type Description
chatId number/string Chat id
audio File Document
[extra] object Extra parameters

sendGame

Sends game.

telegram.sendGame(chatId, gameName, [extra])

Param Type Description
chatId number/string Chat id
gameName String Game short name
[extra] object Extra parameters

sendChatAction

Sends chat action.

telegram.sendChatAction(chatId, action)

Param Type Description
chatId number/string Chat id
action string Chat action

sendContact

Sends document.

telegram.sendContact(chatId, phoneNumber, firstName, [extra])

Param Type Description
chatId number/string Chat id
phoneNumber string Contact phone number
firstName string Contact first name
[extra] object Extra parameters

sendDice

Sends dice.

telegram.sendDice(chatId, [extra])

Param Type Description
chatId number/string Chat id
[extra] object Extra parameters

sendDocument

Sends document.

telegram.sendDocument(chatId, doc, [extra])

Param Type Description
chatId number/string Chat id
doc File Document
[extra] object Extra parameters

sendLocation

Sends location.

telegram.sendLocation(chatId, latitude, longitude, [extra])

Param Type Description
chatId number/string Chat id
latitude number Latitude
longitude number Longitude
[extra] object Extra parameters

sendMessage

Sends text message.

telegram.sendMessage(chatId, text, [extra])

Param Type Description
chatId number/string Chat id
text string Message
[extra] object Extra parameters

sendPhoto

Sends a photo.

telegram.sendPhoto(chatId, photo, [extra])

Param Type Description
chatId number/string Chat id
photo File Photo
[extra] object Extra parameters

sendMediaGroup

Sends media album.

telegram.sendMediaGroup(chatId, media, [extra])

Param Type Description
chatId number/string Chat id
media InputMedia[] Media array
[extra] object Extra parameters

sendSticker

Sends sticker.

telegram.sendSticker(chatId, sticker, [extra])

Param Type Description
chatId number/string Chat id
sticker File Document
[extra] object Extra parameters

setStickerPositionInSet

Use this method to move a sticker in a set created by the bot to a specific position.

telegram.setStickerPositionInSet(sticker, position)

Param Type Description
sticker string File identifier of the sticker
position number New sticker position in the set, zero-based

sendVenue

Sends venue information.

telegram.sendVenue(chatId, latitude, longitude, title, address, [extra])

Param Type Description
chatId number/string Chat id
latitude number Latitude
longitude number Longitude
title string Venue title
address string Venue address
[extra] object Extra parameters

sendInvoice

Sends invoice.

telegram.sendInvoice(chatId, invoice)

Param Type Description
chatId number/string Chat id
invoice object Invoice object

sendVideo

Sends video.

telegram.sendVideo(chatId, video, [extra])

Param Type Description
chatId number/string Chat id
video File Document
[extra] object Extra parameters

sendAnimation

Sends video.

telegram.sendAnimation(chatId, animation, [extra])

Param Type Description
chatId number/string Chat id
animation File Document
[extra] object Extra parameters

sendVideoNote

Sends round video.

telegram.sendVideoNote(chatId, video, [extra])

Param Type Description
chatId number/string Chat id
video File Video note file
[extra] object Extra parameters

sendVoice

Sends voice.

telegram.sendVoice(chatId, voice, [extra])

Param Type Description
chatId number/string Chat id
voice File/string File, file id or HTTP URL
[extra] object Extra parameters

sendPoll

Sends a poll.

telegram.sendPoll(chatId, question, options, [extra])

Param Type Description
chatId number/string Chat id
question string Poll question
options string[] Answer options
[extra] object Extra parameters

setMyCommands

Use this method to change the list of the bot’s commands

telegram.setMyCommands(commands)

Param Type Description
commands object[] List of bot commands

sendQuiz

Sends quiz.

telegram.sendQuiz(chatId, question, options, [extra])

Param Type Description
chatId number/string Chat id
question string Poll question
options string[] Answer options
[extra] object Extra parameters

stopPoll

Stops anonymous poll.

telegram.stopPoll(chatId, messageId, [extra])

Param Type Description
chatId number/string Chat id
messageId string Poll message id
options string[] Answer options
[extra] object Extra parameters

stopMessageLiveLocation

Use this method to stop updating a live location message sent by the bot or via the bot (for inline bots) before live_period expires.

telegram.stopMessageLiveLocation(chatId, messageId, inlineMessageId, [markup]) 👉🏼 📑

Param Type Description
chatId number/string Chat id
messageId string Message id
inlineMessageId string Inline message id
[markup] object Keyboard markup

uploadStickerFile

Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods.

telegram.uploadStickerFile(ownerId, stickerFile) 👉🏼 📑

Param Type Description
ownerId string User identifier of sticker file owner
stickerFile File Png image with the sticker

setWebhook

Specifies an url to receive incoming updates via an outgoing webhook.

telegram.setWebhook(url, [extra]) 👉🏼 📑

Param Type Description
url string Public url for webhook
[extra] object Extra parameters

unbanChatMember

Use this method to unban a previously kicked user in a supergroup.

telegram.unbanChatMember(chatId, userId) 👉🏼 📑

Param Type Description
chatId number/string Chat id
userId number User id
[extra] object Extra parameters

unbanChatSenderChat

Use this method to unban a previously banned channel chat in a supergroup or channel.

unbanChatSenderChat(chatId, senderChatId, extra) 👉🏼 📑

Param Type Description
chatId number/string Chat id
senderChatId number Sender id
[extra] object Extra parameters

setPassportDataErrors

Informs a user that some Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change).

telegram.setPassportDataErrors(errors) 👉🏼 📑

Param Type Description
[errors] PassportElementError[] An array describing the errors