|
|
@ -2733,9 +2733,9 @@ export class AppMessagesManager { |
|
|
|
public wrapMessageForReply(message: MyMessage | MyDraftMessage, text: string, usingMids: number[], plain: true, highlightWord?: string, withoutMediaType?: boolean): string; |
|
|
|
public wrapMessageForReply(message: MyMessage | MyDraftMessage, text: string, usingMids: number[], plain: true, highlightWord?: string, withoutMediaType?: boolean): string; |
|
|
|
public wrapMessageForReply(message: MyMessage | MyDraftMessage, text?: string, usingMids?: number[], plain?: false, highlightWord?: string, withoutMediaType?: boolean): DocumentFragment; |
|
|
|
public wrapMessageForReply(message: MyMessage | MyDraftMessage, text?: string, usingMids?: number[], plain?: false, highlightWord?: string, withoutMediaType?: boolean): DocumentFragment; |
|
|
|
public wrapMessageForReply(message: MyMessage | MyDraftMessage, text: string = (message as Message.message).message, usingMids?: number[], plain?: boolean, highlightWord?: string, withoutMediaType?: boolean): DocumentFragment | string { |
|
|
|
public wrapMessageForReply(message: MyMessage | MyDraftMessage, text: string = (message as Message.message).message, usingMids?: number[], plain?: boolean, highlightWord?: string, withoutMediaType?: boolean): DocumentFragment | string { |
|
|
|
const parts: (HTMLElement | string)[] = []; |
|
|
|
const parts: (Node | string)[] = []; |
|
|
|
|
|
|
|
|
|
|
|
const addPart = (langKey: LangPackKey, part?: string | HTMLElement, text?: string) => { |
|
|
|
const addPart = (langKey: LangPackKey, part?: string | HTMLElement) => { |
|
|
|
if(langKey) { |
|
|
|
if(langKey) { |
|
|
|
part = plain ? I18n.format(langKey, true) : i18n(langKey); |
|
|
|
part = plain ? I18n.format(langKey, true) : i18n(langKey); |
|
|
|
} |
|
|
|
} |
|
|
@ -2748,10 +2748,6 @@ export class AppMessagesManager { |
|
|
|
else el.append(part); |
|
|
|
else el.append(part); |
|
|
|
parts.push(el); |
|
|
|
parts.push(el); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(text) { |
|
|
|
|
|
|
|
parts.push(', '); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if((message as Message.message).media) { |
|
|
|
if((message as Message.message).media) { |
|
|
@ -2776,7 +2772,7 @@ export class AppMessagesManager { |
|
|
|
text = this.getAlbumText(message.grouped_id).message; |
|
|
|
text = this.getAlbumText(message.grouped_id).message; |
|
|
|
|
|
|
|
|
|
|
|
if(!withoutMediaType) { |
|
|
|
if(!withoutMediaType) { |
|
|
|
addPart('AttachAlbum', undefined, text); |
|
|
|
addPart('AttachAlbum'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -2787,15 +2783,14 @@ export class AppMessagesManager { |
|
|
|
const media = message.media; |
|
|
|
const media = message.media; |
|
|
|
switch(media._) { |
|
|
|
switch(media._) { |
|
|
|
case 'messageMediaPhoto': |
|
|
|
case 'messageMediaPhoto': |
|
|
|
addPart('AttachPhoto', undefined, message.message); |
|
|
|
addPart('AttachPhoto'); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'messageMediaDice': |
|
|
|
case 'messageMediaDice': |
|
|
|
addPart(undefined, plain ? media.emoticon : RichTextProcessor.wrapEmojiText(media.emoticon)); |
|
|
|
addPart(undefined, plain ? media.emoticon : RichTextProcessor.wrapEmojiText(media.emoticon)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'messageMediaVenue': { |
|
|
|
case 'messageMediaVenue': { |
|
|
|
const text = plain ? media.title : RichTextProcessor.wrapEmojiText(media.title); |
|
|
|
text = media.title; |
|
|
|
addPart('AttachLocation', undefined, text); |
|
|
|
addPart('AttachLocation'); |
|
|
|
parts.push(htmlToDocumentFragment(text) as any); |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
case 'messageMediaGeo': |
|
|
|
case 'messageMediaGeo': |
|
|
@ -2812,20 +2807,20 @@ export class AppMessagesManager { |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'messageMediaGame': { |
|
|
|
case 'messageMediaGame': { |
|
|
|
const prefix = '🎮' + ' '; |
|
|
|
const prefix = '🎮' + ' '; |
|
|
|
addPart(undefined, plain ? prefix + media.game.title : RichTextProcessor.wrapEmojiText(prefix + media.game.title)); |
|
|
|
text = prefix + media.game.title; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
case 'messageMediaDocument': { |
|
|
|
case 'messageMediaDocument': { |
|
|
|
const document = media.document as MyDocument; |
|
|
|
const document = media.document as MyDocument; |
|
|
|
|
|
|
|
|
|
|
|
if(document.type === 'video') { |
|
|
|
if(document.type === 'video') { |
|
|
|
addPart('AttachVideo', undefined, message.message); |
|
|
|
addPart('AttachVideo'); |
|
|
|
} else if(document.type === 'voice') { |
|
|
|
} else if(document.type === 'voice') { |
|
|
|
addPart('AttachAudio', undefined, message.message); |
|
|
|
addPart('AttachAudio'); |
|
|
|
} else if(document.type === 'gif') { |
|
|
|
} else if(document.type === 'gif') { |
|
|
|
addPart('AttachGif', undefined, message.message); |
|
|
|
addPart('AttachGif'); |
|
|
|
} else if(document.type === 'round') { |
|
|
|
} else if(document.type === 'round') { |
|
|
|
addPart('AttachRound', undefined, message.message); |
|
|
|
addPart('AttachRound'); |
|
|
|
} else if(document.type === 'sticker') { |
|
|
|
} else if(document.type === 'sticker') { |
|
|
|
if(document.stickerEmojiRaw) { |
|
|
|
if(document.stickerEmojiRaw) { |
|
|
|
addPart(undefined, (plain ? document.stickerEmojiRaw : document.stickerEmoji) + ' '); |
|
|
|
addPart(undefined, (plain ? document.stickerEmojiRaw : document.stickerEmoji) + ' '); |
|
|
@ -2836,9 +2831,9 @@ export class AppMessagesManager { |
|
|
|
} else if(document.type === 'audio') { |
|
|
|
} else if(document.type === 'audio') { |
|
|
|
const attribute = document.attributes.find(attribute => attribute._ === 'documentAttributeAudio' && (attribute.title || attribute.performer)) as DocumentAttribute.documentAttributeAudio; |
|
|
|
const attribute = document.attributes.find(attribute => attribute._ === 'documentAttributeAudio' && (attribute.title || attribute.performer)) as DocumentAttribute.documentAttributeAudio; |
|
|
|
const f = '🎵' + ' ' + (attribute ? [attribute.title, attribute.performer].filter(Boolean).join(' - ') : document.file_name); |
|
|
|
const f = '🎵' + ' ' + (attribute ? [attribute.title, attribute.performer].filter(Boolean).join(' - ') : document.file_name); |
|
|
|
addPart(undefined, plain ? f : RichTextProcessor.wrapEmojiText(f), message.message); |
|
|
|
addPart(undefined, plain ? f : RichTextProcessor.wrapEmojiText(f)); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
addPart(undefined, plain ? document.file_name : RichTextProcessor.wrapEmojiText(document.file_name), message.message); |
|
|
|
addPart(undefined, plain ? document.file_name : RichTextProcessor.wrapEmojiText(document.file_name)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
@ -2850,6 +2845,10 @@ export class AppMessagesManager { |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(text && parts.length) { |
|
|
|
|
|
|
|
parts.push(', '); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if((message as Message.messageService).action) { |
|
|
|
if((message as Message.messageService).action) { |
|
|
|