Skip to content

Commit

Permalink
add method copyMessage for telegram Bot API 5.0, add parameter protec…
Browse files Browse the repository at this point in the history
…t_content for telegram Bot API 5.6.
  • Loading branch information
Cojad committed Mar 20, 2022
1 parent ee383cc commit 5748278
Show file tree
Hide file tree
Showing 2 changed files with 220 additions and 0 deletions.
34 changes: 34 additions & 0 deletions packages/messaging-api-telegram/src/TelegramClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,40 @@ export default class TelegramClient {
});
}

/**
* Use this method to forward messages of any kind.
*
* @param chatId - Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
* @param fromChatId - Unique identifier for the chat where the original message was sent (or channel username in the format `@channelusername`)
* @param messageId - Message identifier in the chat specified in fromChatId
* @param options - Options for other optional parameters.
* @returns On success, the sent Message is returned.
*
* @see https://core.telegram.org/bots/api#copymessage
*
* @example
*
* ```js
* await client.copyMessage(CHAT_ID, USER_ID, MESSAGE_ID, {
* disableNotification: true,
* protect_content: true,
* });
* ```
*/
copyMessage(
chatId: string | number,
fromChatId: string | number,
messageId: number,
options?: TelegramTypes.CopyMessageOption
): Promise<TelegramTypes.Message> {
return this.request('/copyMessage', {
chatId,
fromChatId,
messageId,
...options,
});
}

/**
* Use this method to send photos.
*
Expand Down
Loading

0 comments on commit 5748278

Please sign in to comment.