MCPcopy Create free account
hub / github.com/TGX-Android/Publisher / processPrivateCommand

Function processPrivateCommand

main.js:2249–3583  ·  view source on GitHub ↗
(botId, bot, msg, command, commandArgsRaw)

Source from the content-addressed store, hash-verified

2247function sendArray (bot, chatId, array, parseMode, delimiter) {
2248 if (!array || !array.length) {
2249 bot.sendMessage(chatId, '<b>Nothing found!</b>', {parse_mode: 'HTML'}).catch(globalErrorHandler());
2250 return;
2251 }
2252 if (!delimiter) {
2253 delimiter = '\n';
2254 }
2255 let remaining = array.length;
2256 let text = '';
2257 while (remaining > 0) {
2258 const item = array[array.length - remaining];
2259 if (text.length + item.length + (text.length ? delimiter.length : 0) > MAX_TEXT_MESSAGE_LENGTH) {
2260 bot.sendMessage(chatId, text, {parse_mode: parseMode}).catch(globalErrorHandler());
2261 text = item;
2262 } else {
2263 if (text.length) {
2264 text += delimiter;
2265 }
2266 text += item;
2267 }
2268 remaining--;
2269 if (remaining == 0) {
2270 bot.sendMessage(chatId, text, {parse_mode: parseMode}).catch(globalErrorHandler());
2271 }
2272 }
2273}
2274
2275function sleep (milliseconds) {
2276 return new Promise(resolve => setTimeout(resolve, milliseconds))
2277}
2278
2279function toDisplayDate (seconds) {
2280 return new Date(seconds * 1000).toLocaleString('en-GB', {
2281 day: 'numeric',
2282 month: 'numeric',
2283 year: 'numeric',
2284 hour: 'numeric',
2285 minute: '2-digit',
2286 timeZoneName: 'short',
2287 timeZone: 'UTC'
2288 });
2289}
2290
2291function toDisplayPullRequestList (build, isGitHubRelease) {
2292 const remoteUrl = build.remoteUrl || (build.git ? build.git.remoteUrl : '');
2293 const toItem = (pullRequestId, pullRequestCommit, pullRequest, nextPullRequest) => {
2294 const pullRequestUrl = remoteUrl + '/pull/' + pullRequestId;
2295 let text = null;
2296 if (isGitHubRelease) {
2297 text = '**#' + pullRequestId + '**';
2298 } else {
2299 text = '<a href="' + pullRequestUrl + '"><b>' + pullRequestId + '</b></a>';
2300 }
2301 if (pullRequest) {
2302 const pullRequestSourceUrl = pullRequestUrl + '/files/' + pullRequest.commit.long;
2303 text += ' / ';
2304 if (isGitHubRelease) {
2305 text += '[' + pullRequest.commit.short + '](' + pullRequestSourceUrl + ')';
2306 } else {

Callers 1

messageCallbackFunction · 0.85

Calls 15

globalErrorHandlerFunction · 0.85
sendArrayFunction · 0.85
getGitDataFunction · 0.85
getAppVersionFunction · 0.85
getLocalChangesFunction · 0.85
escapeHtmlFunction · 0.85
gitPullFunction · 0.85
ucfirstFunction · 0.85
nextBuildIdFunction · 0.85
emptyFunction · 0.85

Tested by

no test coverage detected