///
import { BadRequestException } from '@nestjs/common';
export interface TelegramUser {
id: number;
is_bot: boolean;
first_name: string;
last_name?: string;
username?: string;
language_code?: string;
}
export interface TelegramChat {
id: number;
type: string;
title?: string;
username?: string;
first_name?: string;
last_name?: string;
all_members_are_administrators?: boolean;
photo?: TelegramChatPhoto;
description?: string;
invite_link?: string;
pinned_message?: TelegramMessage;
sticker_set_name?: string;
can_set_sticker_set?: boolean;
}
export interface TelegramMessage {
message_id: number;
from?: TelegramUser;
date: number;
chat: TelegramChat;
forward_from?: TelegramUser;
forward_from_chat?: TelegramChat;
forward_from_message_id?: number;
forward_signature?: string;
forward_sender_name?: string;
forward_date?: number;
reply_to_message?: TelegramMessage;
edit_date?: number;
media_group_id?: string;
author_signature?: string;
text?: string;
entities?: TelegramMessageEntity[];
caption_entities?: TelegramMessageEntity[];
audio?: TelegramAudio;
document?: TelegramDocument;
animation?: TelegramAnimation;
game?: TelegramGame;
photo?: TelegramPhotoSize[];
sticker?: TelegramSticker;
video?: TelegramVideo;
voice?: TelegramVoice;
video_note?: TelegramVideoNote;
caption?: string;
contact?: TelegramContact;
location?: TelegramLocation;
venue?: TelegramVenue;
poll?: TelegramPoll;
new_chat_members?: TelegramUser[];
left_chat_member?: TelegramUser;
new_chat_title?: string;
new_chat_phot?: TelegramPhotoSize[];
delete_chat_photo?: true;
group_chat_deleted?: true;
supergroup_chat_deleted?: true;
channel_chat_created?: true;
migrate_to_chat_id?: number;
migrate_from_chat_id?: number;
pinned_message?: TelegramMessage;
invoice?: TelegramInvoice;
successful_payment?: TelegramSuccessfulPayment;
connected_website?: string;
passport_data?: TelegramPassportData;
reply_markup?: TelegramInlineKeyboardMarkup;
}
export interface TelegramMessageEntity {
type: string;
offset: number;
length: number;
url?: string;
user?: TelegramUser;
}
export interface TelegramPhotoSize {
file_id: string;
width: number;
height: number;
file_size: number;
}
export interface TelegramAudio {
file_id: string;
duration: number;
performer?: string;
title?: string;
mime_type?: string;
file_size?: number;
thumb?: TelegramPhotoSize;
}
export interface TelegramDocument {
file_id: string;
thumb?: TelegramPhotoSize;
file_name?: string;
mime_type?: string;
file_size?: number;
}
export interface TelegramVideo {
file_id: string;
width: number;
height: number;
duration: number;
thumb?: TelegramPhotoSize;
mime_type?: string;
file_size?: number;
}
export interface TelegramAnimation {
file_id: string;
width: number;
height: number;
duration: number;
thumb?: TelegramPhotoSize;
file_name?: string;
mime_type?: string;
file_size?: number;
}
export interface TelegramVoice {
file_id: string;
duration: number;
mime_type?: string;
file_size?: number;
}
export interface TelegramVideoNote {
file_id: string;
length: number;
duration: number;
thumb?: TelegramPhotoSize;
file_size?: number;
}
export interface TelegramContact {
phone_number: string;
first_name: string;
last_name: string;
user_id: number;
vcard: string;
}
export interface TelegramLocation {
longitude: number;
latitude: number;
}
export interface TelegramVenue {
location: TelegramLocation;
title: string;
address: string;
foursquare_id?: string;
foursquare_type?: string;
}
export interface TelegramPollOption {
text: string;
voter_count: number;
}
export interface TelegramPoll {
id: string;
question: string;
options: TelegramPollOption[];
is_closed: boolean;
}
export interface TelegramUserProfilePhotos {
total_count: number;
photos: TelegramPhotoSize[][];
}
export interface TelegramFile {
file_id: string;
file_size?: number;
file_path?: string;
}
export interface TelegramReplyKeyboardMarkup {
keyboard: TelegramKeyboardButton[][];
resize_keyboard?: boolean;
one_time_keyboard?: boolean;
selective?: boolean;
}
export interface TelegramKeyboardButton {
text: string;
request_contact?: boolean;
request_location?: boolean;
}
export interface TelegramReplyKeyboardRemove {
remove_keyboard: true;
selective?: boolean;
}
export interface TelegramInlineKeyboardMarkup {
inline_keyboard: TelegramInlineKeyboardButton[][];
}
export interface TelegramInlineKeyboardButton {
text: string;
url?: string;
login_url?: TelegramLoginUrl;
callback_data?: string;
switch_inline_query?: string;
switch_inline_query_current_chat?: string;
callback_game?: TelegramCallbackGame;
pay?: boolean;
}
export interface TelegramLoginUrl {
url: string;
forward_text?: string;
bot_username?: string;
request_write_access?: boolean;
}
export interface TelegramCallbackQuery {
id: string;
from: TelegramUser;
message?: TelegramMessage;
inline_message_id?: string;
chat_instance: string;
data?: string;
game_short_name?: string;
}
export interface TelegramForceReply {
force_reply: true;
selective?: boolean;
}
export interface TelegramChatPhoto {
small_file_id: string;
big_file_id: string;
}
export interface TelegramChatMember {
user: TelegramUser;
status: string;
until_date?: number;
can_be_edited?: boolean;
can_change_info?: boolean;
can_post_messages?: boolean;
can_edit_messages?: boolean;
can_delete_messages?: boolean;
can_invite_users?: boolean;
can_restrict_members?: boolean;
can_pin_messages?: boolean;
can_promote_members?: boolean;
is_member?: boolean;
can_send_messages?: boolean;
can_send_media_messages?: boolean;
can_send_other_messages?: boolean;
can_add_web_page_previews?: boolean;
}
export interface TelegramResponseParameters {
migrate_to_chat_id?: number;
retry_after?: number;
}
export interface TelegramInputMedia {
type: string;
media: Buffer | string;
caption?: string;
parse_mode?: string;
}
export interface TelegramInputMediaPhoto extends TelegramInputMedia {
type: string;
}
export interface TelegramInputMediaVideo extends TelegramInputMedia {
type: string;
thumb?: Buffer | string;
width?: number;
height?: number;
duration?: number;
supports_streaming?: boolean;
}
export interface TelegramInputMediaAnimation extends TelegramInputMedia {
type: 'animation';
thumb?: Buffer | string;
width?: number;
height?: number;
duration?: number;
}
export interface TelegramInputMediaAudio extends TelegramInputMedia {
type: 'audio';
thumb?: Buffer | string;
duration?: number;
performer?: string;
title?: string;
}
export interface TelegramInputMediaDocument extends TelegramInputMedia {
type: 'document';
thumb?: Buffer | string;
}
export interface TelegramSticker {
file_id: string;
width: number;
height: number;
thumb?: TelegramPhotoSize;
emoji?: string;
set_name?: string;
mask_position?: TelegramMaskPosition;
file_size?: number;
}
export interface TelegramStickerSet {
name: string;
title: string;
contains_masks: boolean;
stickers: TelegramSticker[];
}
export interface TelegramMaskPosition {
point: 'forehead' | 'eyes' | 'mouth' | 'chin';
x_shift: number;
y_shift: number;
scale: number;
}
export interface TelegramLabeledPrice {
label: string;
amount: number;
}
export interface TelegramInvoice {
title: string;
description: string;
start_parameter: string;
currency: string;
total_amount: number;
}
export interface TelegramShippingAddress {
country_code: string;
state: string;
city: string;
street_line1: string;
street_line2: string;
post_code: string;
}
export interface TelegramOrderInfo {
name?: string;
phone_number?: string;
email?: string;
shipping_address?: TelegramShippingAddress;
}
export interface TelegramShippingOption {
id: string;
title: string;
prices: TelegramLabeledPrice[];
}
export interface TelegramSuccessfulPayment {
currency: string;
total_amount: number;
invoice_payload: string;
shipping_option_id?: string;
order_info?: TelegramOrderInfo;
telegram_payment_charge_id: string;
provider_payment_charge_id: string;
}
export interface TelegramPreCheckoutQuery {
id: string;
from: TelegramUser;
currency: string;
total_amount: number;
invoice_payload: string;
shipping_option_id?: string;
order_info?: TelegramOrderInfo;
}
export interface TelegramPassportData {
data: TelegramEncryptedPassportElement[];
credentials: TelegramEncryptedCredentials;
}
export interface TelegramPassportFile {
file_id: string;
file_size: number;
file_date: number;
}
export interface TelegramEncryptedPassportElement {
type: 'personal_details' | 'passport' | 'driver_license' | 'identity_card' | 'internal_passport' | 'address' | 'utility_bill' | 'bank_statement' | 'rental_agreement' | 'passport_registration' | 'temporary_registration' | 'phone_number' | 'email';
data?: string;
phone_number?: string;
email?: string;
files?: TelegramPassportFile[];
front_side?: TelegramPassportFile;
reverse_side?: TelegramPassportFile;
selfie?: TelegramPassportFile;
translation?: TelegramPassportFile[];
hash: string;
}
export interface TelegramEncryptedCredentials {
data: string;
hash: string;
secret: string;
}
export interface TelegramGame {
title: string;
description: string;
photo: TelegramPhotoSize[];
text?: string;
text_entities?: TelegramMessageEntity[];
animation?: TelegramAnimation;
}
export interface TelegramCallbackGame {
}
export interface TelegramGameHighScore {
position: number;
user: TelegramUser;
score: number;
}
export interface TelegramResponse {
ok: boolean;
result?: T;
error_code?: number;
description?: string;
}
export declare class TelegramException extends BadRequestException {
constructor(message?: string | object | any, error?: string);
}
interface TelegramChatId {
chat_id: number | string;
}
export interface TelegramSendMessageParams extends TelegramChatId {
text: string;
parse_mode?: 'markdown' | 'html';
disable_web_preview?: boolean;
disable_notification?: boolean;
reply_to_message_id?: number;
reply_markup?: TelegramInlineKeyboardMarkup | TelegramReplyKeyboardMarkup | TelegramReplyKeyboardRemove | TelegramForceReply;
}
export interface TelegramForwardMessageParams extends TelegramChatId {
from_chat_id: number | string;
disable_notification?: boolean;
message_id: number;
}
export interface TelegramSendPhotoParams extends TelegramChatId {
photo: Buffer | string;
caption?: string;
parse_mode?: string;
disable_notification?: boolean;
reply_to_message_id?: number;
reply_markup?: TelegramInlineKeyboardMarkup | TelegramReplyKeyboardMarkup | TelegramReplyKeyboardRemove | TelegramForceReply;
}
export interface TelegramSendAudioParams extends TelegramChatId {
audio: Buffer | string;
caption?: string;
parse_mode?: string;
duration?: number;
performer?: string;
title?: string;
thumb?: Buffer | string;
disable_notification?: boolean;
reply_to_message_id?: number;
reply_markup?: TelegramInlineKeyboardMarkup | TelegramReplyKeyboardMarkup | TelegramReplyKeyboardRemove | TelegramForceReply;
}
export interface TelegramSendDocumentParams extends TelegramChatId {
document: Buffer | string;
thumb?: Buffer | string;
caption?: string;
parse_mode?: string;
disable_notification?: boolean;
reply_to_message_id?: number;
reply_markup?: TelegramInlineKeyboardMarkup | TelegramReplyKeyboardMarkup | TelegramReplyKeyboardRemove | TelegramForceReply;
}
export interface TelegramSendVideoParams extends TelegramChatId {
video: Buffer | string;
duration?: number;
width?: number;
height?: number;
thumb?: Buffer | string;
caption?: string;
parse_mode?: string;
supports_streaming?: boolean;
disable_notification?: boolean;
reply_to_message_id?: number;
reply_markup?: TelegramInlineKeyboardMarkup | TelegramReplyKeyboardMarkup | TelegramReplyKeyboardRemove | TelegramForceReply;
}
export interface TelegramSendVideoNoteParams extends TelegramChatId {
video_note: Buffer | string;
duration?: number;
width?: number;
height?: number;
thumb?: Buffer | string;
disable_notification?: boolean;
reply_to_message_id?: number;
reply_markup?: TelegramInlineKeyboardMarkup | TelegramReplyKeyboardMarkup | TelegramReplyKeyboardRemove | TelegramForceReply;
}
export interface TelegramSendAnimationParams extends TelegramChatId {
animation: Buffer | string;
duration?: number;
width?: number;
height?: number;
thumb?: Buffer | string;
caption?: string;
parse_mode?: string;
disable_notification?: boolean;
reply_to_message_id?: number;
reply_markup?: TelegramInlineKeyboardMarkup | TelegramReplyKeyboardMarkup | TelegramReplyKeyboardRemove | TelegramForceReply;
}
export interface TelegramSendVoiceParams extends TelegramChatId {
voice: Buffer | string;
duration?: number;
width?: number;
height?: number;
thumb?: Buffer | string;
caption?: string;
parse_mode?: string;
disable_notification?: boolean;
reply_to_message_id?: number;
reply_markup?: TelegramInlineKeyboardMarkup | TelegramReplyKeyboardMarkup | TelegramReplyKeyboardRemove | TelegramForceReply;
}
export interface TelegramSendVoiceParams extends TelegramChatId {
video_note: Buffer | string;
duration?: number;
length?: number;
thumb?: Buffer | string;
parse_mode?: string;
disable_notification?: boolean;
reply_to_message_id?: number;
reply_markup?: TelegramInlineKeyboardMarkup | TelegramReplyKeyboardMarkup | TelegramReplyKeyboardRemove | TelegramForceReply;
}
export interface TelegramSendMediaGroupParams extends TelegramChatId {
media: TelegramInputMediaPhoto[] | TelegramInputMediaVideo[];
disable_notification?: boolean;
reply_to_message_id?: number;
}
export interface TelegramSendLocationParams extends TelegramChatId {
latitude: number;
longitude: number;
live_period?: number;
disable_notification?: boolean;
reply_to_message_id?: number;
reply_markup?: TelegramInlineKeyboardMarkup | TelegramReplyKeyboardMarkup | TelegramReplyKeyboardRemove | TelegramForceReply;
}
export interface TelegramEditMessageLiveLocationParams {
chat_id?: number | string;
message_id?: number;
inline_message_id?: string;
latitude: number;
longitude: number;
reply_markup?: TelegramInlineKeyboardMarkup;
}
export interface TelegramStopMessageLiveLocationParams {
chat_id?: number | string;
message_id?: number;
inline_message_id?: string;
reply_markup?: TelegramInlineKeyboardMarkup;
}
export interface TelegramSendVenueParams extends TelegramChatId {
chat_id: number | string;
latitude: number;
longitude: number;
title: string;
address: string;
foursquare_id?: string;
foursquare_type?: string;
disable_notification?: boolean;
reply_to_message_id?: number;
reply_markup?: TelegramInlineKeyboardMarkup | TelegramReplyKeyboardMarkup | TelegramReplyKeyboardRemove | TelegramForceReply;
}
export interface TelegramSendContactParams extends TelegramChatId {
phone_number: string;
first_name: string;
last_name?: string;
vcard?: string;
disable_notification?: boolean;
reply_to_message_id?: number;
reply_markup?: TelegramInlineKeyboardMarkup | TelegramReplyKeyboardMarkup | TelegramReplyKeyboardRemove | TelegramForceReply;
}
export interface TelegramSendPollParams extends TelegramChatId {
question: string;
options: string[];
disable_notification?: boolean;
reply_to_message_id?: number;
reply_markup?: TelegramInlineKeyboardMarkup | TelegramReplyKeyboardMarkup | TelegramReplyKeyboardRemove | TelegramForceReply;
}
export interface TelegramSendChatActionParams extends TelegramChatId {
action: string;
}
export interface TelegramGetUserProfilePhotosParams {
user_id: number;
offset?: number;
limit?: number;
}
export interface TelegramGetFileParams {
file_id: string;
}
export interface TelegramKickChatMemberParams extends TelegramUnbanChatMemberParams {
until_date?: number;
}
export interface TelegramUnbanChatMemberParams extends TelegramChatId {
user_id: number;
}
export interface TelegramRestrictChatMemberParams extends TelegramKickChatMemberParams {
can_send_messages?: boolean;
can_send_media_messages?: boolean;
can_send_other_messages?: boolean;
can_add_web_page_previews?: boolean;
}
export interface TelegramPromoteChatMemberParams extends TelegramUnbanChatMemberParams {
can_change_info?: boolean;
can_post_messages?: boolean;
can_delete_message?: boolean;
can_edit_messages?: boolean;
can_invite_users?: boolean;
can_restrict_members?: boolean;
can_pin_messages?: boolean;
can_promote_members?: boolean;
}
export interface TelegramExportChatInviteLinkParams extends TelegramChatId {
}
export interface TelegramSetChatPhotoParams extends TelegramChatId {
photo: Buffer;
}
export interface TelegramDeleteChatPhotoParams extends TelegramChatId {
}
export interface TelegramSetChatTitleParams extends TelegramChatId {
title: string;
}
export interface TelegramSetChatDescriptionParams extends TelegramChatId {
description?: string;
}
export interface TelegramPinChatMessageParams extends TelegramChatId {
message_id: number;
disable_notifications?: boolean;
}
export interface TelegramUnpinChatMessageParams extends TelegramChatId {
}
export interface TelegramLeaveChatParams extends TelegramChatId {
}
export interface TelegramGetChatParams extends TelegramChatId {
}
export interface TelegramGetChatAdministratorsParams extends TelegramChatId {
}
export interface TelegramGetChatMembersCountParams extends TelegramChatId {
}
export interface TelegramGetChatMemberParams extends TelegramChatId {
user_id: number;
}
export interface TelegramSetChatStickerSetParams extends TelegramChatId {
sticker_set_name: string;
}
export interface TelegramChatDeleteStickerSetParams extends TelegramChatId {
}
export interface TelegramAnswerCallbackQueryParams {
callback_query_id: string;
text?: string;
show_alert?: boolean;
show_url?: string;
cache_time?: number;
}
interface TelegramEditMessageId {
chat_id?: number | string;
message_id?: number;
inline_message_id?: string;
}
export interface TelegramEditMessageTextParams extends TelegramEditMessageId {
text: string;
parse_mode?: string;
disable_web_page_view?: boolean;
reply_markup?: TelegramInlineKeyboardMarkup;
}
export interface TelegramEditMessageCaptionParams extends TelegramEditMessageId {
caption?: string;
parse_mode?: string;
reply_markup?: TelegramInlineKeyboardMarkup;
}
export interface TelegramEditMessageMediaParams extends TelegramEditMessageId {
media: TelegramInputMedia;
reply_markup?: TelegramInlineKeyboardMarkup;
}
export interface TelegramEditMessageReplyMarkupParams extends TelegramEditMessageId {
reply_markup?: TelegramInlineKeyboardMarkup;
}
export interface TelegramStopPollParams extends TelegramChatId {
message_id: number;
reply_markup?: TelegramInlineKeyboardMarkup;
}
export interface TelegramDeleteMessageParams extends TelegramChatId {
message_id: number;
}
export interface TelegramSendStickerParams extends TelegramChatId {
sticker: Buffer | string;
disable_notification?: boolean;
reply_to_message_id?: number;
reply_markup?: TelegramInlineKeyboardMarkup | TelegramReplyKeyboardMarkup | TelegramReplyKeyboardRemove | TelegramForceReply;
}
export interface TelegramGetStickerSetParams {
name: string;
}
export interface TelegramUploadStickerFileParams {
user_id: number;
png_sticker: Buffer;
}
export interface TelegramCreateNewStickerSetParams {
user_id: number;
name: string;
title: string;
png_sticker: Buffer | string;
emojis: string;
contains_masks?: boolean;
mask_position?: TelegramMaskPosition;
}
export interface TelegramAddStickerToSetParams {
user_id: number;
name: string;
png_sticker: Buffer | string;
emojis: string;
mask_position?: TelegramMaskPosition;
}
export interface TelegramSetStickerPositionInSetParams {
sticker: string;
position: number;
}
export interface TelegramDeleteStickerFromSetParams {
sticker: string;
}
export interface TelegramSendInvoiceParams extends TelegramChatId {
title: string;
description: string;
payload: string;
provider_token: string;
start_parameter: string;
currency: string;
prices: TelegramLabeledPrice[];
provider_data?: string;
photo_url?: string;
photo_size?: number;
photo_width?: number;
photo_height?: number;
need_name?: boolean;
need_phone_number?: boolean;
need_email?: boolean;
need_shipping_address?: boolean;
send_phone_number_to_provider?: boolean;
send_email_to_provider?: boolean;
is_flexible?: boolean;
disable_notification?: boolean;
reply_to_message_id?: number;
reply_markup?: TelegramInlineKeyboardMarkup;
}
export interface TelegramAnswerShippingQueryParams {
shipping_query_id: string;
ok: boolean;
shipping_options?: TelegramShippingOption[];
error_message?: string;
}
export interface TelegramAnswerPreCheckoutQueryParams {
pre_checkout_query_id: string;
ok: boolean;
error_message?: string;
}
export interface TelegramSendGameParams extends TelegramChatId {
game_short_name: string;
disable_notification?: boolean;
reply_to_message_id?: number;
reply_markup?: TelegramInlineKeyboardMarkup;
}
export interface TelegramSetGameScoreParams {
user_id: number;
score: number;
force?: boolean;
disable_edit_message?: boolean;
chat_id?: number;
message_id?: number;
inline_message_id?: string;
}
export interface TelegramGetGameHighScoreParams {
user_id: number;
chat_id?: number;
message_id?: number;
inline_message_id?: string;
}
export interface TelegramUpdate {
update_id: number;
message?: TelegramMessage;
edited_message?: TelegramMessage;
channel_post?: TelegramMessage;
edited_channel_post?: TelegramMessage;
inline_query?: any;
chosen_inline_result?: any;
callback_query?: TelegramCallbackQuery;
shipping_query?: any;
pre_checkout_query?: any;
poll?: TelegramPoll;
poll_answer?: any;
}
export interface TelegramGetUpdatesParams {
offset?: number;
limit?: number;
timeout?: number;
allowed_updates?: string[];
}
export {};