-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
781 additions
and
853 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,8 @@ | |
}, | ||
"pnpm": { | ||
"patchedDependencies": { | ||
"[email protected]": "patches/[email protected].patch", | ||
"@icqqjs/[email protected]": "patches/@[email protected].patch" | ||
"@icqqjs/[email protected]": "patches/@[email protected].patch", | ||
"[email protected]": "patches/[email protected].patch" | ||
} | ||
}, | ||
"packageManager": "[email protected]+sha512.38dc6fba8dba35b39340b9700112c2fe1e12f10b17134715a4aa98ccf7bb035e76fd981cf0bb384dfa98f8d6af5481c2bef2f4266a24bfa20c34eb7147ce0b5e" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
diff --git a/client/messages.d.ts b/client/messages.d.ts | ||
index 14f3730e5b406fcfeffe22e6735a1e109f496202..1efefbbfe996f098f45f346ac094426931acf078 100644 | ||
--- a/client/messages.d.ts | ||
+++ b/client/messages.d.ts | ||
@@ -113,7 +113,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!<br/> | ||
@@ -181,7 +181,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. */ | ||
diff --git a/client/messages.js b/client/messages.js | ||
index 78899794ddf8f71d7769bfd19227ed8670ea8548..b0f40c0ee6d0350e36a2814d576704ba1eb76953 100644 | ||
--- a/client/messages.js | ||
+++ b/client/messages.js | ||
@@ -461,6 +461,7 @@ entity, | ||
noforwards: noforwards, | ||
commentTo: commentTo, | ||
topMsgId: topMsgId, | ||
+ invertMedia: typeof linkPreview === 'object' ? linkPreview.showAboveText : false, | ||
}); | ||
} | ||
entity = await client.getInputEntity(entity); | ||
@@ -508,6 +509,7 @@ entity, | ||
entities: message.entities, | ||
clearDraft: clearDraft, | ||
noWebpage: !(message.media instanceof tl_1.Api.MessageMediaWebPage), | ||
+ invertMedia: typeof linkPreview === 'object' ? linkPreview.showAboveText : false, | ||
scheduleDate: schedule, | ||
noforwards: noforwards, | ||
}); | ||
@@ -525,6 +527,7 @@ entity, | ||
message: message.toString(), | ||
entities: formattingEntities, | ||
noWebpage: !linkPreview, | ||
+ invertMedia: typeof linkPreview === 'object' ? linkPreview.showAboveText : false, | ||
replyTo: replyObject, | ||
clearDraft: clearDraft, | ||
silent: silent, | ||
@@ -658,6 +661,7 @@ async function editMessage(client, entity, { message, text, parseMode, formattin | ||
id, | ||
message: text, | ||
noWebpage: !linkPreview, | ||
+ invertMedia: typeof linkPreview === 'object' ? linkPreview.showAboveText : false, | ||
entities, | ||
media: inputMedia, | ||
replyMarkup: markup, | ||
diff --git a/client/uploads.d.ts b/client/uploads.d.ts | ||
index ff7af2d3be9b32162b5e1630d4b16ab0c7547649..f4768c29ea555638a7ebce7405bed56dba5c43e7 100644 | ||
--- a/client/uploads.d.ts | ||
+++ b/client/uploads.d.ts | ||
@@ -109,6 +109,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 { | ||
file: FileLike; | ||
diff --git a/client/uploads.js b/client/uploads.js | ||
index 9392c42342a97ee253be8295c1a086b690673dca..3721a18b92568236faca12837b3fb074760525ec 100644 | ||
--- a/client/uploads.js | ||
+++ b/client/uploads.js | ||
@@ -316,7 +316,7 @@ async function _fileToMedia(client, { file, forceDocument, fileSize, progressCal | ||
} | ||
exports._fileToMedia = _fileToMedia; | ||
/** @hidden */ | ||
-async function _sendAlbum(client, entity, { file, caption, forceDocument = false, fileSize, clearDraft = false, progressCallback, replyTo, attributes, thumb, parseMode, voiceNote = false, videoNote = false, silent, supportsStreaming = false, scheduleDate, workers = 1, noforwards, commentTo, topMsgId, }) { | ||
+async function _sendAlbum(client, entity, { file, caption, forceDocument = false, fileSize, clearDraft = false, progressCallback, replyTo, attributes, thumb, parseMode, voiceNote = false, videoNote = false, silent, supportsStreaming = false, scheduleDate, workers = 1, noforwards, commentTo, topMsgId, invertMedia = false, }) { | ||
entity = await client.getInputEntity(entity); | ||
let files = []; | ||
if (!Array.isArray(file)) { | ||
@@ -408,13 +408,14 @@ async function _sendAlbum(client, entity, { file, caption, forceDocument = false | ||
scheduleDate: scheduleDate, | ||
clearDraft: clearDraft, | ||
noforwards: noforwards, | ||
+ invertMedia: invertMedia, | ||
})); | ||
const randomIds = albumFiles.map((m) => m.randomId); | ||
return client._getResponseMessage(randomIds, result, entity); | ||
} | ||
exports._sendAlbum = _sendAlbum; | ||
/** @hidden */ | ||
-async function sendFile(client, entity, { file, caption, forceDocument = false, fileSize, clearDraft = false, progressCallback, replyTo, attributes, thumb, parseMode, formattingEntities, voiceNote = false, videoNote = false, buttons, silent, supportsStreaming = false, scheduleDate, workers = 1, noforwards, commentTo, topMsgId, }) { | ||
+async function sendFile(client, entity, { file, caption, forceDocument = false, fileSize, clearDraft = false, progressCallback, replyTo, attributes, thumb, parseMode, formattingEntities, voiceNote = false, videoNote = false, buttons, silent, supportsStreaming = false, scheduleDate, workers = 1, noforwards, commentTo, topMsgId, invertMedia = false, }) { | ||
if (!file) { | ||
throw new Error("You need to specify a file"); | ||
} | ||
@@ -444,6 +445,7 @@ async function sendFile(client, entity, { file, caption, forceDocument = false, | ||
forceDocument: forceDocument, | ||
noforwards: noforwards, | ||
topMsgId: topMsgId, | ||
+ invertMedia: invertMedia, | ||
}); | ||
} | ||
if (Array.isArray(caption)) { | ||
@@ -491,6 +493,7 @@ async function sendFile(client, entity, { file, caption, forceDocument = false, | ||
scheduleDate: scheduleDate, | ||
clearDraft: clearDraft, | ||
noforwards: noforwards, | ||
+ invertMedia: invertMedia, | ||
}); | ||
const result = await client.invoke(request); | ||
return client._getResponseMessage(request, result, entity); |
Oops, something went wrong.