Skip to content

Commit 5748278

Browse files
committed
add method copyMessage for telegram Bot API 5.0, add parameter protect_content for telegram Bot API 5.6.
1 parent ee383cc commit 5748278

File tree

2 files changed

+220
-0
lines changed

2 files changed

+220
-0
lines changed

packages/messaging-api-telegram/src/TelegramClient.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,40 @@ export default class TelegramClient {
322322
});
323323
}
324324

325+
/**
326+
* Use this method to forward messages of any kind.
327+
*
328+
* @param chatId - Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
329+
* @param fromChatId - Unique identifier for the chat where the original message was sent (or channel username in the format `@channelusername`)
330+
* @param messageId - Message identifier in the chat specified in fromChatId
331+
* @param options - Options for other optional parameters.
332+
* @returns On success, the sent Message is returned.
333+
*
334+
* @see https://core.telegram.org/bots/api#copymessage
335+
*
336+
* @example
337+
*
338+
* ```js
339+
* await client.copyMessage(CHAT_ID, USER_ID, MESSAGE_ID, {
340+
* disableNotification: true,
341+
* protect_content: true,
342+
* });
343+
* ```
344+
*/
345+
copyMessage(
346+
chatId: string | number,
347+
fromChatId: string | number,
348+
messageId: number,
349+
options?: TelegramTypes.CopyMessageOption
350+
): Promise<TelegramTypes.Message> {
351+
return this.request('/copyMessage', {
352+
chatId,
353+
fromChatId,
354+
messageId,
355+
...options,
356+
});
357+
}
358+
325359
/**
326360
* Use this method to send photos.
327361
*

0 commit comments

Comments
 (0)