|
|
@ -13,7 +13,7 @@ import { RichTextProcessor } from "../richtextprocessor"; |
|
|
|
import $rootScope from "../rootScope"; |
|
|
|
import $rootScope from "../rootScope"; |
|
|
|
import searchIndexManager from '../searchIndexManager'; |
|
|
|
import searchIndexManager from '../searchIndexManager'; |
|
|
|
import AppStorage from '../storage'; |
|
|
|
import AppStorage from '../storage'; |
|
|
|
import { copy, deepEqual, getObjectKeysAndSort, langPack, limitSymbols, listMergeSorted, safeReplaceObject, tsNow } from "../utils"; |
|
|
|
import { copy, deepEqual, getObjectKeysAndSort, langPack, limitSymbols, listMergeSorted, safeReplaceObject, splitStringByLength, tsNow } from "../utils"; |
|
|
|
//import { telegramMeWebService } from "../mtproto/mtproto";
|
|
|
|
//import { telegramMeWebService } from "../mtproto/mtproto";
|
|
|
|
import apiUpdatesManager from "./apiUpdatesManager"; |
|
|
|
import apiUpdatesManager from "./apiUpdatesManager"; |
|
|
|
import appChatsManager from "./appChatsManager"; |
|
|
|
import appChatsManager from "./appChatsManager"; |
|
|
@ -738,19 +738,28 @@ export class AppMessagesManager { |
|
|
|
clearDraft: true, |
|
|
|
clearDraft: true, |
|
|
|
webPage: any |
|
|
|
webPage: any |
|
|
|
}> = {}) { |
|
|
|
}> = {}) { |
|
|
|
if(typeof(text) != 'string') { |
|
|
|
if(typeof(text) != 'string' || !text.length) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const MAX_LENGTH = 4096; |
|
|
|
|
|
|
|
if(text.length > MAX_LENGTH) { |
|
|
|
|
|
|
|
const splitted = splitStringByLength(text, MAX_LENGTH); |
|
|
|
|
|
|
|
text = splitted[0]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(let i = 1; i < splitted.length; ++i) { |
|
|
|
|
|
|
|
//setTimeout(() => {
|
|
|
|
|
|
|
|
this.sendText(peerID, splitted[i], options); |
|
|
|
|
|
|
|
//}, i);
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
peerID = appPeersManager.getPeerMigratedTo(peerID) || peerID; |
|
|
|
peerID = appPeersManager.getPeerMigratedTo(peerID) || peerID; |
|
|
|
|
|
|
|
|
|
|
|
var entities = options.entities || []; |
|
|
|
var entities = options.entities || []; |
|
|
|
if(!options.viaBotID) { |
|
|
|
if(!options.viaBotID) { |
|
|
|
text = RichTextProcessor.parseMarkdown(text, entities); |
|
|
|
text = RichTextProcessor.parseMarkdown(text, entities); |
|
|
|
} |
|
|
|
} |
|
|
|
if(!text.length) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var sendEntites = this.getInputEntities(entities); |
|
|
|
var sendEntites = this.getInputEntities(entities); |
|
|
|
if(!sendEntites.length) { |
|
|
|
if(!sendEntites.length) { |
|
|
|