telebot
Version:
The easy way to write Telegram bots.
493 lines (492 loc) • 15.6 kB
JavaScript
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
const telebot_1 = require("../telebot");
telebot_1.TeleBot.prototype.getMe = function () {
return this.telegramMethod({
method: "getMe"
});
};
telebot_1.TeleBot.prototype.sendMessage = function (chat_id, text, optional) {
return this.telegramMethod({
method: "sendMessage",
required: { chat_id, text },
optional
});
};
telebot_1.TeleBot.prototype.forwardMessage = function (chat_id, from_chat_id, message_id, optional) {
return this.telegramMethod({
method: "forwardMessage",
required: { chat_id, from_chat_id, message_id },
optional
});
};
telebot_1.TeleBot.prototype.sendPhoto = function (chat_id, photo, optional) {
return this.telegramMethod({
method: "sendPhoto",
required: { chat_id, photo },
optional
});
};
telebot_1.TeleBot.prototype.sendAudio = function (chat_id, audio, optional) {
return this.telegramMethod({
method: "sendAudio",
required: { chat_id, audio },
optional
});
};
telebot_1.TeleBot.prototype.sendDocument = function (chat_id, document, optional) {
return this.telegramMethod({
method: "sendDocument",
required: { chat_id, document },
optional
});
};
telebot_1.TeleBot.prototype.sendVideo = function (chat_id, video, optional) {
return this.telegramMethod({
method: "sendVideo",
required: { chat_id, video },
optional
});
};
telebot_1.TeleBot.prototype.sendAnimation = function (chat_id, animation, optional) {
return this.telegramMethod({
method: "sendAnimation",
required: { chat_id, animation },
optional
});
};
telebot_1.TeleBot.prototype.sendVoice = function (chat_id, voice, optional) {
return this.telegramMethod({
method: "sendVoice",
required: { chat_id, voice },
optional
});
};
telebot_1.TeleBot.prototype.sendVideoNote = function (chat_id, video_note, optional) {
return this.telegramMethod({
method: "sendVideoNote",
required: { chat_id, video_note },
optional
});
};
telebot_1.TeleBot.prototype.sendMediaGroup = function (chat_id, media, optional) {
return this.telegramMethod({
method: "sendMediaGroup",
required: { chat_id, media },
optional
});
};
telebot_1.TeleBot.prototype.sendLocation = function (chat_id, latitude, longitude, optional) {
return this.telegramMethod({
method: "sendLocation",
required: { chat_id, latitude, longitude },
optional
});
};
telebot_1.TeleBot.prototype.editMessageLiveLocation = function (_a) {
var { latitude, longitude } = _a, optional = __rest(_a, ["latitude", "longitude"]);
return this.telegramMethod({
method: "editMessageLiveLocation",
required: { latitude, longitude },
optional
});
};
telebot_1.TeleBot.prototype.stopMessageLiveLocation = function (_a) {
var optional = __rest(_a, []);
return this.telegramMethod({
method: "stopMessageLiveLocation",
required: {},
optional
});
};
telebot_1.TeleBot.prototype.sendVenue = function (_a) {
var { chat_id, latitude, longitude, title, address } = _a, optional = __rest(_a, ["chat_id", "latitude", "longitude", "title", "address"]);
return this.telegramMethod({
method: "sendVenue",
required: { chat_id, latitude, longitude, title, address },
optional
});
};
telebot_1.TeleBot.prototype.sendContact = function (chat_id, phone_number, first_name, optional) {
return this.telegramMethod({
method: "sendContact",
required: { chat_id, phone_number, first_name },
optional
});
};
telebot_1.TeleBot.prototype.sendPoll = function (chat_id, question, options, optional) {
return this.telegramMethod({
method: "sendPoll",
required: { chat_id, question, options },
optional
});
};
telebot_1.TeleBot.prototype.sendDice = function (chat_id, emoji, optional) {
return this.telegramMethod({
method: "sendDice",
required: { chat_id, emoji },
optional
});
};
telebot_1.TeleBot.prototype.sendChatAction = function (chat_id, action) {
return this.telegramMethod({
method: "sendChatAction",
required: { chat_id, action },
optional: {}
});
};
telebot_1.TeleBot.prototype.getUserProfilePhotos = function (chat_id, optional) {
return this.telegramMethod({
method: "getUserProfilePhotos",
required: { chat_id },
optional: optional
});
};
telebot_1.TeleBot.prototype.getFile = function (chat_id) {
return this.telegramMethod({
method: "getFile",
required: { chat_id },
optional: {}
});
};
telebot_1.TeleBot.prototype.kickChatMember = function (chat_id, user_id, optional) {
return this.telegramMethod({
method: "kickChatMember",
required: { chat_id, user_id },
optional
});
};
telebot_1.TeleBot.prototype.unbanChatMember = function (chat_id, user_id) {
return this.telegramMethod({
method: "unbanChatMember",
required: { chat_id, user_id },
optional: {}
});
};
telebot_1.TeleBot.prototype.restrictChatMember = function (chat_id, user_id, permissions, optional) {
return this.telegramMethod({
method: "restrictChatMember",
required: { chat_id, user_id, permissions },
optional
});
};
telebot_1.TeleBot.prototype.promoteChatMember = function (chat_id, user_id, optional) {
return this.telegramMethod({
method: "promoteChatMember",
required: { chat_id, user_id },
optional
});
};
telebot_1.TeleBot.prototype.setChatAdministratorCustomTitle = function (chat_id, user_id, custom_title) {
return this.telegramMethod({
method: "setChatAdministratorCustomTitle",
required: { chat_id, user_id, custom_title },
optional: {}
});
};
telebot_1.TeleBot.prototype.exportChatInviteLink = function (chat_id) {
return this.telegramMethod({
method: "exportChatInviteLink",
required: { chat_id },
optional: {}
});
};
telebot_1.TeleBot.prototype.setChatPhoto = function (chat_id, photo) {
return this.telegramMethod({
method: "setChatPhoto",
required: { chat_id, photo },
optional: {}
});
};
telebot_1.TeleBot.prototype.deleteChatPhoto = function (chat_id) {
return this.telegramMethod({
method: "deleteChatPhoto",
required: { chat_id },
optional: {}
});
};
telebot_1.TeleBot.prototype.setChatTitle = function (chat_id, title) {
return this.telegramMethod({
method: "setChatTitle",
required: { chat_id, title },
optional: {}
});
};
telebot_1.TeleBot.prototype.setChatDescription = function (chat_id, optional) {
return this.telegramMethod({
method: "setChatDescription",
required: { chat_id },
optional
});
};
telebot_1.TeleBot.prototype.pinChatMessage = function (chat_id, message_id, optional) {
return this.telegramMethod({
method: "pinChatMessage",
required: { chat_id, message_id },
optional
});
};
telebot_1.TeleBot.prototype.unpinChatMessage = function (chat_id) {
return this.telegramMethod({
method: "unpinChatMessage",
required: { chat_id },
optional: {}
});
};
telebot_1.TeleBot.prototype.leaveChat = function (chat_id) {
return this.telegramMethod({
method: "leaveChat",
required: { chat_id },
optional: {}
});
};
telebot_1.TeleBot.prototype.getChat = function (chat_id) {
return this.telegramMethod({
method: "getChat",
required: { chat_id },
optional: {}
});
};
telebot_1.TeleBot.prototype.getChatAdministrators = function (chat_id) {
return this.telegramMethod({
method: "getChat",
required: { chat_id },
optional: {}
});
};
telebot_1.TeleBot.prototype.getChatMembersCount = function (chat_id) {
return this.telegramMethod({
method: "getChatMembersCount",
required: { chat_id },
optional: {}
});
};
telebot_1.TeleBot.prototype.getChatMember = function (chat_id, user_id) {
return this.telegramMethod({
method: "getChatMember",
required: { chat_id, user_id },
optional: {}
});
};
telebot_1.TeleBot.prototype.setChatStickerSet = function (chat_id, sticker_set_name) {
return this.telegramMethod({
method: "setChatStickerSet",
required: { chat_id, sticker_set_name },
optional: {}
});
};
telebot_1.TeleBot.prototype.deleteChatStickerSet = function (chat_id) {
return this.telegramMethod({
method: "deleteChatStickerSet",
required: { chat_id },
optional: {}
});
};
telebot_1.TeleBot.prototype.answerCallbackQuery = function (callback_query_id, optional) {
return this.telegramMethod({
method: "answerCallbackQuery",
required: { callback_query_id },
optional
});
};
telebot_1.TeleBot.prototype.setMyCommands = function (commands) {
return this.telegramMethod({
method: "setMyCommands",
required: { commands },
optional: {}
});
};
telebot_1.TeleBot.prototype.getMyCommands = function () {
return this.telegramMethod({
method: "getMyCommands",
required: {},
optional: {}
});
};
telebot_1.TeleBot.prototype.editMessageText = function (_a) {
var { text } = _a, optional = __rest(_a, ["text"]);
return this.telegramMethod({
method: "editMessageText",
required: { text },
optional
});
};
telebot_1.TeleBot.prototype.editMessageCaption = function (props) {
return this.telegramMethod({
method: "editMessageCaption",
required: {},
optional: props
});
};
telebot_1.TeleBot.prototype.editMessageMedia = function (_a) {
var { media } = _a, optional = __rest(_a, ["media"]);
return this.telegramMethod({
method: "editMessageCaption",
required: { media },
optional
});
};
telebot_1.TeleBot.prototype.editMessageReplyMarkup = function (props) {
return this.telegramMethod({
method: "editMessageReplyMarkup",
required: {},
optional: props
});
};
telebot_1.TeleBot.prototype.stopPoll = function (chat_id, message_id, optional) {
return this.telegramMethod({
method: "stopPoll",
required: { chat_id, message_id },
optional
});
};
telebot_1.TeleBot.prototype.deleteMessage = function (chat_id, message_id) {
return this.telegramMethod({
method: "deleteMessage",
required: { chat_id, message_id },
optional: {}
});
};
telebot_1.TeleBot.prototype.sendSticker = function (chat_id, sticker, optional) {
return this.telegramMethod({
method: "sendSticker",
required: { chat_id, sticker },
optional
});
};
telebot_1.TeleBot.prototype.getStickerSet = function (name) {
return this.telegramMethod({
method: "getStickerSet",
required: { name },
optional: {}
});
};
telebot_1.TeleBot.prototype.uploadStickerFile = function (user_id, png_sticker) {
return this.telegramMethod({
method: "uploadStickerFile",
required: { user_id, png_sticker },
optional: {}
});
};
telebot_1.TeleBot.prototype.createNewStickerSet = function (_a) {
var { user_id, name, title, emojis } = _a, optional = __rest(_a, ["user_id", "name", "title", "emojis"]);
return this.telegramMethod({
method: "createNewStickerSet",
required: { user_id, name, title, emojis },
optional
});
};
telebot_1.TeleBot.prototype.addStickerToSet = function (user_id, name, optional) {
return this.telegramMethod({
method: "addStickerToSet",
required: { user_id, name },
optional
});
};
telebot_1.TeleBot.prototype.setStickerPositionInSet = function (sticker, position) {
return this.telegramMethod({
method: "setStickerPositionInSet",
required: { sticker, position },
optional: {}
});
};
telebot_1.TeleBot.prototype.setStickerSetThumb = function (name, user_id, optional) {
return this.telegramMethod({
method: "setStickerSetThumb",
required: { name, user_id },
optional
});
};
telebot_1.TeleBot.prototype.answerInlineQuery = function (inline_query_id, results, optional) {
return this.telegramMethod({
method: "answerInlineQuery",
required: { inline_query_id, results },
optional
});
};
telebot_1.TeleBot.prototype.sendInvoice = function (_a) {
var { chat_id, title, description, payload, provider_token, start_parameter, currency } = _a, optional = __rest(_a, ["chat_id", "title", "description", "payload", "provider_token", "start_parameter", "currency"]);
return this.telegramMethod({
method: "answerInlineQuery",
required: {
chat_id,
title,
description,
payload,
provider_token,
start_parameter,
currency
},
optional
});
};
telebot_1.TeleBot.prototype.answerShippingQuery = function (shipping_query_id, ok, optional) {
return this.telegramMethod({
method: "answerShippingQuery",
required: { shipping_query_id, ok },
optional
});
};
telebot_1.TeleBot.prototype.answerPreCheckoutQuery = function (pre_checkout_query_id, ok, optional) {
return this.telegramMethod({
method: "answerPreCheckoutQuery",
required: { pre_checkout_query_id, ok },
optional
});
};
telebot_1.TeleBot.prototype.setPassportDataErrors = function (user_id, errors) {
return this.telegramMethod({
method: "setPassportDataErrors",
required: { user_id, errors },
optional: {}
});
};
telebot_1.TeleBot.prototype.sendGame = function (chat_id, game_short_name, optional) {
return this.telegramMethod({
method: "sendGame",
required: { chat_id, game_short_name },
optional
});
};
telebot_1.TeleBot.prototype.setGameScore = function (chat_id, score, optional) {
return this.telegramMethod({
method: "setGameScore",
required: { chat_id, score },
optional
});
};
telebot_1.TeleBot.prototype.getGameHighScores = function (user_id, optional) {
return this.telegramMethod({
method: "getGameHighScores",
required: { user_id },
optional
});
};
telebot_1.TeleBot.prototype.setWebhook = function (url, optional) {
return this.telegramMethod({
method: "setWebhook",
required: { url },
optional
});
};
telebot_1.TeleBot.prototype.deleteWebhook = function () {
return this.telegramMethod({
method: "deleteWebhook"
});
};
telebot_1.TeleBot.prototype.getWebhookInfo = function () {
return this.telegramMethod({
method: "getWebhookInfo"
});
};