MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / sendTransformedMedia

Method sendTransformedMedia

rev/rev.ts:290–328  ·  view source on GitHub ↗
(
		client: any,
		msg: Api.Message,
		replyMsg: Api.Message,
		outputPath: string,
		isWebm: boolean,
		isWebp: boolean,
		captionText?: string,
		captionEntities: any[] = []
	)

Source from the content-addressed store, hash-verified

288 throw new Error('ffmpeg 未生成输出文件');
289 }
290 }
291
292 private async sendTransformedMedia(
293 client: any,
294 msg: Api.Message,
295 replyMsg: Api.Message,
296 outputPath: string,
297 isWebm: boolean,
298 isWebp: boolean,
299 captionText?: string,
300 captionEntities: any[] = []
301 ) {
302 const sendOptions: any = {
303 file: outputPath,
304 replyTo: replyMsg.id,
305 };
306
307 // 处理文字说明
308 if (captionText) {
309 const { reversed, reversedEntities } = this.reverseStringWithEntities(
310 captionText,
311 captionEntities
312 );
313 sendOptions.caption = reversed;
314 if (reversedEntities.length > 0) {
315 sendOptions.entities = reversedEntities;
316 }
317 }
318
319 // WebM 和 WebP 作为贴纸发送
320 if (isWebm || isWebp) {
321 sendOptions.attributes = [
322 new Api.DocumentAttributeSticker({
323 alt: 'fan',
324 stickerset: new Api.InputStickerSetEmpty(),
325 }),
326 ];
327 }
328
329 await client.sendFile(msg.peerId, sendOptions);
330 }
331

Callers 1

Calls 1

Tested by

no test coverage detected