diff --git a/gramjs/client/messages.ts b/gramjs/client/messages.ts index d49a5e0c..39f29ed8 100644 --- a/gramjs/client/messages.ts +++ b/gramjs/client/messages.ts @@ -481,7 +481,7 @@ export interface SendMessageParams { /** A list of message formatting entities. When provided, the parseMode is ignored. */ formattingEntities?: Api.TypeMessageEntity[]; /** Should the link preview be shown? */ - linkPreview?: boolean; + linkPreview?: boolean | { showAboveText: boolean}; /** Sends a message with a file attached (e.g. a photo, video, audio or document). The message may be empty. */ file?: FileLike | FileLike[]; /** Optional JPEG thumbnail (for documents). Telegram will ignore this parameter unless you pass a .jpg file!
@@ -551,7 +551,7 @@ export interface EditMessageParams { /** A list of message formatting entities. When provided, the parseMode is ignored. */ formattingEntities?: Api.TypeMessageEntity[]; /** Should the link preview be shown? */ - linkPreview?: boolean; + linkPreview?: boolean | { showAboveText: boolean}; /** The file object that should replace the existing media in the message. Does nothing if entity was a Message */ file?: FileLike; /** Whether to send the given file as a document or not. */ @@ -735,6 +735,7 @@ export async function sendMessage( noforwards: noforwards, commentTo: commentTo, topMsgId: topMsgId, + invertMedia: typeof linkPreview === 'object' ? linkPreview.showAboveText : false, }); } entity = await client.getInputEntity(entity); @@ -785,6 +786,7 @@ export async function sendMessage( entities: message.entities, clearDraft: clearDraft, noWebpage: !(message.media instanceof Api.MessageMediaWebPage), + invertMedia: typeof linkPreview === 'object' ? linkPreview.showAboveText : false, scheduleDate: schedule, noforwards: noforwards, }); @@ -808,6 +810,7 @@ export async function sendMessage( message: message.toString(), entities: formattingEntities, noWebpage: !linkPreview, + invertMedia: typeof linkPreview === 'object' ? linkPreview.showAboveText : false, replyTo: replyObject, clearDraft: clearDraft, silent: silent, @@ -977,6 +980,7 @@ export async function editMessage( id, message: text, noWebpage: !linkPreview, + invertMedia: typeof linkPreview === 'object' ? linkPreview.showAboveText : false, entities, media: inputMedia, replyMarkup: markup, diff --git a/gramjs/client/uploads.ts b/gramjs/client/uploads.ts index df98d055..df81801b 100644 --- a/gramjs/client/uploads.ts +++ b/gramjs/client/uploads.ts @@ -292,6 +292,10 @@ export interface SendFileInterface { * Used for threads to reply to a specific thread */ topMsgId?: number | Api.Message; + /** + * Show media (usually link preview) on the top of message text + */ + invertMedia?: boolean; } interface FileToMediaInterface { @@ -519,6 +523,7 @@ export async function _sendAlbum( noforwards, commentTo, topMsgId, + invertMedia = false, }: SendFileInterface ) { entity = await client.getInputEntity(entity); @@ -620,6 +625,7 @@ export async function _sendAlbum( scheduleDate: scheduleDate, clearDraft: clearDraft, noforwards: noforwards, + invertMedia: invertMedia, }) ); const randomIds = albumFiles.map((m) => m.randomId); @@ -652,6 +658,7 @@ export async function sendFile( noforwards, commentTo, topMsgId, + invertMedia = false, }: SendFileInterface ) { if (!file) { @@ -682,6 +689,7 @@ export async function sendFile( forceDocument: forceDocument, noforwards: noforwards, topMsgId: topMsgId, + invertMedia: invertMedia, }); } if (Array.isArray(caption)) { @@ -734,6 +742,7 @@ export async function sendFile( scheduleDate: scheduleDate, clearDraft: clearDraft, noforwards: noforwards, + invertMedia: invertMedia, }); const result = await client.invoke(request); return client._getResponseMessage(request, result, entity) as Api.Message;