alicezetion 1.8.4 → 1.8.6
Sign up to get free protection for your applications and to get access to all the features.
- package/.cache/replit/__replit_disk_meta.json +1 -1
- package/.cache/replit/modules.stamp +1 -0
- package/.cache/replit/nix/env.json +1 -1
- package/index.js +376 -210
- package/leiamnash/addExternalModule.js +15 -0
- package/leiamnash/addUserToGroup.js +77 -0
- package/leiamnash/changeAdminStatus.js +47 -0
- package/leiamnash/changeArchivedStatus.js +41 -0
- package/leiamnash/changeAvatar.js +127 -0
- package/leiamnash/changeBio.js +64 -0
- package/leiamnash/changeBlockedStatus.js +36 -0
- package/leiamnash/changeGroupImage.js +105 -0
- package/leiamnash/changeNickname.js +43 -0
- package/leiamnash/changeThreadColor.js +61 -0
- package/leiamnash/changeThreadEmoji.js +41 -0
- package/{src → leiamnash}/chat.js +3 -28
- package/leiamnash/createNewGroup.js +70 -0
- package/leiamnash/createPoll.js +59 -0
- package/leiamnash/deleteMessage.js +44 -0
- package/leiamnash/deleteThread.js +42 -0
- package/leiamnash/forwardAttachment.js +47 -0
- package/leiamnash/forwardMessage.js +0 -0
- package/leiamnash/getCurrentUserID.js +7 -0
- package/leiamnash/getEmojiUrl.js +27 -0
- package/leiamnash/getFriendsList.js +73 -0
- package/leiamnash/getInfoVideo.js +134 -0
- package/leiamnash/getThreadHistory.js +537 -0
- package/leiamnash/getThreadHistoryDeprecated.js +71 -0
- package/{src → leiamnash}/getThreadInfo.js +54 -70
- package/leiamnash/getThreadInfoDeprecated.js +56 -0
- package/leiamnash/getThreadList.js +213 -0
- package/leiamnash/getThreadListDeprecated.js +46 -0
- package/leiamnash/getThreadPictures.js +59 -0
- package/leiamnash/getUserID.js +61 -0
- package/leiamnash/getUserInfo.js +66 -0
- package/leiamnash/handleFriendRequest.js +46 -0
- package/leiamnash/handleMessageRequest.js +47 -0
- package/leiamnash/httpGet.js +47 -0
- package/leiamnash/httpPost.js +47 -0
- package/leiamnash/httpPostFormData.js +42 -0
- package/{src → leiamnash}/listenMqtt.js +6 -16
- package/leiamnash/logout.js +68 -0
- package/leiamnash/markAsDelivered.js +47 -0
- package/leiamnash/markAsRead.js +70 -0
- package/leiamnash/markAsReadAll.js +40 -0
- package/leiamnash/markAsSeen.js +48 -0
- package/leiamnash/muteThread.js +45 -0
- package/leiamnash/react.js +109 -0
- package/{src → leiamnash}/refreshFb_dtsg.js +1 -1
- package/leiamnash/removeUserFromGroup.js +45 -0
- package/leiamnash/resolvePhotoUrl.js +36 -0
- package/leiamnash/searchForThread.js +42 -0
- package/leiamnash/seen.js +40 -0
- package/leiamnash/sendMessage.js +315 -0
- package/leiamnash/sendTypingIndicator.js +70 -0
- package/leiamnash/setMessageReaction.js +103 -0
- package/leiamnash/setPostReaction.js +63 -0
- package/leiamnash/setTitle.js +70 -0
- package/leiamnash/threadColors.js +41 -0
- package/{src/getAccess.js → leiamnash/token.js} +2 -2
- package/leiamnash/unfriend.js +42 -0
- package/leiamnash/unsendMessage.js +39 -0
- package/leiamnash/uploadAttachment.js +96 -0
- package/package.json +3 -6
- package/replit.nix +4 -4
- package/utils.js +176 -119
- package/src/addExternalModule.js +0 -17
- package/src/addUserToGroup.js +0 -113
- package/src/changeAdminStatus.js +0 -79
- package/src/changeArchivedStatus.js +0 -55
- package/src/changeAvatar.js +0 -93
- package/src/changeBio.js +0 -77
- package/src/changeBlockedStatus.js +0 -47
- package/src/changeCover.js +0 -73
- package/src/changeGroupImage.js +0 -132
- package/src/changeName.js +0 -79
- package/src/changeNickname.js +0 -59
- package/src/changeThreadColor.js +0 -65
- package/src/changeThreadEmoji.js +0 -55
- package/src/createNewGroup.js +0 -86
- package/src/createPoll.js +0 -71
- package/src/data/getThreadInfo.json +0 -1
- package/src/deleteMessage.js +0 -56
- package/src/deleteThread.js +0 -56
- package/src/forwardAttachment.js +0 -60
- package/src/getAvatarUser.js +0 -78
- package/src/getCurrentUserID.js +0 -7
- package/src/getEmojiUrl.js +0 -29
- package/src/getFriendsList.js +0 -83
- package/src/getThreadHistory.js +0 -666
- package/src/getThreadList.js +0 -237
- package/src/getThreadPictures.js +0 -79
- package/src/getUserID.js +0 -66
- package/src/getUserInfo.js +0 -163
- package/src/handleFriendRequest.js +0 -61
- package/src/handleMessageRequest.js +0 -65
- package/src/httpGet.js +0 -57
- package/src/httpPost.js +0 -57
- package/src/httpPostFormData.js +0 -63
- package/src/listenNotification.js +0 -88
- package/src/logout.js +0 -275
- package/src/markAsDelivered.js +0 -58
- package/src/markAsRead.js +0 -80
- package/src/markAsReadAll.js +0 -50
- package/src/markAsSeen.js +0 -59
- package/src/muteThread.js +0 -52
- package/src/react.js +0 -117
- package/src/removeUserFromGroup.js +0 -79
- package/src/resolvePhotoUrl.js +0 -45
- package/src/searchForThread.js +0 -53
- package/src/searchStickers.js +0 -52
- package/src/seen.js +0 -50
- package/src/sendMessage.js +0 -477
- package/src/sendMessageMqtt.js +0 -316
- package/src/sendTypingIndicator.js +0 -103
- package/src/setMessageReaction.js +0 -117
- package/src/setPostReaction.js +0 -109
- package/src/setTitle.js +0 -86
- package/src/threadColors.js +0 -131
- package/src/unfriend.js +0 -52
- package/src/unsendMessage.js +0 -49
- /package/{src → leiamnash}/getMessage.js +0 -0
package/src/httpGet.js
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
const log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
return function httpGet(url, form, customHeader, callback, notAPI) {
|
8
|
-
let resolveFunc = function () { };
|
9
|
-
let rejectFunc = function () { };
|
10
|
-
|
11
|
-
const returnPromise = new Promise(function (resolve, reject) {
|
12
|
-
resolveFunc = resolve;
|
13
|
-
rejectFunc = reject;
|
14
|
-
});
|
15
|
-
|
16
|
-
if (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction") {
|
17
|
-
callback = form;
|
18
|
-
form = {};
|
19
|
-
}
|
20
|
-
|
21
|
-
if (utils.getType(customHeader) == "Function" || utils.getType(customHeader) == "AsyncFunction") {
|
22
|
-
callback = customHeader;
|
23
|
-
customHeader = {};
|
24
|
-
}
|
25
|
-
|
26
|
-
customHeader = customHeader || {};
|
27
|
-
|
28
|
-
callback = callback || function (err, data) {
|
29
|
-
if (err) return rejectFunc(err);
|
30
|
-
resolveFunc(data);
|
31
|
-
};
|
32
|
-
|
33
|
-
if (notAPI) {
|
34
|
-
utils
|
35
|
-
.get(url, ctx.jar, form, ctx.globalOptions, ctx, customHeader)
|
36
|
-
.then(function (resData) {
|
37
|
-
callback(null, resData.body.toString());
|
38
|
-
})
|
39
|
-
.catch(function (err) {
|
40
|
-
log.error("httpGet", err);
|
41
|
-
return callback(err);
|
42
|
-
});
|
43
|
-
} else {
|
44
|
-
defaultFuncs
|
45
|
-
.get(url, ctx.jar, form, null, customHeader)
|
46
|
-
.then(function (resData) {
|
47
|
-
callback(null, resData.body.toString());
|
48
|
-
})
|
49
|
-
.catch(function (err) {
|
50
|
-
log.error("httpGet", err);
|
51
|
-
return callback(err);
|
52
|
-
});
|
53
|
-
}
|
54
|
-
|
55
|
-
return returnPromise;
|
56
|
-
};
|
57
|
-
};
|
package/src/httpPost.js
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
const log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
return function httpPost(url, form, customHeader, callback, notAPI) {
|
8
|
-
let resolveFunc = function () { };
|
9
|
-
let rejectFunc = function () { };
|
10
|
-
|
11
|
-
const returnPromise = new Promise(function (resolve, reject) {
|
12
|
-
resolveFunc = resolve;
|
13
|
-
rejectFunc = reject;
|
14
|
-
});
|
15
|
-
|
16
|
-
if (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction") {
|
17
|
-
callback = form;
|
18
|
-
form = {};
|
19
|
-
}
|
20
|
-
|
21
|
-
if (utils.getType(customHeader) == "Function" || utils.getType(customHeader) == "AsyncFunction") {
|
22
|
-
callback = customHeader;
|
23
|
-
customHeader = {};
|
24
|
-
}
|
25
|
-
|
26
|
-
customHeader = customHeader || {};
|
27
|
-
|
28
|
-
callback = callback || function (err, data) {
|
29
|
-
if (err) return rejectFunc(err);
|
30
|
-
resolveFunc(data);
|
31
|
-
};
|
32
|
-
|
33
|
-
if (notAPI) {
|
34
|
-
utils
|
35
|
-
.post(url, ctx.jar, form, ctx.globalOptions, ctx, customHeader)
|
36
|
-
.then(function (resData) {
|
37
|
-
callback(null, resData.body.toString());
|
38
|
-
})
|
39
|
-
.catch(function (err) {
|
40
|
-
log.error("httpPost", err);
|
41
|
-
return callback(err);
|
42
|
-
});
|
43
|
-
} else {
|
44
|
-
defaultFuncs
|
45
|
-
.post(url, ctx.jar, form, {}, customHeader)
|
46
|
-
.then(function (resData) {
|
47
|
-
callback(null, resData.body.toString());
|
48
|
-
})
|
49
|
-
.catch(function (err) {
|
50
|
-
log.error("httpPost", err);
|
51
|
-
return callback(err);
|
52
|
-
});
|
53
|
-
}
|
54
|
-
|
55
|
-
return returnPromise;
|
56
|
-
};
|
57
|
-
};
|
package/src/httpPostFormData.js
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
const log = require("npmlog");
|
5
|
-
|
6
|
-
|
7
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
8
|
-
return function httpPostFormData(url, form, customHeader, callback, notAPI) {
|
9
|
-
let resolveFunc = function () { };
|
10
|
-
let rejectFunc = function () { };
|
11
|
-
|
12
|
-
const returnPromise = new Promise(function (resolve, reject) {
|
13
|
-
resolveFunc = resolve;
|
14
|
-
rejectFunc = reject;
|
15
|
-
});
|
16
|
-
|
17
|
-
if (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction") {
|
18
|
-
callback = form;
|
19
|
-
form = {};
|
20
|
-
}
|
21
|
-
|
22
|
-
if (utils.getType(customHeader) == "Function" || utils.getType(customHeader) == "AsyncFunction") {
|
23
|
-
callback = customHeader;
|
24
|
-
customHeader = {};
|
25
|
-
}
|
26
|
-
|
27
|
-
customHeader = customHeader || {};
|
28
|
-
|
29
|
-
if (utils.getType(callback) == "Boolean") {
|
30
|
-
notAPI = callback;
|
31
|
-
callback = null;
|
32
|
-
}
|
33
|
-
|
34
|
-
callback = callback || function (err, data) {
|
35
|
-
if (err) return rejectFunc(err);
|
36
|
-
resolveFunc(data);
|
37
|
-
};
|
38
|
-
|
39
|
-
if (notAPI) {
|
40
|
-
utils
|
41
|
-
.postFormData(url, ctx.jar, form, ctx.globalOptions, ctx, customHeader)
|
42
|
-
.then(function (resData) {
|
43
|
-
callback(null, resData.body.toString());
|
44
|
-
})
|
45
|
-
.catch(function (err) {
|
46
|
-
log.error("httpPostFormData", err);
|
47
|
-
return callback(err);
|
48
|
-
});
|
49
|
-
} else {
|
50
|
-
defaultFuncs
|
51
|
-
.postFormData(url, ctx.jar, form, null, customHeader)
|
52
|
-
.then(function (resData) {
|
53
|
-
callback(null, resData.body.toString());
|
54
|
-
})
|
55
|
-
.catch(function (err) {
|
56
|
-
log.error("httpPostFormData", err);
|
57
|
-
return callback(err);
|
58
|
-
});
|
59
|
-
}
|
60
|
-
|
61
|
-
return returnPromise;
|
62
|
-
};
|
63
|
-
};
|
@@ -1,88 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var utils = require('../utils.js');
|
4
|
-
var log = require('npmlog');
|
5
|
-
|
6
|
-
function formatGraphResponse(data) {
|
7
|
-
var Obj = [];
|
8
|
-
var convertMS = function (ms, date) {
|
9
|
-
var time = (date - ms) / 1000;
|
10
|
-
return time;
|
11
|
-
};
|
12
|
-
var edges = data.viewer.notifications_page.edges;
|
13
|
-
|
14
|
-
for (let res of edges) {
|
15
|
-
res = res.node;
|
16
|
-
if (res.row_type !== 'NOTIFICATION') continue;
|
17
|
-
var timestamp = res.notif.creation_time.timestamp * 1000;
|
18
|
-
if (convertMS(timestamp, Date.now()) > 60) break;
|
19
|
-
var data = {
|
20
|
-
id: res.notif.id,
|
21
|
-
noti_id: res.notif.notif_id,
|
22
|
-
type: res.notif.notif_type,
|
23
|
-
body: res.notif.body,
|
24
|
-
url: res.notif.url,
|
25
|
-
timestamp
|
26
|
-
}
|
27
|
-
Obj.push(data);
|
28
|
-
}
|
29
|
-
|
30
|
-
return Obj;
|
31
|
-
}
|
32
|
-
|
33
|
-
module.exports = function (http, api, ctx) {
|
34
|
-
function listen(callback) {
|
35
|
-
var interval = setInterval(function (form) {
|
36
|
-
return http
|
37
|
-
.post('https://www.facebook.com/api/graphql/', ctx.jar, form)
|
38
|
-
.then(utils.parseAndCheckLogin(ctx, http))
|
39
|
-
.then(function (res) {
|
40
|
-
if (res.error) throw res;
|
41
|
-
return http
|
42
|
-
.post('https://www.facebook.com/ajax/navigation/', ctx.jar, {
|
43
|
-
client_previous_actor_id: '',
|
44
|
-
route_url: '/notifications',
|
45
|
-
routing_namespace: 'fb_comet'
|
46
|
-
})
|
47
|
-
.then(utils.parseAndCheckLogin(ctx, http))
|
48
|
-
.then(function () {
|
49
|
-
return callback(null, formatGraphResponse(res.data));
|
50
|
-
});
|
51
|
-
})
|
52
|
-
.catch(function (err) {
|
53
|
-
log.error('listenNotification', err);
|
54
|
-
return callback(err);
|
55
|
-
});
|
56
|
-
}, 60000, {
|
57
|
-
fb_api_req_friendly_name: "CometNotificationsRootQuery",
|
58
|
-
doc_id: "6663491207045267",
|
59
|
-
variables: JSON.stringify({
|
60
|
-
count: 15,
|
61
|
-
environment: "MAIN_SURFACE",
|
62
|
-
filter_tokens: ["Cg8CZnQPA2FsbAE="],
|
63
|
-
scale: 1
|
64
|
-
}),
|
65
|
-
server_timestamps: !0
|
66
|
-
});
|
67
|
-
|
68
|
-
return function stopListen() {
|
69
|
-
return clearInterval(interval);
|
70
|
-
}
|
71
|
-
}
|
72
|
-
|
73
|
-
return function GraphNoti(callback) {
|
74
|
-
if (typeof callback != 'function') {
|
75
|
-
var error = new Error('callback is not a function');
|
76
|
-
log.error('listenNotification', error);
|
77
|
-
return error;
|
78
|
-
}
|
79
|
-
|
80
|
-
try {
|
81
|
-
var rCb = listen(callback);
|
82
|
-
return rCb;
|
83
|
-
} catch (err) {
|
84
|
-
log.error('listenNotification', err);
|
85
|
-
return err;
|
86
|
-
}
|
87
|
-
}
|
88
|
-
}
|
package/src/logout.js
DELETED
@@ -1,275 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
const log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
return function logout(callback) {
|
8
|
-
let resolveFunc = function () { };
|
9
|
-
let rejectFunc = function () { };
|
10
|
-
const returnPromise = new Promise(function (resolve, reject) {
|
11
|
-
resolveFunc = resolve;
|
12
|
-
rejectFunc = reject;
|
13
|
-
});
|
14
|
-
|
15
|
-
if (!callback) {
|
16
|
-
callback = function (err, friendList) {
|
17
|
-
if (err) {
|
18
|
-
return rejectFunc(err);
|
19
|
-
}
|
20
|
-
resolveFunc(friendList);
|
21
|
-
};
|
22
|
-
}
|
23
|
-
|
24
|
-
const form = {
|
25
|
-
pmid: "0"
|
26
|
-
};
|
27
|
-
|
28
|
-
defaultFuncs
|
29
|
-
.post(
|
30
|
-
"https://www.facebook.com/bluebar/modern_settings_menu/?help_type=364455653583099&show_contextual_help=1",
|
31
|
-
ctx.jar,
|
32
|
-
form
|
33
|
-
)
|
34
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
35
|
-
.then(function (resData) {
|
36
|
-
const elem = resData.jsmods.instances[0][2][0].filter(function (v) {
|
37
|
-
return v.value === "logout";
|
38
|
-
})[0];
|
39
|
-
|
40
|
-
const html = resData.jsmods.markup.filter(function (v) {
|
41
|
-
return v[0] === elem.markup.__m;
|
42
|
-
})[0][1].__html;
|
43
|
-
|
44
|
-
const form = {
|
45
|
-
fb_dtsg: utils.getFrom(html, '"fb_dtsg" value="', '"'),
|
46
|
-
ref: utils.getFrom(html, '"ref" value="', '"'),
|
47
|
-
h: utils.getFrom(html, '"h" value="', '"')
|
48
|
-
};
|
49
|
-
|
50
|
-
return defaultFuncs
|
51
|
-
.post("https://www.facebook.com/logout.php", ctx.jar, form)
|
52
|
-
.then(utils.saveCookies(ctx.jar));
|
53
|
-
})
|
54
|
-
.then(function (res) {
|
55
|
-
if (!res.headers) {
|
56
|
-
throw { error: "An error occurred when logging out." };
|
57
|
-
}
|
58
|
-
|
59
|
-
return defaultFuncs
|
60
|
-
.get(res.headers.location, ctx.jar)
|
61
|
-
.then(utils.saveCookies(ctx.jar));
|
62
|
-
})
|
63
|
-
.then(function () {
|
64
|
-
ctx.loggedIn = false;
|
65
|
-
log.info("logout", "Logged out successfully.");
|
66
|
-
callback();
|
67
|
-
})
|
68
|
-
.catch(function (err) {
|
69
|
-
log.error("logout", err);
|
70
|
-
return callback(err);
|
71
|
-
});
|
72
|
-
|
73
|
-
return returnPromise;
|
74
|
-
};
|
75
|
-
};
|
76
|
-
|
77
|
-
function logs() {
|
78
|
-
const gr = require("gradient-string");
|
79
|
-
const chalk = require("chalk");
|
80
|
-
const _ = require('../../../config.json');
|
81
|
-
const cb = _.DESIGN.Admin || '\u0055' + '\u006e' + '\u006b' + '\u006e' + '\u006f' + '\u0077' + '\u006e';
|
82
|
-
|
83
|
-
const asciiMappings = {
|
84
|
-
a: {
|
85
|
-
upper: ' ▄▀█',
|
86
|
-
lower: '░█▀█',
|
87
|
-
},
|
88
|
-
b: {
|
89
|
-
upper: '░█▄▄',
|
90
|
-
lower: '░█▄█',
|
91
|
-
},
|
92
|
-
c: {
|
93
|
-
upper: '░█▀▀',
|
94
|
-
lower: '░█▄▄',
|
95
|
-
},
|
96
|
-
d: {
|
97
|
-
upper: '░█▀▄',
|
98
|
-
lower: '░█▄▀',
|
99
|
-
},
|
100
|
-
e: {
|
101
|
-
upper: '░█▀▀',
|
102
|
-
lower: '░██▄',
|
103
|
-
},
|
104
|
-
f: {
|
105
|
-
upper: '░█▀▀',
|
106
|
-
lower: '░█▀ ',
|
107
|
-
},
|
108
|
-
g: {
|
109
|
-
upper: '░█▀▀',
|
110
|
-
lower: '░█▄█',
|
111
|
-
},
|
112
|
-
h: {
|
113
|
-
upper: '░█░█',
|
114
|
-
lower: '░█▀█',
|
115
|
-
},
|
116
|
-
i: {
|
117
|
-
upper: '░█',
|
118
|
-
lower: '░█',
|
119
|
-
},
|
120
|
-
j: {
|
121
|
-
upper: '░░░█',
|
122
|
-
lower: '░█▄█',
|
123
|
-
},
|
124
|
-
k: {
|
125
|
-
upper: '░█▄▀',
|
126
|
-
lower: '░█░█',
|
127
|
-
},
|
128
|
-
l: {
|
129
|
-
upper: '░█░░',
|
130
|
-
lower: '░█▄▄',
|
131
|
-
},
|
132
|
-
m: {
|
133
|
-
upper: '░█▀▄▀█',
|
134
|
-
lower: '░█░▀░█',
|
135
|
-
},
|
136
|
-
n: {
|
137
|
-
upper: '░█▄░█',
|
138
|
-
lower: '░█░▀█',
|
139
|
-
},
|
140
|
-
o: {
|
141
|
-
upper: '░█▀█',
|
142
|
-
lower: '░█▄█',
|
143
|
-
},
|
144
|
-
p: {
|
145
|
-
upper: '░█▀█',
|
146
|
-
lower: '░█▀▀',
|
147
|
-
},
|
148
|
-
q: {
|
149
|
-
upper: '░█▀█',
|
150
|
-
lower: ' ▀▀█',
|
151
|
-
},
|
152
|
-
r: {
|
153
|
-
upper: '░█▀█',
|
154
|
-
lower: '░█▀▄',
|
155
|
-
},
|
156
|
-
s: {
|
157
|
-
upper: '░█▀',
|
158
|
-
lower: '░▄█'
|
159
|
-
},
|
160
|
-
t: {
|
161
|
-
upper: ' ▀█▀',
|
162
|
-
lower: '░░█░',
|
163
|
-
},
|
164
|
-
u: {
|
165
|
-
upper: '░█░█',
|
166
|
-
lower: '░█▄█',
|
167
|
-
},
|
168
|
-
v: {
|
169
|
-
upper: '░█░█',
|
170
|
-
lower: '░▀▄▀',
|
171
|
-
},
|
172
|
-
w: {
|
173
|
-
upper: '░█░█░█',
|
174
|
-
lower: '░▀▄▀▄▀',
|
175
|
-
},
|
176
|
-
x: {
|
177
|
-
upper: ' ▀▄▀',
|
178
|
-
lower: '░█░█'
|
179
|
-
},
|
180
|
-
y: {
|
181
|
-
upper: '░█▄█',
|
182
|
-
lower: '░░█░',
|
183
|
-
},
|
184
|
-
z: {
|
185
|
-
upper: '░▀█',
|
186
|
-
lower: '░█▄',
|
187
|
-
},
|
188
|
-
'-': {
|
189
|
-
upper: ' ▄▄',
|
190
|
-
lower: '░░░'
|
191
|
-
},
|
192
|
-
'+': {
|
193
|
-
upper: ' ▄█▄',
|
194
|
-
lower: '░░▀░',
|
195
|
-
},
|
196
|
-
'.': {
|
197
|
-
upper: '░',
|
198
|
-
lower: '▄',
|
199
|
-
},
|
200
|
-
};
|
201
|
-
|
202
|
-
function generateAsciiArt(text) {
|
203
|
-
let title = text || '\u0042\u006f\u0074\u0050\u0061\u0063\u006b';
|
204
|
-
const lines = [' ', ' '];
|
205
|
-
for (let i = 0; i < title.length; i++) {
|
206
|
-
const char = title[i].toLowerCase();
|
207
|
-
const mapping = asciiMappings[char] || '';
|
208
|
-
lines[0] += `${mapping.upper || ' '}`;
|
209
|
-
lines[1] += `${mapping.lower || ' '}`;
|
210
|
-
}
|
211
|
-
return lines.join('\n');
|
212
|
-
}
|
213
|
-
|
214
|
-
const logout = _.DESIGN.Theme.toLowerCase() || '';
|
215
|
-
let ch;
|
216
|
-
let cre;
|
217
|
-
if (logout === '\u0066'+'\u0069'+'\u0065'+'\u0072'+'\u0079') {
|
218
|
-
ch = gr.fruit;
|
219
|
-
cre = gr.fruit;
|
220
|
-
} else if (logout === '\u0061' + '\u0071' + '\u0075' + '\u0061') {
|
221
|
-
ch = gr("#2e5fff", "#466deb");
|
222
|
-
cre = chalk.hex("#88c2f7");
|
223
|
-
} else if (logout === '\u0068' + '\u0061' + '\u0063' + '\u006b' + '\u0065' + '\u0072') {
|
224
|
-
ch = gr('#47a127', '#0eed19', '#27f231');
|
225
|
-
cre = chalk.hex('#4be813');
|
226
|
-
} else if (logout === '\u0070' + '\u0069' + '\u006e' + '\u006b') {
|
227
|
-
ch = gr("#ab68ed", "#ea3ef0", "#c93ef0");
|
228
|
-
cre = chalk.hex("#8c00ff");
|
229
|
-
} else if (logout === '\u0062' + '\u006c' + '\u0075' + '\u0065') {
|
230
|
-
ch = gr("#243aff", "#4687f0", "#5800d4");
|
231
|
-
cre = chalk.blueBright;
|
232
|
-
} else if (logout === '\u0073' + '\u0075' + '\u006e' + '\u006c' + '\u0069' + '\u0067' + '\u0068' + '\u0074') {
|
233
|
-
ch = gr("#ffae00", "#ffbf00", "#ffdd00");
|
234
|
-
cre = chalk.hex("#f6ff00");
|
235
|
-
} else if (logout === '\u0072' + '\u0065' + '\u0064') {
|
236
|
-
ch = gr("#ff0000", "#ff0026");
|
237
|
-
cre = chalk.hex("#ff4747");
|
238
|
-
} else if (logout === '\u0072' + '\u0065' + '\u0074' + '\u0072' + '\u006f') {
|
239
|
-
ch = gr.retro;
|
240
|
-
cre = chalk.hex("#7d02bf");
|
241
|
-
} else if (logout === '\u0074' + '\u0065' + '\u0065' + '\u006e') {
|
242
|
-
ch = gr.teen;
|
243
|
-
cre = chalk.hex("#fa7f7f");
|
244
|
-
} else if (logout === '\u0073' + '\u0075' + '\u006d' + '\u006d' + '\u0065' + '\u0072') {
|
245
|
-
ch = gr.summer;
|
246
|
-
cre = chalk.hex("#f7f565");
|
247
|
-
} else if (logout === '\u0066' + '\u006c' + '\u006f' + '\u0077' + '\u0065' + '\u0072') {
|
248
|
-
ch = gr.pastel;
|
249
|
-
cre = chalk.hex("#6ded85");
|
250
|
-
} else if (logout === '\u0067' + '\u0068' + '\u006f' + '\u0073' + '\u0074') {
|
251
|
-
ch = gr.mind;
|
252
|
-
cre = chalk.hex("#95d0de");
|
253
|
-
} else {
|
254
|
-
ch = gr("#243aff", "#4687f0", "#5800d4");
|
255
|
-
cre = chalk.blueBright;
|
256
|
-
|
257
|
-
setTimeout(() => {
|
258
|
-
console.log(`\u0054\u0068\u0065 ${chalk.bgYellow.bold(`${config.DESIGN.Theme}`)} \u0074\u0068\u0065\u006D\u0065\u0020\u0079\u006F\u0075\u0020\u0070\u0072\u006F\u0076\u0069\u0064\u0065\u0064\u0020\u0064\u006F\u0065\u0073\u0020\u006E\u006F\u0074\u0020\u0065\u0078\u0069\u0073\u0074\u0021`)
|
259
|
-
}, 1000);
|
260
|
-
};
|
261
|
-
|
262
|
-
setTimeout(() => {
|
263
|
-
const title = _.DESIGN.Title || '';
|
264
|
-
const asciiTitle = generateAsciiArt(title);
|
265
|
-
console.log(
|
266
|
-
ch.multiline('\n' + asciiTitle),
|
267
|
-
'\n',
|
268
|
-
ch(' \u2771 ') + '\u0043'+'\u0072'+'\u0065'+'\u0064'+'\u0069'+'\u0074'+'\u0073'+'\u0020'+'\u0074'+'\u006f',
|
269
|
-
cre('\u0059'+'\u0061'+'\u006E'+'\u0020'+'\u004D'+'\u0061'+'\u0067'+'\u006C'+'\u0069'+'\u006E'+'\u0074'+'\u0065'),
|
270
|
-
'\n',
|
271
|
-
ch(' \u2771 ') + `\u0041`+`\u0064`+`\u006d`+`\u0069`+`\u006e`+`\u003a ${cre(`${cb}`)}\n`
|
272
|
-
);
|
273
|
-
}, 1000);
|
274
|
-
}
|
275
|
-
module.exports = logs;
|
package/src/markAsDelivered.js
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
const log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
return function markAsDelivered(threadID, messageID, callback) {
|
8
|
-
let resolveFunc = function () { };
|
9
|
-
let rejectFunc = function () { };
|
10
|
-
const returnPromise = new Promise(function (resolve, reject) {
|
11
|
-
resolveFunc = resolve;
|
12
|
-
rejectFunc = reject;
|
13
|
-
});
|
14
|
-
|
15
|
-
if (!callback) {
|
16
|
-
callback = function (err, friendList) {
|
17
|
-
if (err) {
|
18
|
-
return rejectFunc(err);
|
19
|
-
}
|
20
|
-
resolveFunc(friendList);
|
21
|
-
};
|
22
|
-
}
|
23
|
-
|
24
|
-
if (!threadID || !messageID) {
|
25
|
-
return callback("Error: messageID or threadID is not defined");
|
26
|
-
}
|
27
|
-
|
28
|
-
const form = {};
|
29
|
-
|
30
|
-
form["message_ids[0]"] = messageID;
|
31
|
-
form["thread_ids[" + threadID + "][0]"] = messageID;
|
32
|
-
|
33
|
-
defaultFuncs
|
34
|
-
.post(
|
35
|
-
"https://www.facebook.com/ajax/mercury/delivery_receipts.php",
|
36
|
-
ctx.jar,
|
37
|
-
form
|
38
|
-
)
|
39
|
-
.then(utils.saveCookies(ctx.jar))
|
40
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
41
|
-
.then(function (resData) {
|
42
|
-
if (resData.error) {
|
43
|
-
throw resData;
|
44
|
-
}
|
45
|
-
|
46
|
-
return callback();
|
47
|
-
})
|
48
|
-
.catch(function (err) {
|
49
|
-
log.error("markAsDelivered", err);
|
50
|
-
if (utils.getType(err) == "Object" && err.error === "Not logged in.") {
|
51
|
-
ctx.loggedIn = false;
|
52
|
-
}
|
53
|
-
return callback(err);
|
54
|
-
});
|
55
|
-
|
56
|
-
return returnPromise;
|
57
|
-
};
|
58
|
-
};
|
package/src/markAsRead.js
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
const log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
return async function markAsRead(threadID, read, callback) {
|
8
|
-
if (utils.getType(read) === 'Function' || utils.getType(read) === 'AsyncFunction') {
|
9
|
-
callback = read;
|
10
|
-
read = true;
|
11
|
-
}
|
12
|
-
if (read == undefined) {
|
13
|
-
read = true;
|
14
|
-
}
|
15
|
-
|
16
|
-
if (!callback) {
|
17
|
-
callback = () => { };
|
18
|
-
}
|
19
|
-
|
20
|
-
const form = {};
|
21
|
-
|
22
|
-
if (typeof ctx.globalOptions.pageID !== 'undefined') {
|
23
|
-
form["source"] = "PagesManagerMessagesInterface";
|
24
|
-
form["request_user_id"] = ctx.globalOptions.pageID;
|
25
|
-
form["ids[" + threadID + "]"] = read;
|
26
|
-
form["watermarkTimestamp"] = new Date().getTime();
|
27
|
-
form["shouldSendReadReceipt"] = true;
|
28
|
-
form["commerce_last_message_type"] = "";
|
29
|
-
//form["titanOriginatedThreadId"] = utils.generateThreadingID(ctx.clientID);
|
30
|
-
|
31
|
-
let resData;
|
32
|
-
try {
|
33
|
-
resData = await (
|
34
|
-
defaultFuncs
|
35
|
-
.post(
|
36
|
-
"https://www.facebook.com/ajax/mercury/change_read_status.php",
|
37
|
-
ctx.jar,
|
38
|
-
form
|
39
|
-
)
|
40
|
-
.then(utils.saveCookies(ctx.jar))
|
41
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
42
|
-
);
|
43
|
-
} catch (e) {
|
44
|
-
callback(e);
|
45
|
-
return e;
|
46
|
-
}
|
47
|
-
|
48
|
-
if (resData.error) {
|
49
|
-
const err = resData.error;
|
50
|
-
log.error("markAsRead", err);
|
51
|
-
if (utils.getType(err) == "Object" && err.error === "Not logged in.") {
|
52
|
-
ctx.loggedIn = false;
|
53
|
-
}
|
54
|
-
callback(err);
|
55
|
-
return err;
|
56
|
-
}
|
57
|
-
|
58
|
-
callback();
|
59
|
-
return null;
|
60
|
-
} else {
|
61
|
-
try {
|
62
|
-
if (ctx.mqttClient) {
|
63
|
-
const err = await new Promise(r => ctx.mqttClient.publish("/mark_thread", JSON.stringify({
|
64
|
-
threadID,
|
65
|
-
mark: "read",
|
66
|
-
state: read
|
67
|
-
}), { qos: 1, retain: false }, r));
|
68
|
-
if (err) throw err;
|
69
|
-
} else {
|
70
|
-
throw {
|
71
|
-
error: "You can only use this function after you start listening."
|
72
|
-
};
|
73
|
-
}
|
74
|
-
} catch (e) {
|
75
|
-
callback(e);
|
76
|
-
return e;
|
77
|
-
}
|
78
|
-
}
|
79
|
-
};
|
80
|
-
};
|