telegram-bot-api-nodejs
Advanced tools
Comparing version 1.0.16 to 1.0.17
@@ -104,2 +104,3 @@ export type ChatType = "private" | "group" | "supergroup" | "channel"; | ||
pre_checkout_query?: PreCheckoutQuery; | ||
my_chat_member?: ChatMemberUpdated; | ||
} | ||
@@ -546,2 +547,22 @@ export interface WebhookInfo { | ||
} | ||
interface ChatMemberUpdated { | ||
chat: Chat; | ||
from: User; | ||
date: number; | ||
old_chat_member: ChatMember; | ||
new_chat_member: ChatMember; | ||
invite_link: ChatInviteLink; | ||
via_chat_folder_invite_link: boolean; | ||
} | ||
interface ChatInviteLink { | ||
invite_link: string; | ||
creator: User; | ||
creates_join_request: boolean; | ||
is_primary: boolean; | ||
is_revoked: boolean; | ||
name?: string; | ||
expire_date?: number; | ||
member_limit?: number; | ||
pending_join_request_count?: number; | ||
} | ||
interface Game { | ||
@@ -630,78 +651,2 @@ title: string; | ||
export declare function parseUpdate(update: any): Update; | ||
export declare function parseMessage(m: any): Message; | ||
export declare function parseUser(u: User): User; | ||
export declare function parseChat(c: Chat): { | ||
id: number; | ||
type: ChatType; | ||
title: string; | ||
username: string; | ||
first_name: string; | ||
last_name: string; | ||
}; | ||
export declare function parsePhotoSizes(p: PhotoSize[]): { | ||
file_id: string; | ||
file_unique_id: string; | ||
file_size: number; | ||
width: number; | ||
height: number; | ||
}[] | undefined; | ||
export declare function parsePhotoSize(p: PhotoSize): { | ||
file_id: string; | ||
file_unique_id: string; | ||
file_size: number; | ||
width: number; | ||
height: number; | ||
}; | ||
export declare function parseSticker(v: Sticker): Sticker; | ||
export declare function parseVideo(v: Video): Video; | ||
export declare function parseVoice(v: Voice): Voice; | ||
export declare function parseVideoNote(v: VideoNote): VideoNote; | ||
export declare function parseEntities(v: MessageEntity[]): MessageEntity[]; | ||
export declare function parseAudio(v: Audio): Audio; | ||
export declare function parseDocument(v: Document): Document; | ||
export declare function parseAnimation(v: Animation): Animation; | ||
export declare function parseContact(v: Contact): { | ||
phone_number: string; | ||
first_name: string; | ||
last_name: string; | ||
user_id: number; | ||
vcard: string; | ||
}; | ||
export declare function parseLocation(v: Location): { | ||
longitude: number; | ||
latitude: number; | ||
}; | ||
export declare function parseVenue(v: Venue): { | ||
location: { | ||
longitude: number; | ||
latitude: number; | ||
}; | ||
title: string; | ||
address: string; | ||
foursquare_id: string; | ||
foursquare_type: string; | ||
google_place_id: string; | ||
google_place_type: string; | ||
}; | ||
export declare function parsePoll(v: Poll): { | ||
id: string; | ||
question: string; | ||
options: { | ||
text: string; | ||
voter_count: number; | ||
}[]; | ||
is_closed: boolean; | ||
}; | ||
export declare function parsePollOptions(v: PollOption[]): { | ||
text: string; | ||
voter_count: number; | ||
}[]; | ||
export declare function parsePollOption(v: PollOption): { | ||
text: string; | ||
voter_count: number; | ||
}; | ||
/** | ||
* @see https://core.telegram.org/bots/api#callbackquery | ||
*/ | ||
export declare function parseCallbackQuery(v?: CallbackQuery): CallbackQuery | undefined; | ||
export declare function parseResponse<T>(response: Response): Promise<T>; | ||
@@ -708,0 +653,0 @@ export declare class TelegramError extends Error { |
46
index.js
@@ -199,5 +199,8 @@ /** | ||
} | ||
return u; | ||
return { | ||
...update, | ||
u | ||
}; | ||
} | ||
export function parseMessage(m) { | ||
function parseMessage(m) { | ||
return { | ||
@@ -238,3 +241,2 @@ ...m, | ||
// new_chat_members?: User[]; | ||
// left_chat_member?: User; | ||
// new_chat_title?: string; | ||
@@ -257,3 +259,3 @@ // new_chat_photo?: PhotoSize[]; | ||
} | ||
export function parseUser(u) { | ||
function parseUser(u) { | ||
return { | ||
@@ -269,3 +271,3 @@ id: String(u.id), | ||
} | ||
export function parseChat(c) { | ||
function parseChat(c) { | ||
return { | ||
@@ -280,3 +282,3 @@ id: Number(c.id), | ||
} | ||
export function parsePhotoSizes(p) { | ||
function parsePhotoSizes(p) { | ||
if (!Array.isArray(p)) { | ||
@@ -287,3 +289,3 @@ return void 0; | ||
} | ||
export function parsePhotoSize(p) { | ||
function parsePhotoSize(p) { | ||
return { | ||
@@ -297,3 +299,3 @@ file_id: String(p.file_id), | ||
} | ||
export function parseSticker(v) { | ||
function parseSticker(v) { | ||
return { | ||
@@ -308,3 +310,3 @@ file_id: String(v.file_id), | ||
} | ||
export function parseVideo(v) { | ||
function parseVideo(v) { | ||
return { | ||
@@ -321,3 +323,3 @@ file_id: String(v.file_id), | ||
} | ||
export function parseVoice(v) { | ||
function parseVoice(v) { | ||
return { | ||
@@ -330,3 +332,3 @@ file_id: String(v.file_id), | ||
} | ||
export function parseVideoNote(v) { | ||
function parseVideoNote(v) { | ||
return { | ||
@@ -339,3 +341,3 @@ file_id: String(v.file_id), | ||
} | ||
export function parseEntities(v) { | ||
function parseEntities(v) { | ||
if (!Array.isArray(v)) { | ||
@@ -354,3 +356,3 @@ return []; | ||
} | ||
export function parseAudio(v) { | ||
function parseAudio(v) { | ||
return { | ||
@@ -365,3 +367,3 @@ file_id: String(v.file_id), | ||
} | ||
export function parseDocument(v) { | ||
function parseDocument(v) { | ||
return { | ||
@@ -374,3 +376,3 @@ file_id: String(v.file_id), | ||
} | ||
export function parseAnimation(v) { | ||
function parseAnimation(v) { | ||
return { | ||
@@ -387,3 +389,3 @@ file_id: String(v.file_id), | ||
} | ||
export function parseContact(v) { | ||
function parseContact(v) { | ||
return { | ||
@@ -397,3 +399,3 @@ phone_number: String(v.phone_number), | ||
} | ||
export function parseLocation(v) { | ||
function parseLocation(v) { | ||
return { | ||
@@ -404,3 +406,3 @@ longitude: Number(v.longitude), | ||
} | ||
export function parseVenue(v) { | ||
function parseVenue(v) { | ||
return { | ||
@@ -416,3 +418,3 @@ location: parseLocation(v.location), | ||
} | ||
export function parsePoll(v) { | ||
function parsePoll(v) { | ||
return { | ||
@@ -425,6 +427,6 @@ id: String(v.id), | ||
} | ||
export function parsePollOptions(v) { | ||
function parsePollOptions(v) { | ||
return Array.isArray(v) ? v.map(parsePollOption) : []; | ||
} | ||
export function parsePollOption(v) { | ||
function parsePollOption(v) { | ||
return { | ||
@@ -438,3 +440,3 @@ text: String(v.text), | ||
*/ | ||
export function parseCallbackQuery(v) { | ||
function parseCallbackQuery(v) { | ||
if (!v) { | ||
@@ -441,0 +443,0 @@ return; |
{ | ||
"name": "telegram-bot-api-nodejs", | ||
"version": "1.0.16", | ||
"version": "1.0.17", | ||
"description": "Telegram Bot API client for nodejs", | ||
@@ -5,0 +5,0 @@ "type": "module", |
37791
1214