|
|
@ -1297,10 +1297,18 @@ angular.module('myApp.services') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function sendText(peerID, text, options) { |
|
|
|
function sendText(peerID, text, options) { |
|
|
|
if (!angular.isString(text) || !text.length) { |
|
|
|
if (!angular.isString(text)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
options = options || {}; |
|
|
|
options = options || {}; |
|
|
|
|
|
|
|
var entities = options.entities || []; |
|
|
|
|
|
|
|
if (!options.viaBotID) { |
|
|
|
|
|
|
|
text = RichTextProcessor.parseMarkdown(text, entities); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!text.length) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var messageID = tempID--, |
|
|
|
var messageID = tempID--, |
|
|
|
randomID = [nextRandomInt(0xFFFFFFFF), nextRandomInt(0xFFFFFFFF)], |
|
|
|
randomID = [nextRandomInt(0xFFFFFFFF), nextRandomInt(0xFFFFFFFF)], |
|
|
|
randomIDS = bigint(randomID[0]).shiftLeft(32).add(bigint(randomID[1])).toString(), |
|
|
|
randomIDS = bigint(randomID[0]).shiftLeft(32).add(bigint(randomID[1])).toString(), |
|
|
@ -1311,13 +1319,8 @@ angular.module('myApp.services') |
|
|
|
isChannel = AppPeersManager.isChannel(peerID), |
|
|
|
isChannel = AppPeersManager.isChannel(peerID), |
|
|
|
isMegagroup = isChannel && AppPeersManager.isMegagroup(peerID), |
|
|
|
isMegagroup = isChannel && AppPeersManager.isMegagroup(peerID), |
|
|
|
asChannel = isChannel && !isMegagroup ? true : false, |
|
|
|
asChannel = isChannel && !isMegagroup ? true : false, |
|
|
|
entities = options.entities || [], |
|
|
|
|
|
|
|
message; |
|
|
|
message; |
|
|
|
|
|
|
|
|
|
|
|
if (!options.viaBotID) { |
|
|
|
|
|
|
|
text = RichTextProcessor.parseMarkdown(text, entities); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (historyStorage === undefined) { |
|
|
|
if (historyStorage === undefined) { |
|
|
|
historyStorage = historiesStorage[peerID] = {count: null, history: [], pending: []}; |
|
|
|
historyStorage = historiesStorage[peerID] = {count: null, history: [], pending: []}; |
|
|
|
} |
|
|
|
} |
|
|
|