fca-umaruv2 40.1.10
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fca-umaruv2 might be problematic. Click here for more details.
- package/Index.js +1 -0
- package/Language/index.json +217 -0
- package/Main.js +1 -0
- package/README.md +140 -0
- package/SECURITY.md +18 -0
- package/logger.js +1 -0
- package/package.json +155 -0
- package/src/addExternalModule.js +1 -0
- package/src/addUserToGroup.js +1 -0
- package/src/changeAdminStatus.js +1 -0
- package/src/changeArchivedStatus.js +1 -0
- package/src/changeAvatar.js +1 -0
- package/src/changeBio.js +1 -0
- package/src/changeBlockedStatus.js +1 -0
- package/src/changeGroupImage.js +1 -0
- package/src/changeNickname.js +1 -0
- package/src/changeThreadColor.js +1 -0
- package/src/changeThreadEmoji.js +1 -0
- package/src/createNewGroup.js +1 -0
- package/src/createPoll.js +1 -0
- package/src/deleteMessage.js +1 -0
- package/src/deleteThread.js +1 -0
- package/src/forwardAttachment.js +1 -0
- package/src/getAccessToken.js +1 -0
- package/src/getCurrentUserID.js +1 -0
- package/src/getEmojiUrl.js +1 -0
- package/src/getFriendsList.js +1 -0
- package/src/getMessage.js +1 -0
- package/src/getThreadHistory.js +1 -0
- package/src/getThreadInfo.js +1 -0
- package/src/getThreadList.js +1 -0
- package/src/getThreadPictures.js +1 -0
- package/src/getUserID.js +1 -0
- package/src/getUserInfo.js +1 -0
- package/src/handleFriendRequest.js +1 -0
- package/src/handleMessageRequest.js +1 -0
- package/src/httpGet.js +1 -0
- package/src/httpPost.js +1 -0
- package/src/httpPostFormData.js +1 -0
- package/src/listenMqtt.js +1 -0
- package/src/logout.js +1 -0
- package/src/markAsDelivered.js +1 -0
- package/src/markAsRead.js +1 -0
- package/src/markAsReadAll.js +1 -0
- package/src/markAsSeen.js +1 -0
- package/src/muteThread.js +1 -0
- package/src/removeUserFromGroup.js +1 -0
- package/src/resolvePhotoUrl.js +1 -0
- package/src/searchForThread.js +1 -0
- package/src/sendMessage.js +1 -0
- package/src/sendTypingIndicator.js +1 -0
- package/src/setMessageReaction.js +1 -0
- package/src/setPostReaction.js +1 -0
- package/src/setTitle.js +1 -0
- package/src/threadColors.js +1 -0
- package/src/unfriend.js +1 -0
- package/src/unsendMessage.js +1 -0
- package/src/uploadAttachment.js +1 -0
- package/utils.js +1 -0
package/Index.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
global.Fca=new Object({isThread:new Array,isUser:new Array,startTime:Date.now(),Setting:new Map,Version:require("./package.json").version,Require:new Object({fs:require("fs"),log:require("npmlog"),utils:require("./utils.js"),logger:require("./logger.js"),languageFile:require("./Language/index.json")}),getText:function(...e){var a=e.splice(0,1).toString();for(let r=0;r<e.length;r++)a=a.replace(RegExp("%"+(r+1),"g"),e[r]);return a},Data:new Object({ObjFastConfig:{Language:"en",MainColor:"#33B3FF",MainName:"[ Umaru ]"},CountTime:function(){var e=global.Fca.Require.fs;if(e.existsSync(__dirname+"/CountTime.json"))try{var a=Number(e.readFileSync(__dirname+"/CountTime.json","utf8")),r=Math.floor(a/3600)}catch(a){e.writeFileSync(__dirname+"/CountTime.json",0),r=0}else r=0;return r+" Hours"}}),Action:function(e){require("npmlog").Error("Invalid Message!")}});try{let a=["MainName","PreKey","Language","AuthString","Config"];["AntiSendAppState","AutoUpdate","Uptime","BroadCast","EncryptFeature","AutoLogin","ResetDataLogin","Login2Fa","DevMode","AutoInstallNode"].concat(a,["AutoRestartMinutes","RestartMQTT_Minutes"],["HTML","Stable_Version","AntiGetInfo","Websocket_Extension"]),global.Fca.Require.fs.existsSync(process.cwd()+"/FastConfigFca.json")||(global.Fca.Require.fs.writeFileSync(process.cwd()+"/FastConfigFca.json",JSON.stringify(global.Fca.Data.ObjFastConfig,null,"\t")),process.exit(1));try{var e=require(process.cwd()+"/FastConfigFca.json")}catch(e){global.Fca.Require.logger.Error("Detect Your FastConfigFca Settings Invalid!, Carry out default restoration"),global.Fca.Require.fs.writeFileSync(process.cwd()+"/FastConfigFca.json",JSON.stringify(global.Fca.Data.ObjFastConfig,null,"\t")),process.exit(1)}if(global.Fca.Require.fs.existsSync(process.cwd()+"/FastConfigFca.json")){for(let r in e)if(a.includes(r)){if("String"==global.Fca.Require.utils.getType(e[r]))continue;logger.Error(r+" Is Not A String, Need To Be String!",(function(){process.exit(0)}))}global.Fca.Require.languageFile.some((a=>a.Language==e.Language))||(global.Fca.Require.logger.Warning("Not Support Language: "+e.Language+" Only 'en' and 'vi'"),process.exit(0)),global.Fca.Require.Language=global.Fca.Require.languageFile.find((a=>a.Language==e.Language)).Folder}else process.exit(1);global.Fca.Require.FastConfig=e}catch(e){console.log(e),global.Fca.Require.logger.Error()}module.exports=function(e,a,r){global.Fca.Require.languageFile.find((e=>e.Language==global.Fca.Require.FastConfig.Language));const n=require("./Main");return require("fs-extra"),require("npmlog"),require("child_process"),n(e,a,r)};
|
@@ -0,0 +1,217 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"Language": "vi",
|
4
|
+
"Folder": {
|
5
|
+
"Index": {
|
6
|
+
"ErrAppState": "Appstate - Cookie Của Bạn Đã Bị Lỗi, Hãy Thay Cái Mới, Hoặc Vô Trình Duyệt Ẩn Danh Rồi Đăng Nhập Và Thử Lại !",
|
7
|
+
"CheckPointLevelI": "Phát Hiện CheckPoint - Không Đăng Nhập Được, Hãy Thử Logout Rồi Login Và Lấy Lại Appstate - Cookie !",
|
8
|
+
"UID": "Đăng Nhập Tại ID: %1",
|
9
|
+
"Area": "Vùng Của Tài Khoản Là: %1",
|
10
|
+
"NoAreaData": "Không Thể Lấy Vùng Của Tài Khoản !",
|
11
|
+
"OnLogin": "Đang Đăng Nhập ...",
|
12
|
+
"InvaildAccount": "Sai Mật Khẩu Hoặc Tài Khoản !",
|
13
|
+
"TwoAuth": "Bạn Đang Bật 2 Bảo Mật !",
|
14
|
+
"InvaildTwoAuthCode": "Sai Mã Hai Bảo Mật !",
|
15
|
+
"ApprovalsErr": "Lỗi Khi Đăng Nhập Với Hai Bảo Mật !",
|
16
|
+
"VerifiedCheck": "Xác Nhận Từ Trình Duyệt, Đang Đăng Nhập...",
|
17
|
+
"ForceLoginNotEnable": "Không Thể Đăng Nhập, Hãy Thử Bật 'forceLogin' !",
|
18
|
+
"SubmitErrSuccess": "Đã Gửi Báo Cáo Lỗi Tới Server !",
|
19
|
+
"ErrorWhileSendErr": "Đã Xảy Ra Lỗi Khi Cố Gửi Lỗi Đến Server !",
|
20
|
+
"OnProcess": "Khởi Động Tiến Trình Đăng Nhập !",
|
21
|
+
"BackupNoti": "Đang Thay AppState Từ Backup, Nếu Điều Này Tiếp Tục Diễn Ra, Hãy Liên Hệ Với Fb.com/Lazic.Kanzu",
|
22
|
+
"ErrGetPassWord": "Lỗi Khi Lấy Mật Khẩu Mã Hoá AppState !",
|
23
|
+
"ErrGenerateKey": "Lỗi Khi Tạo Mật Khẩu Cho AppState !",
|
24
|
+
"UnsupportedDevice": "Hệ Điều Hành Của Bạn Hiện Không Được Hỗ Trợ !",
|
25
|
+
"NotReadyToDecrypt": "Chưa Sẵn Sàng Để Giải Hóa Appstate !",
|
26
|
+
"DecryptSuccess": "Giải Hóa Appstate Thành Công !",
|
27
|
+
"ErrBackup": "Lỗi Khi Sao Lưu AppState, Hãy Thay AppState !",
|
28
|
+
"DecryptFailed": "Giải Hóa Không Thành Công, Hãy Thử Thay AppState !",
|
29
|
+
"InvaildAppState": "Không Nhận Dạng Được AppState, Xin Vui Lòng Thay AppState !",
|
30
|
+
"YourAppStatePass": "Mật Khẩu AppState Của Bạn Là: %1",
|
31
|
+
"BackupFailed": "Sao Lưu AppState Không Thành Công !",
|
32
|
+
"ScreenShotConsoleAndSendToAdmin": "Chụp Lại Màn Hình Dòng Này Và Gửi Vô Facebook: Fb.com/Lazic.Kanzu",
|
33
|
+
"DoneLogin": "Hoàn Thành Quá Trình Đăng Nhập !",
|
34
|
+
"AutoCheckUpdateFailure": "Lỗi Khi Kiểm Tra Cập Nhật, Vui Lòng Thử Lại Sau !",
|
35
|
+
"AutoCheckUpdate": "Đang Kiểm Tra Bản Cập Nhật !",
|
36
|
+
"NewVersionFound": "Phiên Bản Mới Đã Được Cập Nhật: %1 => %2",
|
37
|
+
"AutoUpdate": "Tiến Hành Tự Động Cập Nhật Lên Phiên Bản Mới Nhất !",
|
38
|
+
"UpdateSuccess": "Nâng Cấp Phiên Bản Thành Công !",
|
39
|
+
"RestartAfterUpdate": "Đang Khởi Động Lại Để Phiên Bản Mới Có Hiệu Lực !",
|
40
|
+
"UpdateFailed": "Lỗi Khi Nâng Cấp Lên Phiên Bản Mới Nhất !",
|
41
|
+
"UseSupportToolAfterUpdateFailed": "Nâng Cấp Thức Bại, Tiến Hành Sử Dụng Công Cụ Hỗ Trợ !",
|
42
|
+
"InstallSupportTool": "Đang Tải Dụng Cụ Hộ Trợ Cho Fca !",
|
43
|
+
"NotiAfterUseToolFail": "Hãy Tự Fix Bằng Cách Nhập:",
|
44
|
+
"LocalVersion": "Phiên Bản Đang Dùng Hiện Tại Là: %1 !",
|
45
|
+
"EncryptSuccess": "Mã Hoá AppState Thành Công !",
|
46
|
+
"ProcessDone": "Kết Thúc Với: %1 !",
|
47
|
+
"CountTime": "Tổng Thời Gian Bạn Sử Dụng: %1",
|
48
|
+
"InvaildMainColor": "%1 Không Phải Là Một Màu Hex !",
|
49
|
+
"IsNotABoolean": "%1 Không Phải Là Một Boolean, Cần Là true Hoặc false !",
|
50
|
+
"InvaildOption": "%1 Không Phải Là Một Lựa Chọn !",
|
51
|
+
"EncryptStateOff": "Tính Năng EncryptState Đã Bị Tắt !",
|
52
|
+
|
53
|
+
"AutoLogin": "AutoLogin Đang Bật, Tiến Hành Đăng Nhập Lại !",
|
54
|
+
"TypeAccount": "Hãy Nhập Tài Khoản: ",
|
55
|
+
"TypePassword": "Hãy Nhập Mật Khẩu: ",
|
56
|
+
"TypeAccountError": "Tài Khoản Cần Là ID Hoặc Số Điện Thoại Hay Là Gmail !",
|
57
|
+
"ErrDataBase": "Lỗi Khi Đặt Dữ Liệu Auto Login !",
|
58
|
+
"SuccessSetData": "Đã Đặt Dữ Liệu Auto Login Thành Công !",
|
59
|
+
"Missing": "Bạn Vui Lòng Ghi Mã 2Fa Theo Hướng Dẫn Của Ảnh Trong FastConfigFca.json Dòng AuthString !",
|
60
|
+
|
61
|
+
"EnterSecurityCode": "Hãy Nhập Mã Xác Thực 2 Yếu Tố Của Bạn: ",
|
62
|
+
"ErrThroughCookies": "Đã Xảy Ra Lỗi Khi Xuyên 2Fa, Hãy Nhập Mã 2Fa Lại !",
|
63
|
+
|
64
|
+
"NodeVersionNotSupported": "Phiên Bản: %1 Không Được Hỗ Trợ, Tự Động Tải Phiên Bản Nodejs V14",
|
65
|
+
"UsingNVM": "Bạn đang sử dụng nvm để control node version, hãy bấm 'nvm install 14.17.0' sau đó bấm 'nvm use 14.17.0' để chuyển sang phiên bản được hỗ trợ !",
|
66
|
+
"DownloadingNode": "Đang tải phiên bản Node V14 Được Hỗ Trợ !",
|
67
|
+
"NodeDownloadingComplete": "Tải Phiên Bản Node V14 Thành Công !",
|
68
|
+
"RestartRequire": "Tải Thành Công, Yêu Cầu Người Dùng Restart Máy Để Có Tác Dụng!",
|
69
|
+
"ErrNodeDownload": "Đã Xảy Ra Lỗi Trong Lúc Tự Động Tải Node Phiên Bản 14, Hãy Liên Hệ Fb.com/Lazic.Kanzu!",
|
70
|
+
"RestartingN": "Đang Khởi Động Lại Chương Trình",
|
71
|
+
"Rebuilding": "Đang Rebuild Lại Package NPM tránh lỗi !",
|
72
|
+
"ErrRebuilding": "Đã Sảy Ra Lỗi Tại Khu Vực Rebuilding - npm install",
|
73
|
+
"SuccessRebuilding": "Rebuilding Thành Công !",
|
74
|
+
"UnableToConnect": "Đã Sảy Ra Lỗi Trong Lúc Kết Nối Tới Máy Chủ Instant Action, Hãy Kiểm Tra Lại Wifi!",
|
75
|
+
"EVMChange": "Đang Thay Đổi Replit.nix Để Hỗ Trợ Node V14!",
|
76
|
+
"EVMChangeSuccess": "Thay Đổi Replit.nix Thành Công, Tiến Hành Restarting!",
|
77
|
+
|
78
|
+
"Ws_TypeUserName": "Hãy Nhập Một UserName Cho Tài Khoản Websocket Extension của bạn: ",
|
79
|
+
"Ws_TypePassWord": "Hãy Nhập Một Mật Khẩu Cho Tài Khoản WebSocket Extension của bạn : ",
|
80
|
+
"Ws_Success": "Đặt Dữ Liệu Cho Websocket Extension Thành Công !",
|
81
|
+
"Ws_2Fa": "Đây là mã xác thực 2 yếu tố(2FA) của bạn cho Horizon_Extension, hãy sử dụng Google Authenticator để lấy mã phòng trường hợp quên mật khẩu hoặc yêu cầu xác minh !\n\n=> Đây: %1",
|
82
|
+
"Ws_2Fa_Check": "Hãy nhập mã 2Fa của bạn từ ứng dụng xác thực: ",
|
83
|
+
|
84
|
+
"WishMessage": [
|
85
|
+
"Chúc Bạn Một Ngày Tốt Lành Nhé !",
|
86
|
+
"Hãy Báo Cáo Với Admin Khi Có Lỗi Fca Nhé !",
|
87
|
+
"Cảm Ơn Đã Sử Dụng Fca Của Horizon !",
|
88
|
+
"Donate Tại: Momo: 0946838477"
|
89
|
+
]
|
90
|
+
},
|
91
|
+
"ExtraGetThread": {
|
92
|
+
"CreateDatabaseSuccess": "Khởi Tạo Thành Công Database Cho Nhóm: %1",
|
93
|
+
"CreateDatabaseFailure": "Khởi Tạo Thất Bại Database Của Nhóm: %1",
|
94
|
+
"alreadyUpdate": "%1 Đã Sẵn Sàng Để Update Database",
|
95
|
+
"updateDataSuccess": "Cập Nhật Dữ Liệu Cho Nhóm %1 Thành Công !",
|
96
|
+
"updateDataFailure": "Cập Nhật Dữ Liệu Cho Nhóm %1 Thất Bại !"
|
97
|
+
},
|
98
|
+
"ExtraUpTime": {
|
99
|
+
"Uptime": "Kết Nối Đến Server Uptime Thành Công !",
|
100
|
+
"PM2": "Đang Vào Chế Độ Uptime !",
|
101
|
+
"InPm2Mode": "Bạn Đang Ở Chế Độ Uptime PM2",
|
102
|
+
"NotSupport": "Không Hỗ Trợ Uptime Server!",
|
103
|
+
"Maintenance": "Server Uptime Đang Bảo Trì, Hãy Thử Lại Sau !"
|
104
|
+
},
|
105
|
+
"Src": {
|
106
|
+
"AutoRestart": "Tự Động Khởi Động Lại Sau: %1 Phút Nữa !",
|
107
|
+
"OnRestart": "Đang Restart..."
|
108
|
+
}
|
109
|
+
}
|
110
|
+
},
|
111
|
+
{
|
112
|
+
"Language": "en",
|
113
|
+
"Folder": {
|
114
|
+
"Index": {
|
115
|
+
"ErrAppState": "Appstate - Your Cookie Is Wrong, Please Replace It, Or Go To Incognito Browser Then Sign In And Try Again !",
|
116
|
+
"CheckPointLevelI": "CheckPoint Detected - Can't Login, Try Logout Then Login And Retrieve Appstate - Cookie !",
|
117
|
+
"UID": "Login as ID: %1",
|
118
|
+
"Area": "Area Of Account Is: %1",
|
119
|
+
"NoAreaData": "Can't Get Area Of Account !",
|
120
|
+
"OnLogin": "Currently logged ...",
|
121
|
+
"InvaildAccount": "Wrong Password Or Account !",
|
122
|
+
"TwoAuth": "You Currently On 2 Factor Security !",
|
123
|
+
"InvaildTwoAuthCode": "Wrong Code Two Factor Security !",
|
124
|
+
"ApprovalsErr": "Error When Login With Two Factor Security !",
|
125
|
+
"VerifiedCheck": "Confirm From Browser, Logging In...",
|
126
|
+
"ForceLoginNotEnable": "Can't Login, Try Enable 'forceLogin' !",
|
127
|
+
"SubmitErrSuccess": "Error Report Sent To Server !",
|
128
|
+
"ErrorWhileSendErr": "An error occurred while trying to send an error to the server !",
|
129
|
+
"OnProcess": "Start the Login Process !",
|
130
|
+
"BackupNoti": "Changing AppState From Backup, If This Continues, Contact Fb.com/Lazic.Kanzu",
|
131
|
+
"ErrGetPassWord": "Error Retrieving AppState Encryption Password !",
|
132
|
+
"ErrGenerateKey": "Error Creating Password For AppState !",
|
133
|
+
"UnsupportedDevice": "Your Operating System Is Currently Not Supported !",
|
134
|
+
"NotReadyToDecrypt": "Not Ready To Solve Appstate !",
|
135
|
+
"DecryptSuccess": "Successfully Appstate Solved !",
|
136
|
+
"ErrBackup": "Error When Backing Up AppState, Please Replace AppState !",
|
137
|
+
"DecryptFailed": "Solution Failed, Try Replacing AppState !",
|
138
|
+
"InvaildAppState": "AppState Not Recognized, Please Replace AppState !",
|
139
|
+
"YourAppStatePass": "Your AppState Password Is: %1",
|
140
|
+
"BackupFailed": "AppState Backup Failed !",
|
141
|
+
"ScreenShotConsoleAndSendToAdmin": "Take a Screenshot of This Line And Send It To Facebook: Fb.com/Lazic.Kanzu",
|
142
|
+
"DoneLogin": "Complete the Login Process !",
|
143
|
+
"AutoCheckUpdate": "Checking for Updates !",
|
144
|
+
"NewVersionFound": "New Version, Ready to Update: %1 => %2",
|
145
|
+
"AutoUpdate": "Perform Automatic Update to the Latest Version !",
|
146
|
+
"UpdateSuccess": "Upgrade Version Successfully !",
|
147
|
+
"RestartAfterUpdate": "Rebooting For New Version To Take Effect !",
|
148
|
+
"UpdateFailed": "Error When Upgrading To Latest Version !",
|
149
|
+
"UseSupportToolAfterUpdateFailed": "Upgrade Failed, Proceed to Using Support Tools !",
|
150
|
+
"InstallSupportTool": "Loading Support Tools For FCA !",
|
151
|
+
"NotiAfterUseToolFail": "Please Fix It Yourself By Entering:",
|
152
|
+
"LocalVersion": "You Are Currently Using Version: %1 !",
|
153
|
+
"EncryptSuccess": "Encrypt Appstate Success !",
|
154
|
+
"ProcessDone": "Process Done: %1 !",
|
155
|
+
"InvaildMainColor": "%1 Is Not A Hex Color Code !",
|
156
|
+
"IsNotABoolean": "%1 Is Not A Boolean, Need To Be true Or false !",
|
157
|
+
"EncryptStateOff": "Encryption Has Been Turned Off !",
|
158
|
+
"InvaildOption": "Invail Option: %1",
|
159
|
+
"CountTime": "Total Time You Use: %1",
|
160
|
+
|
161
|
+
"AutoLogin": "AutoLogin Is On, Proceed to Log Back in!",
|
162
|
+
"TypeAccount": "Enter Account: ",
|
163
|
+
"TypePassword": "Enter a Password: ",
|
164
|
+
"TypeAccountError": "The account needs to be an ID or Phone number or Gmail!",
|
165
|
+
"ErrDataBase": "Error When Setting Auto Login Data !",
|
166
|
+
"SuccessSetData": "Auto Login Data Set Successfully !",
|
167
|
+
"Missing": "Please Code 2Fa According to the Photo's Guide in FastConfigFca.json Series AuthString!",
|
168
|
+
"EnterSecurityCode": "Enter your 2-Factor Authentication Code: ",
|
169
|
+
"ErrThroughCookies": "2Fa Piercing Error Occurred, Enter Code 2Fa Again! ",
|
170
|
+
|
171
|
+
"NodeVersionNotSupported": "Version: %1 is not supported, automatically download nodejs version v14",
|
172
|
+
"UsingNVM": "You are using nvm to control node version, please type 'nvm install 14.17.0' then type 'nvm use 14.17.0' to switch to the supported version!",
|
173
|
+
"DownloadingNode": "Downloading node version v14 which is supported!",
|
174
|
+
"NodeDownloadingComplete": "Successfully downloaded node version v14!",
|
175
|
+
"RestartRequire": "Download successful, user needs to restart the computer to take effect!",
|
176
|
+
"ErrNodeDownload": "An error occurred while automatically downloading node version 14, please contact fb.com/lazic.kanzu!",
|
177
|
+
"RestartingN": "Restarting the program",
|
178
|
+
"Rebuilding": "Rebuilding npm package to avoid errors !",
|
179
|
+
"ErrRebuilding": "An error occurred in the rebuilding area - npm install",
|
180
|
+
"SuccessRebuilding": "Successfully rebuilt !",
|
181
|
+
"UnableToConnect": "An error occurred while connecting to the instant action server, please check your wifi connection!",
|
182
|
+
"EVMChange": "Changing replit.nix to support node v14!",
|
183
|
+
"EVMChangeSuccess": "Successfully changed replit.nix, go ahead and restart!",
|
184
|
+
|
185
|
+
"Ws_TypeUserName": "Please enter a username for your websocket extension account: ",
|
186
|
+
"Ws_TypePassWord": "Please enter a password for your websocket extension account: ",
|
187
|
+
"Ws_Success": "Successfully set data for websocket extension!",
|
188
|
+
"Ws_2Fa": "This is your two-factor authentication (2FA) code for horizon_extension. Please use Google Authenticator to retrieve the backup code in case you forget your password or require verification.\n\n=> Here: %1",
|
189
|
+
"Ws_2Fa_Check": "Please enter your 2FA code from the authentication app: ",
|
190
|
+
|
191
|
+
"WishMessage": [
|
192
|
+
"Have a Nice Day !",
|
193
|
+
"Please Report To Admin When There Is Error in FCA !",
|
194
|
+
"Thank You For Using Horizon's FCA !"
|
195
|
+
]
|
196
|
+
},
|
197
|
+
"ExtraGetThread": {
|
198
|
+
"CreateDatabaseSuccess": "Successfully Initiate Database for Group: %1",
|
199
|
+
"CreateDatabaseFailure": "Initialization of Group Database Failure: %1",
|
200
|
+
"alreadyUpdate": "%1 Ready to Update Database",
|
201
|
+
"updateDataSuccess": "Data Update for Group %1 Success!",
|
202
|
+
"updateDataFailure": "Data Update for Group %1 Failed!"
|
203
|
+
},
|
204
|
+
"ExtraUpTime": {
|
205
|
+
"Uptime": "Connecting To Server Uptime Succeeds!",
|
206
|
+
"PM2": "Trying to PM2 Mode!",
|
207
|
+
"InPm2Mode": "You Are In Uptime PM2 Mode !",
|
208
|
+
"NotSupport": "Your Operating System does not currently support Uptime Server !",
|
209
|
+
"Maintenance": "Server Uptime In Maintenance, Try Again Later!"
|
210
|
+
},
|
211
|
+
"Src": {
|
212
|
+
"AutoRestart": "Automatically Restart After: %1 Minutes !",
|
213
|
+
"OnRestart": "Restarting..."
|
214
|
+
}
|
215
|
+
}
|
216
|
+
}
|
217
|
+
]
|
package/Main.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
global;const e=global.Fca.Require.languageFile.find((e=>e.Language==global.Fca.Require.FastConfig.Language)).Folder.Index;var t=global.Fca.Require.utils,o=global.Fca.Require.logger,n=(global,global.Fca.getText),a=global.Fca.Require.log,r=(require("express")(),require("path"),require("cheerio")),i=(require("fs-extra"),require("readline")),s=(require("chalk"),require("figlet"),require("os"),require("deasync"));a.maxRecordSize=100;var c=null;const l=["online","selfListen","listenEvents","updatePresence","forceLogin","autoMarkDelivery","autoMarkRead","listenTyping","autoReconnect","emitReady"];function u(e,o){Object.keys(o).map((function(n){switch(l.includes(n)){case!0:e[n]=Boolean(o[n]);break;case!1:switch(n){case"pauseLog":o.pauseLog?a.pause():a.resume();break;case"logLevel":a.level=o.logLevel,e.logLevel=o.logLevel;break;case"logRecordSize":a.maxRecordSize=o.logRecordSize,e.logRecordSize=o.logRecordSize;break;case"pageID":e.pageID=o.pageID.toString();break;case"userAgent":e.userAgent=o.userAgent||"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36";break;case"proxy":"string"!=typeof o.proxy?(delete e.proxy,t.setProxy()):(e.proxy=o.proxy,t.setProxy(e.proxy));break;default:a.warn("setOptions","Unrecognized option given to setOptions: "+n)}}}))}function p(l,g,h,d,f,m){var v,w,k,b,F,y,S,C,A=null,T=t.getJar();try{if(l){o.Normal(e.OnProcess);try{l=JSON.parse(l)}catch(e){}try{global.Fca.Data.AppState=l,l.map((function(e){T.setCookie(e.key+"="+e.value+"; expires="+e.expires+"; domain="+e.domain+"; path="+e.path+";","http://"+e.domain)})),A=t.get("https://www.facebook.com/",T,null,d,{noRef:!0}).then(t.saveCookies(T))}catch(t){o.Warning(e.ErrBackup),process.exit(0)}}else A=t.get("https://www.facebook.com/",null,null,d,{noRef:!0}).then(t.saveCookies(T)).then((k=T,b=g,F=h,y=d,S=f,C=m,function(n){var l=n.body,u=r.load(l),g=[];u("#login_form input").map(((e,t)=>g.push({val:u(t).val(),name:u(t).attr("name")}))),g=g.filter((function(e){return e.val&&e.val.length}));var h=t.arrToForm(g);return h.lsd=t.getFrom(l,'["LSD",[],{"token":"','"}'),h.lgndim=Buffer.from('{"w":1440,"h":900,"aw":1440,"ah":834,"c":24}').toString("base64"),h.email=b,h.pass=F,h.default_persistent="0",h.locale="en_US",h.timezone="240",h.lgnjs=~~(Date.now()/1e3),l.split('"_js_').slice(1).map((e=>{k.setCookie(t.formatCookie(JSON.parse('["'+t.getFrom(e,"","]")+"]"),"facebook"),"https://www.facebook.com")})),o.Normal(e.OnLogin),t.post("https://www.facebook.com/login/device-based/regular/login/?login_attempt=1&lwv=110",k,h,y).then(t.saveCookies(k)).then((function(n){var l=n.headers;if(!l.location)throw{error:e.InvaildAccount};if(l.location.indexOf("https://www.facebook.com/checkpoint/")>-1){o.Warning(e.TwoAuth);var u="https://www.facebook.com/checkpoint/?next=https%3A%2F%2Fwww.facebook.com%2Fhome.php";return t.get(l.location,k,null,y).then(t.saveCookies(k)).then((function(n){var l=n.body,g=r.load(l),h=[];g("form input").map(((e,t)=>h.push({val:g(t).val(),name:g(t).attr("name")}))),h=h.filter((e=>e.val&&e.val.length));var d=t.arrToForm(h);if(!(l.indexOf("checkpoint/?next")>-1)){if(!y.forceLogin)throw{error:e.ForceLoginNotEnable};return l.indexOf("Suspicious Login Attempt")>-1?d["submit[This was me]"]="This was me":d["submit[This Is Okay]"]="This Is Okay",t.post(u,k,d,y).then(t.saveCookies(k)).then((function(){return d.name_action_selected="dont_save",t.post(u,k,d,y).then(t.saveCookies(k))})).then((function(e){if(!e.headers.location&&e.body.indexOf("Review Recent Login")>-1)throw{error:"Something went wrong with review recent login."};return p(t.getAppState(k,!1),b,F,y,S)})).catch((e=>S(e)))}switch(setTimeout((()=>{c=setInterval((e=>{}),5e3,{fb_dtsg:d.fb_dtsg,jazoest:d.jazoest,dpr:1})}),2500),global.Fca.Require.FastConfig.Login2Fa){case!0:{const n=e=>{const t=i.createInterface({input:process.stdin,output:process.stdout});var o,n;return t.question(e,(e=>{t.close(),n=e,o=!0})),s.loopWhile((function(){return!o})),n},l=require("totp-generator"),h=0==global.Fca.Require.FastConfig.AuthString.includes("|")?l(global.Fca.Require.FastConfig.AuthString.includes(" ")?global.Fca.Require.FastConfig.AuthString.replace(RegExp(" ","g"),""):global.Fca.Require.FastConfig.AuthString):n(e.EnterSecurityCode);try{const i=function(s){var l,h;d.approvals_code=s,d["submit[Continue]"]=g("#checkpointSubmitButton").html();var f=new Promise(((e,t)=>{l=e,h=t}));return"string"==typeof s?t.post(u,k,d,y).then(t.saveCookies(k)).then((function(t){r.load(t.body)("#approvals_code").parent().attr("data-xui-error")&&o.Warning(e.InvaildTwoAuthCode,(function(){i(n(e.EnterSecurityCode))}))})).then((function(){return delete d.no_fido,delete d.approvals_code,d.name_action_selected="save_device",t.post(u,k,d,y).then(t.saveCookies(k))})).then((function(e){if(!e.headers.location&&e.headers["set-cookie"][0].includes("checkpoint"))try{return delete d.name_action_selected,d["submit[Continue]"]=g("#checkpointSubmitButton").html(),t.post(u,k,d,y).then(t.saveCookies(k)).then((function(){return d["submit[This was me]"]="This was me",t.post(u,k,d,y).then(t.saveCookies(k))})).then((function(){return delete d["submit[This was me]"],d.name_action_selected="save_device",d["submit[Continue]"]=g("#checkpointSubmitButton").html(),t.post(u,k,d,y).then(t.saveCookies(k))})).then((function(e){if(!e.headers.location&&e.headers["set-cookie"][0].includes("checkpoint"))throw{error:"wtf ??:D"};return p(t.getAppState(k,!1),b,F,y,S)})).catch((e=>S(e)))}catch(e){console.log(e)}var o=t.getAppState(k,!1);return S===C&&(S=function(e,t){return e?h(e):l(t)}),p(o,b,F,y,S)})).catch((function(e){S===C?h(e):S(e)})):t.post("https://www.facebook.com/checkpoint/?next=https%3A%2F%2Fwww.facebook.com%2Fhome.php",k,d,y,null,{Referer:"https://www.facebook.com/checkpoint/?next"}).then(t.saveCookies(k)).then((function(n){try{JSON.parse(n.body.replace(/for\s*\(\s*;\s*;\s*\)\s*;\s*/,""))}catch(n){return clearInterval(c),o.Warning(e.VerifiedCheck),S===C&&(S=function(e,t){return e?h(e):l(t)}),p(t.getAppState(k,!1),b,F,y,S)}})).catch((e=>{a.error("login",e),S===C?h(e):S(e)})),f};return i(h)}catch(e){o.Error(e),o.Error(),process.exit(0)}}case!1:throw{error:"login-approval",continue:function n(i){var s,l;d.approvals_code=i,d["submit[Continue]"]=g("#checkpointSubmitButton").html();var h=new Promise(((e,t)=>{s=e,l=t}));return"string"==typeof i?t.post(u,k,d,y).then(t.saveCookies(k)).then((function(t){var o=r.load(t.body)("#approvals_code").parent().attr("data-xui-error");if(o)throw{error:"login-approval",errordesc:e.InvaildTwoAuthCode,lerror:o,continue:n}})).then((function(){return delete d.no_fido,delete d.approvals_code,d.name_action_selected="dont_save",t.post(u,k,d,y).then(t.saveCookies(k))})).then((function(o){if(!o.headers.location&&o.headers["set-cookie"][0].includes("checkpoint"))throw{error:e.ApprovalsErr};var n=t.getAppState(k,!1);return S===C&&(S=function(e,t){return e?l(e):s(t)}),p(n,b,F,y,S)})).catch((function(e){S===C?l(e):S(e)})):t.post("https://www.facebook.com/checkpoint/?next=https%3A%2F%2Fwww.facebook.com%2Fhome.php",k,d,y,null,{Referer:"https://www.facebook.com/checkpoint/?next"}).then(t.saveCookies(k)).then((n=>{try{JSON.parse(n.body.replace(/for\s*\(\s*;\s*;\s*\)\s*;\s*/,""))}catch(n){return clearInterval(c),o.Warning(e.VerifiedCheck),S===C&&(S=function(e,t){return e?l(e):s(t)}),p(t.getAppState(k,!1),b,F,y,S)}})).catch((e=>{a.error("login",e),S===C?l(e):S(e)})),h}}}}))}return t.get("https://www.facebook.com/",k,null,y).then(t.saveCookies(k))}))})).then((function(){return t.get("https://www.facebook.com/",T,null,d).then(t.saveCookies(T))}))}catch(k){console.log(k)}A=A.then((function(e){var o=/<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/.exec(e.body);return o&&o[1]?t.get(o[1],T,null,d).then(t.saveCookies(T)):e})).then((function(r){var i=function(r,i,s){var l=s.getCookies("https://www.facebook.com").filter((function(e){return"c_user"===e.cookieString().split("=")[0]}));if(0!==l.length){i.indexOf("/checkpoint/block/?next")>-1&&a.warn("login",e.CheckPointLevelI);var p=l[0].cookieString().split("=")[1].toString();process.env.UID=o.Normal(n(e.UID,p),p);try{clearInterval(c)}catch(e){console.log(e)}var g=(2147483648*Math.random()|0).toString(16),h={oldFBMQTTMatch:i.match(/irisSeqID:"(.+?)",appID:219994525426954,endpoint:"(.+?)"/),newFBMQTTMatch:i.match(/{"app_id":"219994525426954","endpoint":"(.+?)","iris_seq_id":"(.+?)"}/),legacyFBMQTTMatch:i.match(/(\["MqttWebConfig",\[\],{fbid:")(.+?)(",appID:219994525426954,endpoint:")(.+?)(",pollingEndpoint:")(.+?)(3790])/)};let b=Object.keys(h);var d,f,m;Object.keys(h).map((function(e){if(!h[e]||f);else switch(b.indexOf(e)){case 0:return m=h[e][1],d=h[e][2],void(f=new URL(d).searchParams.get("region").toUpperCase());case 1:return m=h[e][2],d=h[e][1].replace(/\\\//g,"/"),void(f=new URL(d).searchParams.get("region").toUpperCase());case 2:return d=h[e][4],void(f=new URL(d).searchParams.get("region").toUpperCase())}}));var v={userID:p,jar:s,clientID:g,globalOptions:r,loggedIn:!0,access_token:"NONE",clientMutationId:0,mqttClient:void 0,lastSeqId:m,syncToken:void 0,mqttEndpoint:d,region:f,firstListen:!0},w={setOptions:u.bind(null,r),getAppState:function(){return t.getAppState(s)}};f&&d||(a.warn("login",n(e.NoAreaData)),w.htmlData=i);const F=["addExternalModule","addUserToGroup","changeAdminStatus","changeArchivedStatus","changeAvatar","changeBio","changeBlockedStatus","changeGroupImage","changeNickname","changeThreadColor","changeThreadEmoji","createNewGroup","createPoll","deleteMessage","deleteThread","forwardAttachment","getCurrentUserID","getEmojiUrl","getFriendsList","getMessage","getThreadHistory","getThreadInfo","getThreadList","getThreadPictures","getUserID","getUserInfo","handleMessageRequest","listenMqtt","logout","markAsDelivered","markAsRead","markAsReadAll","markAsSeen","muteThread","removeUserFromGroup","resolvePhotoUrl","searchForThread","sendMessage","sendTypingIndicator","setMessageReaction","setPostReaction","setTitle","threadColors","unsendMessage","httpGet","httpPost","httpPostFormData"];var k=t.makeDefaults(i,p,v);return F.map((function(e){w[e]=require("./src/"+e)(k,w,v)})),w.listen=w.listenMqtt,{ctx:v,defaultFuncs:k,api:w}}return global.Fca.Require.FastConfig.AutoLogin?global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.AutoLogin,(function(){global.Fca.Action("AutoLogin")})):global.Fca.Require.FastConfig.AutoLogin?void 0:global.Fca.Require.logger.Error(global.Fca.Require.Language.Index.ErrAppState)}(d,r.body,T);return v=i.ctx,w=i.api,process.env.api=i.api,r})),d.pageID&&(A=A.then((function(){return t.get("https://www.facebook.com/"+v.globalOptions.pageID+"/messages/?section=messages&subsection=inbox",v.jar,null,d)})).then((function(e){var o=t.getFrom(e.body,'window.location.replace("https:\\/\\/www.facebook.com\\','");').split("\\").join("");return o=o.substring(0,o.length-1),t.get("https://www.facebook.com"+o,v.jar,null,d)}))),A.then((async()=>{o.Normal(n(e.LocalVersion,global.Fca.Version)),o.Normal(n(e.CountTime,global.Fca.Data.CountTime())),o.Normal(e.WishMessage[Math.floor(Math.random()*e.WishMessage.length)]),f(null,w)})).catch((function(e){a.error("login",e.error||e),f(e)}))}module.exports=function(e,o,n){"Function"!==t.getType(o)&&"AsyncFunction"!==t.getType(o)||(n=o,o={});var a={selfListen:!1,listenEvents:!0,listenTyping:!1,updatePresence:!1,forceLogin:!1,autoMarkDelivery:!1,autoMarkRead:!1,autoReconnect:!0,logRecordSize:100,online:!1,emitReady:!1,userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"},r=null;if("Function"!==t.getType(n)&&"AsyncFunction"!==t.getType(n)){var i=null,s=null,c=new Promise((function(e,t){s=e,i=t}));n=r=function(e,t){return e?i(e):s(t)}}if(e.email&&e.password)u(a,{logLevel:"silent",forceLogin:!0,userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36"}),p(e.appState,e.email,e.password,a,n,r);else if(e.appState)return u(a,o),p(e.appState,e.email,e.password,a,n,r);return c};
|
package/README.md
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
[![Socket Badge](https://socket.dev/api/badge/npm/package/fca-umaruv2)](https://socket.dev/npm/package/fca-umaruv2)
|
2
|
+
|
3
|
+
## Important !
|
4
|
+
|
5
|
+
This package require NodeJS 14.17.0 to work properly.
|
6
|
+
|
7
|
+
## Notification !
|
8
|
+
|
9
|
+
+ We will have Example Video on Channel "Nguyễn Thái Hảo Official"
|
10
|
+
|
11
|
+
Original Project(Deprecated): https://github.com/Schmavery/facebook-chat-api
|
12
|
+
|
13
|
+
Chúc các bạn một ngày tốt lành!, cảm ơn vì đã sài Sản phẩm của HZI, thân ái
|
14
|
+
|
15
|
+
KANZUWAKAZAKI(15/04/2023)
|
16
|
+
|
17
|
+
## Support For :
|
18
|
+
|
19
|
+
+ Support English, VietNamese !,
|
20
|
+
+ All bot if using listenMqtt first.
|
21
|
+
|
22
|
+
# Api Cho ChatBot Messenger
|
23
|
+
|
24
|
+
Facebook Đã Có Và Cho Người Dùng Tạo Api Cho Chatbots 😪 Tại Đey => [Đây Nè](https://developers.facebook.com/docs/messenger-platform).
|
25
|
+
|
26
|
+
### Api Này Có Thể Khiến Cho Bạn Payy Acc Như Cách Acc Bạn Chưa Từng Có, Hãy Chú Ý Nhé =))
|
27
|
+
|
28
|
+
Lưu Ý ! Nếu Bạn Muốn Sài Api Này Hãy Xem Document Tại [Đây Nè](https://github.com/Schmavery/facebook-chat-api).
|
29
|
+
|
30
|
+
## Tải Về
|
31
|
+
|
32
|
+
Nếu Bạn Muốn Sử Dụng, Hãy Tải Nó Bằng Cách:
|
33
|
+
```bash
|
34
|
+
npm i fca-umaruv2
|
35
|
+
```
|
36
|
+
or
|
37
|
+
```bash
|
38
|
+
npm install fca-umaruv2
|
39
|
+
```
|
40
|
+
|
41
|
+
Nó Sẽ Tải Vô node_modules (Lib Của Bạn) - Lưu Ý Replit Sẽ Không Hiện Đâu Mà Tìm 😪
|
42
|
+
|
43
|
+
### Tải Bản Mới Nhất Hoặc Update
|
44
|
+
|
45
|
+
Nếu Bạn Muốn Sử Dụng Phiên Bản Mới Nhất Hay Cập Nhật Thì Hãy Vô Terminal Hoặc Command Promt Nhập :
|
46
|
+
```bash
|
47
|
+
npm install fca-umaruv2@latest
|
48
|
+
```
|
49
|
+
Hoặc
|
50
|
+
```bash
|
51
|
+
npm i fca-umaruv2@latest
|
52
|
+
```
|
53
|
+
|
54
|
+
## Nếu Bạn Muốn Test Api
|
55
|
+
|
56
|
+
Lợi Ích Cho Việc Này Thì Bạn Sẽ Không Tốn Thời Gian Pay Acc Và Có Acc 😪
|
57
|
+
Hãy Sử Dụng Với Tài Khoản Thử Nghiệm => [Facebook Whitehat Accounts](https://www.facebook.com/whitehat/accounts/).
|
58
|
+
|
59
|
+
## Cách Sử Dụng
|
60
|
+
|
61
|
+
```javascript
|
62
|
+
const login = require("fca-umaruv2"); // lấy từ lib ra
|
63
|
+
|
64
|
+
// đăng nhập
|
65
|
+
login({email: "Gmail Account", password: "Mật Khẩu Facebook Của Bạn"}, (err, api) => {
|
66
|
+
|
67
|
+
if(err) return console.error(err); // trường hợp lỗi
|
68
|
+
|
69
|
+
// tạo bot tự động nhái theo bạn:
|
70
|
+
api.listenMqtt((err, message) => {
|
71
|
+
api.sendMessage(message.body, message.threadID);
|
72
|
+
});
|
73
|
+
|
74
|
+
});
|
75
|
+
```
|
76
|
+
|
77
|
+
Kết Quả Là Nó Sẽ Nhái Bạn Như Hình Dưới:
|
78
|
+
<img width="517" alt="screen shot 2016-11-04 at 14 36 00" src="https://cloud.githubusercontent.com/assets/4534692/20023545/f8c24130-a29d-11e6-9ef7-47568bdbc1f2.png">
|
79
|
+
|
80
|
+
Nếu Bạn Muốn Sử Dụng Nâng Cao Thì Hãy Sử Dụng Các Loại Bot Được Liệt Kê Ở Trên !
|
81
|
+
|
82
|
+
## Danh Sách
|
83
|
+
|
84
|
+
Bạn Có Thể Đọc Full Api Tại => [here](DOCS.md).
|
85
|
+
|
86
|
+
## Cài Đặt Cho Mirai:
|
87
|
+
|
88
|
+
Bạn Cần Vô File Mirai.js,Sau Đó Tìm Đến Dòng
|
89
|
+
```js
|
90
|
+
var login = require('tùy bot');
|
91
|
+
/* Có thể là :
|
92
|
+
var login = require('@maihuybao/fca-Unofficial');
|
93
|
+
var login = require('fca-xuyen-get');
|
94
|
+
var login = require('fca-unofficial-force');
|
95
|
+
...
|
96
|
+
*/
|
97
|
+
```
|
98
|
+
|
99
|
+
Và Thay Nó Bằng:
|
100
|
+
|
101
|
+
```js
|
102
|
+
var login = require('fca-umaruv2')
|
103
|
+
```
|
104
|
+
|
105
|
+
Sau Đó Thì Chạy Bình Thường Thôi !
|
106
|
+
|
107
|
+
## Tự Nghiên Cứu
|
108
|
+
|
109
|
+
Nếu Bạn Muốn Tự Nghiên Cứu Hoặc Tạo Bot Cho Riêng Bạn Thì Bạn Hãy Vô Cái Này Đọc Chức Năng Của Nó Và Cách Sử Dụng => [Link](https://github.com/Schmavery/facebook-chat-api#Unofficial%20Facebook%20Chat%20API)
|
110
|
+
|
111
|
+
------------------------------------
|
112
|
+
|
113
|
+
### Lưu Lại Thông Tin Đăng Nhập.
|
114
|
+
|
115
|
+
Để Lưu Lại Thì Bạn Cần 1 Apstate Kiểu (Cookie, etc,..) Để Lưu Lại Hoặc Là Sử Dụng Mã Login Như Trên Để Đăng Nhập !
|
116
|
+
|
117
|
+
Và Chế Độ Này Đã Có Sẵn Trong 1 Số Bot Việt Nam Nên Bạn Cứ Yên Tâm Nhé !
|
118
|
+
|
119
|
+
__Hướng Dẫn Với Appstate__
|
120
|
+
|
121
|
+
```js
|
122
|
+
const fs = require("fs");
|
123
|
+
const login = require("fca-umaruv2");
|
124
|
+
|
125
|
+
var credentials = {email: "FB_EMAIL", password: "FB_PASSWORD"}; // thông tin tk
|
126
|
+
|
127
|
+
login(credentials, (err, api) => {
|
128
|
+
if(err) return console.error(err);
|
129
|
+
// đăng nhập
|
130
|
+
fs.writeFileSync('appstate.json', JSON.stringify(api.getAppState(), null,'\t')); //tạo appstate
|
131
|
+
});
|
132
|
+
```
|
133
|
+
|
134
|
+
Hoặc Dễ Dàng Hơn ( Chuyên Nghiệp ) Bạn Có Thể Dùng => [c3c-fbstate](https://github.com/c3cbot/c3c-fbstate) Để Lấy Fbstate And Rename Lại Thành Apstate Cũng Được ! (appstate.json)
|
135
|
+
|
136
|
+
------------------------------------
|
137
|
+
|
138
|
+
## FAQS
|
139
|
+
|
140
|
+
FAQS => [Link](https://github.com/Schmavery/facebook-chat-api#FAQS)
|
package/SECURITY.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Security Policy
|
2
|
+
|
3
|
+
+ if have any Vulnerability finded contact: Author(KanzuWakazaki.Main@proton.me) or (Facebook.com/Lazic.Kanzu). Thanks!
|
4
|
+
|
5
|
+
## Supported Versions
|
6
|
+
|
7
|
+
Use this section to tell people about which versions of your project are
|
8
|
+
currently being supported with security updates.
|
9
|
+
|
10
|
+
| Version | Supported |
|
11
|
+
| ------- | ------------------ |
|
12
|
+
| StableVersion | :white_check_mark: |
|
13
|
+
| AutoUpdate | :white_check_mark:|
|
14
|
+
| Modified | :x:
|
15
|
+
|
16
|
+
## Reporting a Vulnerability
|
17
|
+
|
18
|
+
Contact Author or create pull!
|
package/logger.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
const n=require("chalk");var o=require("is-hexcolor");function e(n){return Object.prototype.toString.call(n).slice(8,-1)}module.exports={Normal:function(i,a,l){return 1!=o(global.Fca.Require.FastConfig.MainColor)?this.Warning(function(...n){var o=n.splice(0,1).toString();for(let e=0;e<n.length;e++)o=o.replace(RegExp("%"+(e+1),"g"),n[e]);return o}(global.Fca.Require.Language.Index.InvaildMainColor,global.Fca.Require.FastConfig.MainColor),process.exit(0)):console.log(n.hex(global.Fca.Require.FastConfig.MainColor).bold((global.Fca.Require.FastConfig.MainName||"[ FCA-HZI ]")+" > ")+i),"Function"==e(a)||"AsyncFunction"==e(a)?a():a||("Function"!=e(l)&&"AsyncFunction"!=e(l)?l:void l())},Warning:function(o,i){if(console.log(n.magenta.bold("[ FCA-WARNING ] > ")+n.yellow(o)),"Function"!=e(i)&&"AsyncFunction"!=e(i))return i;i()},Error:function(o,i){if(o||console.log(n.magenta.bold("[ FCA-ERROR ] > ")+n.red("Already Faulty, Please Contact: Facebook.com/Lazic.Kanzu")),console.log(n.magenta.bold("[ FCA-ERROR ] > ")+n.red(o)),"Function"!=e(i)&&"AsyncFunction"!=e(i))return i;i()},Success:function(o,i){if(console.log(n.hex("#9900FF").bold((global.Fca.Require.FastConfig.MainName||"[ FCA-HZI ]")+" > ")+n.green(o)),"Function"!=e(i)&&"AsyncFunction"!=e(i))return i;i()},Info:function(o,i){if(console.log(n.hex("#9900FF").bold((global.Fca.Require.FastConfig.MainName||"[ FCA-HZI ]")+" > ")+n.blue(o)),"Function"!=e(i)&&"AsyncFunction"!=e(i))return i;i()}};
|
package/package.json
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
{
|
2
|
+
"_from": "fca-umaruv2",
|
3
|
+
"_inBundle": false,
|
4
|
+
"_integrity": "sha512-l43kN/J5GH/8/oM6dQ8oNcg/l9S7fNodu2b9o/hQw3FlwarUU2Jo6v8q5kehuWgPoA4Jj1B5rtGzXuRV1uQasg==",
|
5
|
+
"_location": "/fca-umaruv2",
|
6
|
+
"_phantomChildren": {
|
7
|
+
"abort-controller": "3.0.0",
|
8
|
+
"accepts": "1.3.8",
|
9
|
+
"are-we-there-yet": "4.0.0",
|
10
|
+
"array-flatten": "1.1.1",
|
11
|
+
"aws-sign2": "0.7.0",
|
12
|
+
"aws4": "1.11.0",
|
13
|
+
"base64-js": "1.5.1",
|
14
|
+
"body-parser": "1.20.1",
|
15
|
+
"caseless": "0.12.0",
|
16
|
+
"cheerio-select": "2.1.0",
|
17
|
+
"combined-stream": "1.0.8",
|
18
|
+
"console-control-strings": "1.1.0",
|
19
|
+
"content-disposition": "0.5.4",
|
20
|
+
"content-type": "1.0.4",
|
21
|
+
"cookie": "0.5.0",
|
22
|
+
"cookie-signature": "1.0.6",
|
23
|
+
"depd": "2.0.0",
|
24
|
+
"encodeurl": "1.0.2",
|
25
|
+
"escape-html": "1.0.3",
|
26
|
+
"etag": "1.8.1",
|
27
|
+
"events": "3.3.0",
|
28
|
+
"extend": "3.0.2",
|
29
|
+
"finalhandler": "1.2.0",
|
30
|
+
"forever-agent": "0.6.1",
|
31
|
+
"form-data": "2.3.3",
|
32
|
+
"fresh": "0.5.2",
|
33
|
+
"gauge": "5.0.0",
|
34
|
+
"har-validator": "5.1.5",
|
35
|
+
"http-errors": "2.0.0",
|
36
|
+
"http-signature": "1.2.0",
|
37
|
+
"ieee754": "1.2.1",
|
38
|
+
"is-typedarray": "1.0.0",
|
39
|
+
"isstream": "0.1.2",
|
40
|
+
"json-stringify-safe": "5.0.1",
|
41
|
+
"jssha": "3.2.0",
|
42
|
+
"merge-descriptors": "1.0.1",
|
43
|
+
"methods": "1.1.2",
|
44
|
+
"mime-types": "2.1.35",
|
45
|
+
"oauth-sign": "0.9.0",
|
46
|
+
"on-finished": "2.4.1",
|
47
|
+
"parse5": "7.1.2",
|
48
|
+
"parse5-htmlparser2-tree-adapter": "7.0.0",
|
49
|
+
"parseurl": "1.3.3",
|
50
|
+
"path-to-regexp": "0.1.7",
|
51
|
+
"performance-now": "2.1.0",
|
52
|
+
"process": "0.11.10",
|
53
|
+
"proxy-addr": "2.0.7",
|
54
|
+
"psl": "1.8.0",
|
55
|
+
"punycode": "2.1.1",
|
56
|
+
"range-parser": "1.2.1",
|
57
|
+
"safe-buffer": "5.2.1",
|
58
|
+
"send": "0.18.0",
|
59
|
+
"serve-static": "1.15.0",
|
60
|
+
"set-blocking": "2.0.0",
|
61
|
+
"setprototypeof": "1.2.0",
|
62
|
+
"side-channel": "1.0.4",
|
63
|
+
"statuses": "2.0.1",
|
64
|
+
"tunnel-agent": "0.6.0",
|
65
|
+
"type-is": "1.6.18",
|
66
|
+
"url-parse": "1.5.10",
|
67
|
+
"utils-merge": "1.0.1",
|
68
|
+
"vary": "1.1.2"
|
69
|
+
},
|
70
|
+
"_requested": {
|
71
|
+
"type": "tag",
|
72
|
+
"registry": true,
|
73
|
+
"raw": "fca-umaruv2",
|
74
|
+
"name": "fca-umaruv2",
|
75
|
+
"escapedName": "fca-umaruv2",
|
76
|
+
"rawSpec": "",
|
77
|
+
"saveSpec": null,
|
78
|
+
"fetchSpec": "latest"
|
79
|
+
},
|
80
|
+
"_requiredBy": [
|
81
|
+
"#USER",
|
82
|
+
"/"
|
83
|
+
],
|
84
|
+
"author": {
|
85
|
+
"name": "Avery, David, Maude, Benjamin, UIRI, KanzuWakazakim John Lester"
|
86
|
+
},
|
87
|
+
"bundleDependencies": [],
|
88
|
+
"dependencies": {
|
89
|
+
"bluebird": "^3.7.2",
|
90
|
+
"cheerio": "^1.0.0-rc.12",
|
91
|
+
"deasync": "^0.1.29",
|
92
|
+
"figlet": "^1.7.0",
|
93
|
+
"https-proxy-agent": "^7.0.2",
|
94
|
+
"is-hexcolor": "^1.0.0",
|
95
|
+
"mqtt": "^4.3.7",
|
96
|
+
"npmlog": "^1.2.0",
|
97
|
+
"pretty-ms": "^7.0.1",
|
98
|
+
"request": "^2.88.2",
|
99
|
+
"totp-generator": "^0.0.14",
|
100
|
+
"websocket-stream": "^5.5.2",
|
101
|
+
"chalk": "^4.1.2"
|
102
|
+
},
|
103
|
+
"deprecated": false,
|
104
|
+
"description": "Facebook-chat-api protect and deploy by Kanzu, HZI Team and John Lester",
|
105
|
+
"devDependencies": {
|
106
|
+
"eslint": "^8.40.0",
|
107
|
+
"mocha": "latest",
|
108
|
+
"prettier": "latest"
|
109
|
+
},
|
110
|
+
"engines": {
|
111
|
+
"node": ">=14.x"
|
112
|
+
},
|
113
|
+
"eslintConfig": {
|
114
|
+
"env": {
|
115
|
+
"es6": true,
|
116
|
+
"node": true
|
117
|
+
},
|
118
|
+
"extends": "eslint:recommended",
|
119
|
+
"parserOptions": {
|
120
|
+
"sourceType": "module"
|
121
|
+
},
|
122
|
+
"rules": {
|
123
|
+
"linebreak-style": [
|
124
|
+
"error",
|
125
|
+
"unix"
|
126
|
+
],
|
127
|
+
"semi": [
|
128
|
+
"error",
|
129
|
+
"always"
|
130
|
+
],
|
131
|
+
"no-unused-vars": [
|
132
|
+
1,
|
133
|
+
{
|
134
|
+
"argsIgnorePattern": "^_"
|
135
|
+
}
|
136
|
+
]
|
137
|
+
}
|
138
|
+
},
|
139
|
+
"keywords": [
|
140
|
+
"Fca umaru",
|
141
|
+
"fca-umaruv2",
|
142
|
+
"umaru fca",
|
143
|
+
"umaru"
|
144
|
+
],
|
145
|
+
"license": "MIT",
|
146
|
+
"main": "Index.js",
|
147
|
+
"name": "fca-umaruv2",
|
148
|
+
"scripts": {
|
149
|
+
"lint": "eslint *.js",
|
150
|
+
"prettier": "prettier utils.js src/* --write",
|
151
|
+
"test": "mocha"
|
152
|
+
},
|
153
|
+
"version": "40.1.10",
|
154
|
+
"compiled": true
|
155
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils");module.exports=function(t,n,o){return function(r){if("Object"!=e.getType(r))throw new Error("moduleObj must be an object, not "+e.getType(r)+"!");for(const u in r){if("Function"!=e.getType(r[u]))throw new Error('Item "'+u+'" in moduleObj must be a function, not '+e.getType(r[u])+"!");n[u]=r[u](t,n,o)}}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),t=require("npmlog");module.exports=function(r,n,o){return function(n,i,a){let s=function(){},u=function(){};const d=new Promise((function(e,t){s=e,u=t}));if(!a&&("Function"===e.getType(i)||"AsyncFunction"===e.getType(i)))throw{error:"please pass a threadID as a second argument."};if(a||(a=function(e){if(e)return u(e);s()}),"Number"!==e.getType(i)&&"String"!==e.getType(i))throw{error:"ThreadID should be of type Number or String and not "+e.getType(i)+"."};"Array"!==e.getType(n)&&(n=[n]);const c=e.generateOfflineThreadingID(),g={client:"mercury",action_type:"ma-type:log-message",author:"fbid:"+o.userID,thread_id:"",timestamp:Date.now(),timestamp_absolute:"Today",timestamp_relative:e.generateTimestampRelative(),timestamp_time_passed:"0",is_unread:!1,is_cleared:!1,is_forward:!1,is_filtered_content:!1,is_filtered_content_bh:!1,is_filtered_content_account:!1,is_spoof_warning:!1,source:"source:chat:web","source_tags[0]":"source:chat",log_message_type:"log:subscribe",status:"0",offline_threading_id:c,message_id:c,threading_id:e.generateThreadingID(o.clientID),manual_retry_cnt:"0",thread_fbid:i};for(let t=0;t<n.length;t++){if("Number"!==e.getType(n[t])&&"String"!==e.getType(n[t]))throw{error:"Elements of userID should be of type Number or String and not "+e.getType(n[t])+"."};g["log_message_data[added_participants]["+t+"]"]="fbid:"+n[t]}return r.post("https://www.facebook.com/messaging/send/",o.jar,g).then(e.parseAndCheckLogin(o,r)).then((function(e){if(!e)throw{error:"Add to group failed."};if(e.error)throw e;return a()})).catch((function(e){return t.error("addUserToGroup",e),a(e)})),d}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const t=require("../utils"),n=require("npmlog");module.exports=function(r,e,o){return function(e,a,i,s){if("String"!==t.getType(e))throw{error:"changeAdminStatus: threadID must be a string"};if("String"===t.getType(a)&&(a=[a]),"Array"!==t.getType(a))throw{error:"changeAdminStatus: adminIDs must be an array or string"};if("Boolean"!==t.getType(i))throw{error:"changeAdminStatus: adminStatus must be a string"};let u=function(){},c=function(){};const d=new Promise((function(t,n){u=t,c=n}));if(s||(s=function(t){if(t)return c(t);u()}),"Function"!==t.getType(s)&&"AsyncFunction"!==t.getType(s))throw{error:"changeAdminStatus: callback is not a function"};const h={thread_fbid:e};let g=0;for(const t of a)h["admin_ids["+g+++"]"]=t;return h.add=i,r.post("https://www.facebook.com/messaging/save_admins/?dpr=1",o.jar,h).then(t.parseAndCheckLogin(o,r)).then((function(t){if(t.error)switch(t.error){case 1976004:throw{error:"Cannot alter admin status: you are not an admin.",rawResponse:t};case 1357031:throw{error:"Cannot alter admin status: this thread is not a group chat.",rawResponse:t};default:throw{error:"Cannot alter admin status: unknown error.",rawResponse:t}}s()})).catch((function(t){return n.error("changeAdminStatus",t),s(t)})),d}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const n=require("../utils"),t=require("npmlog");module.exports=function(e,r,o){return function(r,c,i){let u=function(){},s=function(){};const f=new Promise((function(n,t){u=n,s=t}));i||(i=function(n){if(n)return s(n);u()});const a={};if("Array"===n.getType(r))for(let n=0;n<r.length;n++)a["ids["+r[n]+"]"]=c;else a["ids["+r+"]"]=c;return e.post("https://www.facebook.com/ajax/mercury/change_archived_status.php",o.jar,a).then(n.parseAndCheckLogin(o,e)).then((function(n){if(n.error)throw n;return i()})).catch((function(n){return t.error("changeArchivedStatus",n),i(n)})),f}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),r=require("npmlog"),t=require("bluebird");module.exports=function(i,n,o){return function(n,u="",a=null,c){let s=function(){},l=function(){};const p=new Promise((function(e,r){s=e,l=r}));return a||"Number"!==e.getType(u)||(a=u,u=""),a||c||"Function"!=e.getType(u)&&"AsyncFunction"!=e.getType(u)||(c=u,u="",a=null),c||(c=function(e,r){if(e)return l(e);s(r)}),e.isReadableStream(n)?(function(n,u){const a=[];a.push(i.postFormData("https://www.facebook.com/profile/picture/upload/",o.jar,{profile_id:o.i_userID||o.userID,photo_source:57,av:o.i_userID||o.userID,file:n},{}).then(e.parseAndCheckLogin(o,i)).then((function(e){if(e.error)throw e;return e}))),t.all(a).then((function(e){u(null,e)})).catch((function(e){return r.error("handleUpload",e),u(e)}))}(n,(function(t,n){if(t)return c(t);const s={av:o.i_userID||o.userID,fb_api_req_friendly_name:"ProfileCometProfilePictureSetMutation",fb_api_caller_class:"RelayModern",doc_id:"5066134240065849",variables:JSON.stringify({input:{caption:u,existing_photo_id:n[0].payload.fbid,expiration_time:a,profile_id:o.i_userID||o.userID,profile_pic_method:"EXISTING",profile_pic_source:"TIMELINE",scaled_crop_rect:{height:1,width:1,x:0,y:0},skip_cropping:!0,actor_id:o.i_userID||o.userID,client_mutation_id:Math.round(19*Math.random()).toString()},isPage:!1,isProfile:!0,scale:3})};i.post("https://www.facebook.com/api/graphql/",o.jar,s).then(e.parseAndCheckLogin(o,i)).then((function(e){if(e.errors)throw e;return c(null,e[0].data.profile_picture_set)})).catch((function(e){return r.error("changeAvatar",e),c(e)}))})),p):c("Image is not a readable stream")}};
|
package/src/changeBio.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),n=require("npmlog");module.exports=function(t,i,r){return function(i,o,u){let c=function(){},a=function(){};const s=new Promise((function(e,n){c=e,a=n}));u||(u="Function"==e.getType(o)||"AsyncFunction"==e.getType(o)?o:function(e){if(e)return a(e);c()}),"Boolean"!=e.getType(o)&&(o=!1),"String"!=e.getType(i)&&(i="",o=!1);const l={fb_api_caller_class:"RelayModern",fb_api_req_friendly_name:"ProfileCometSetBioMutation",doc_id:"2725043627607610",variables:JSON.stringify({input:{bio:i,publish_bio_feed_story:o,actor_id:r.i_userID||r.userID,client_mutation_id:Math.round(1024*Math.random()).toString()},hasProfileTileViewID:!1,profileTileViewID:null,scale:1}),av:r.i_userID||r.userID};return t.post("https://www.facebook.com/api/graphql/",r.jar,l).then(e.parseAndCheckLogin(r,t)).then((function(e){if(e.errors)throw e;return u()})).catch((function(e){return n.error("changeBio",e),u(e)})),s}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const n=require("../utils"),e=require("npmlog");module.exports=function(t,o,r){return function(o,u,c){let i=function(){},s=function(){};const f=new Promise((function(n,e){i=n,s=e}));return c||(c=function(n){if(n)return s(n);i()}),t.post("https://www.facebook.com/messaging/"+(u?"":"un")+"block_messages/",r.jar,{fbid:o}).then(n.saveCookies(r.jar)).then(n.parseAndCheckLogin(r,t)).then((function(n){if(n.error)throw n;return c()})).catch((function(n){return e.error("changeBlockedStatus",n),c(n)})),f}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),t=require("npmlog"),r=require("bluebird");module.exports=function(a,n,i){return function(n,o,s){if(!s&&("Function"===e.getType(o)||"AsyncFunction"===e.getType(o)))throw{error:"please pass a threadID as a second argument."};if(!e.isReadableStream(n))throw{error:"please pass a readable stream as a first argument."};let u=function(){},c=function(){};const _=new Promise((function(e,t){u=e,c=t}));s||(s=function(e){if(e)return c(e);u()});const d=e.generateOfflineThreadingID(),m={client:"mercury",action_type:"ma-type:log-message",author:"fbid:"+(i.i_userID||i.userID),author_email:"",ephemeral_ttl_mode:"0",is_filtered_content:!1,is_filtered_content_account:!1,is_filtered_content_bh:!1,is_filtered_content_invalid_app:!1,is_filtered_content_quasar:!1,is_forward:!1,is_spoof_warning:!1,is_unread:!1,log_message_type:"log:thread-image",manual_retry_cnt:"0",message_id:d,offline_threading_id:d,source:"source:chat:web","source_tags[0]":"source:chat",status:"0",thread_fbid:o,thread_id:"",timestamp:Date.now(),timestamp_absolute:"Today",timestamp_relative:e.generateTimestampRelative(),timestamp_time_passed:"0"};return function(n,o){const s=[];s.push(a.postFormData("https://upload.facebook.com/ajax/mercury/upload.php",i.jar,{images_only:"true","attachment[]":n},{}).then(e.parseAndCheckLogin(i,a)).then((function(e){if(e.error)throw e;return e.payload.metadata[0]}))),r.all(s).then((function(e){o(null,e)})).catch((function(e){return t.error("handleUpload",e),o(e)}))}(n,(function(r,n){if(r)return s(r);m.thread_image_id=n[0].image_id,m.thread_id=o,a.post("https://www.facebook.com/messaging/set_thread_image/",i.jar,m).then(e.parseAndCheckLogin(i,a)).then((function(e){if(e.error)throw e;return s()})).catch((function(e){return t.error("changeGroupImage",e),s(e)}))})),_}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),r=require("npmlog");module.exports=function(n,t,o){return function(t,i,a,c){let s=function(){},h=function(){};const u=new Promise((function(e,r){s=e,h=r}));return c||(c=function(e){if(e)return h(e);s()}),n.post("https://www.facebook.com/messaging/save_thread_nickname/?source=thread_settings&dpr=1",o.jar,{nickname:t,participant_id:a,thread_or_other_fbid:i}).then(e.parseAndCheckLogin(o,n)).then((function(e){if(1545014===e.error)throw{error:"Trying to change nickname of user isn't in thread"};if(1357031===e.error)throw{error:"Trying to change user nickname of a thread that doesn't exist. Have at least one message in the thread before trying to change the user nickname."};if(e.error)throw e;return c()})).catch((function(e){return r.error("changeNickname",e),c(e)})),u}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const r=require("../utils"),t=require("npmlog");module.exports=function(e,n,o){return function(n,i,u){let c=function(){},s=function(){};const a=new Promise((function(r,t){c=r,s=t}));u||(u=function(r){if(r)return s(r);c(r)}),isNaN(n)||(n=n.toString());const h=null!==n?n.toLowerCase():n,d={dpr:1,queries:JSON.stringify({o0:{doc_id:"1727493033983591",query_params:{data:{actor_id:o.i_userID||o.userID,client_mutation_id:"0",source:"SETTINGS",theme_id:h,thread_id:i}}}})};return e.post("https://www.facebook.com/api/graphqlbatch/",o.jar,d).then(r.parseAndCheckLogin(o,e)).then((function(r){if(r[r.length-1].error_results>0)throw r[0].o0.errors;return u()})).catch((function(r){return t.error("changeThreadColor",r),u(r)})),a}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),t=require("npmlog");module.exports=function(r,o,n){return function(o,i,c){let a=function(){},h=function(){};const s=new Promise((function(e,t){a=e,h=t}));return c||(c=function(e){if(e)return h(e);a()}),r.post("https://www.facebook.com/messaging/save_thread_emoji/?source=thread_settings&__pc=EXP1%3Amessengerdotcom_pkg",n.jar,{emoji_choice:o,thread_or_other_fbid:i}).then(e.parseAndCheckLogin(n,r)).then((function(e){if(1357031===e.error)throw{error:"Trying to change emoji of a chat that doesn't exist. Have at least one message in the thread before trying to change the emoji."};if(e.error)throw e;return c()})).catch((function(e){return t.error("changeThreadEmoji",e),c(e)})),s}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),r=require("npmlog");module.exports=function(t,n,i){return function(n,a,o){if("Function"==e.getType(a)&&(o=a,a=null),"Array"!==e.getType(n))throw{error:"createNewGroup: participantIDs should be an array."};if(n.length<2)throw{error:"createNewGroup: participantIDs should have at least 2 IDs."};let u=function(){},s=function(){};const c=new Promise((function(e,r){u=e,s=r}));o||(o=function(e,r){if(e)return s(e);u(r)});const p=[];for(const e in n)p.push({fbid:n[e]});p.push({fbid:i.i_userID||i.userID});const _={fb_api_caller_class:"RelayModern",fb_api_req_friendly_name:"MessengerGroupCreateMutation",av:i.i_userID||i.userID,doc_id:"577041672419534",variables:JSON.stringify({input:{entry_point:"jewel_new_group",actor_id:i.i_userID||i.userID,participants:p,client_mutation_id:Math.round(1024*Math.random()).toString(),thread_settings:{name:a,joinable_mode:"PRIVATE",thread_image_fbid:null}}})};return t.post("https://www.facebook.com/api/graphql/",i.jar,_).then(e.parseAndCheckLogin(i,t)).then((function(e){if(e.errors)throw e;return o(null,e.data.messenger_group_thread_create.thread.thread_key.thread_fbid)})).catch((function(e){return r.error("createNewGroup",e),o(e)})),c}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const t=require("../utils"),n=require("npmlog");module.exports=function(e,o,r){return function(o,i,c,u){let s=function(){},a=function(){};const l=new Promise((function(t,n){s=t,a=n}));u||("Function"==t.getType(c)?(u=c,c=null):u=function(t){if(t)return a(t);s()}),c||(c={});const p={target_id:i,question_text:o};let f=0;for(const t in c)c.hasOwnProperty(t)&&(p["option_text_array["+f+"]"]=t,p["option_is_selected_array["+f+"]"]=c[t]?"1":"0",f++);return e.post("https://www.facebook.com/messaging/group_polling/create_poll/?dpr=1",r.jar,p).then(t.parseAndCheckLogin(r,e)).then((function(t){if("success"!=t.payload.status)throw t;return u()})).catch((function(t){return n.error("createPoll",t),u(t)})),l}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),n=require("npmlog");module.exports=function(r,t,o){return function(t,c){let u=function(){},i=function(){};const s=new Promise((function(e,n){u=e,i=n}));c||(c=function(e){if(e)return i(e);u()});const f={client:"mercury"};"Array"!==e.getType(t)&&(t=[t]);for(let e=0;e<t.length;e++)f["message_ids["+e+"]"]=t[e];return r.post("https://www.facebook.com/ajax/mercury/delete_messages.php",o.jar,f).then(e.parseAndCheckLogin(o,r)).then((function(e){if(e.error)throw e;return c()})).catch((function(e){return n.error("deleteMessage",e),c(e)})),s}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),r=require("npmlog");module.exports=function(t,n,o){return function(n,c){let u=function(){},i=function(){};const f=new Promise((function(e,r){u=e,i=r}));c||(c=function(e){if(e)return i(e);u()});const h={client:"mercury"};"Array"!==e.getType(n)&&(n=[n]);for(let e=0;e<n.length;e++)h["ids["+e+"]"]=n[e];return t.post("https://www.facebook.com/ajax/mercury/delete_thread.php",o.jar,h).then(e.parseAndCheckLogin(o,t)).then((function(e){if(e.error)throw e;return c()})).catch((function(e){return r.error("deleteThread",e),c(e)})),f}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const t=require("../utils"),n=require("npmlog");module.exports=function(r,e,o){return function(e,c,i){let u=function(){},a=function(){};const f=new Promise((function(t,n){u=t,a=n}));i||(i=function(t){if(t)return a(t);u()});const h={attachment_id:e};"Array"!==t.getType(c)&&(c=[c]);const s=Math.floor(Date.now()/1e3);for(let t=0;t<c.length;t++)h["recipient_map["+(s+t)+"]"]=c[t];return r.post("https://www.facebook.com/mercury/attachments/forward/",o.jar,h).then(t.parseAndCheckLogin(o.jar,r)).then((function(t){if(t.error)throw t;return i()})).catch((function(t){return n.error("forwardAttachment",t),i(t)})),f}};
|
@@ -0,0 +1 @@
|
|
1
|
+
module.exports=function(e,n,r){return async function(){return await require("../lib/getToken").getAccessToken(r.jar,r,e)}};
|
@@ -0,0 +1 @@
|
|
1
|
+
module.exports=function(r,u,e){return function(){return e.i_userID||e.userID}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const t=require("util");module.exports=function(){return function(n,o,e){const r=t.format("%s/%s/%s.png",e=e||"1.0",o,n.codePointAt(0).toString(16));let s=317426846;for(let t=0;t<r.length;t++)s=(s<<5)-s+r.charCodeAt(t);const i=(255&s).toString(16);return t.format("https://static.xx.fbcdn.net/images/emoji.php/v8/z%s/%s",i,r)}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),r=require("npmlog"),n={0:"unknown",1:"female_singular",2:"male_singular",3:"female_singular_guess",4:"male_singular_guess",5:"mixed",6:"neuter_singular",7:"unknown_singular",8:"female_plural",9:"male_plural",10:"neuter_plural",11:"unknown_plural"};module.exports=function(t,i,u){return function(i){let a=function(){},l=function(){};const o=new Promise((function(e,r){a=e,l=r}));return i||(i=function(e,r){if(e)return l(e);a(r)}),t.postFormData("https://www.facebook.com/chat/user_info_all",u.jar,{},{viewer:u.i_userID||u.userID}).then(e.parseAndCheckLogin(u,t)).then((function(r){if(!r)throw{error:"getFriendsList returned empty object."};if(r.error)throw r;var t;i(null,(t=r.payload,Object.keys(t).map((function(r){const i=t[r];return{alternateName:i.alternateName,firstName:i.firstName,gender:n[i.gender],userID:e.formatID(i.id.toString()),isFriend:!(null==i.is_friend||!i.is_friend),fullName:i.name,profilePicture:i.thumbSrc,type:i.type,profileUrl:i.uri,vanity:i.vanity,isBirthday:!!i.is_birthday}}))))})).catch((function(e){return r.error("getFriendsList",e),i(e)})),o}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),t=require("npmlog");function _(t,_){switch(_.__typename){case"ThreadNameMessage":return{type:"event",threadID:t,messageID:_.message_id,logMessageType:"log:thread-name",logMessageData:{name:_.thread_name},logMessageBody:_.snippet,timestamp:_.timestamp_precise,author:_.message_sender.id};case"ThreadImageMessage":const o=_.image_with_metadata;return{type:"event",threadID:t,messageID:_.message_id,logMessageType:"log:thread-image",logMessageData:o?{attachmentID:o.legacy_attachment_id,width:o.original_dimensions.x,height:o.original_dimensions.y,url:o.preview.uri}:{attachmentID:null,width:null,height:null,url:null},logMessageBody:_.snippet,timestamp:_.timestamp_precise,author:_.message_sender.id};case"GenericAdminTextMessage":switch(_.extensible_message_admin_text_type){case"CHANGE_THREAD_THEME":return{type:"event",threadID:t,messageID:_.message_id,logMessageType:"log:thread-color",logMessageData:i.find((e=>e.theme_color===_.extensible_message_admin_text.theme_color))||{theme_color:_.extensible_message_admin_text.theme_color,theme_id:null,theme_emoji:null,gradient:null,should_show_icon:null,theme_name_with_subtitle:null},logMessageBody:_.snippet,timestamp:_.timestamp_precise,author:_.message_sender.id};case"CHANGE_THREAD_ICON":const e=_.extensible_message_admin_text.thread_icon;return{type:"event",threadID:t,messageID:_.message_id,logMessageType:"log:thread-icon",logMessageData:{thread_icon_url:"https://static.xx.fbcdn.net/images/emoji.php/v9/t3c/1/16/"+e.codePointAt(0).toString(16)+".png",thread_icon:e},logMessageBody:_.snippet,timestamp:_.timestamp_precise,author:_.message_sender.id};case"CHANGE_THREAD_NICKNAME":return{type:"event",threadID:t,messageID:_.message_id,logMessageType:"log:user-nickname",logMessageData:{nickname:_.extensible_message_admin_text.nickname,participant_id:_.extensible_message_admin_text.participant_id},logMessageBody:_.snippet,timestamp:_.timestamp_precise,author:_.message_sender.id};case"GROUP_POLL":const o=_.extensible_message_admin_text.question;return{type:"event",threadID:t,messageID:_.message_id,logMessageType:"log:thread-poll",logMessageData:{question_json:JSON.stringify({id:o.id,text:o.text,total_count:_.extensible_message_admin_text.total_count,viewer_has_voted:o.viewer_has_voted,question_type:"",creator_id:_.message_sender.id,options:o.options.nodes.map((e=>({id:e.id,text:e.text,total_count:e.voters.nodes.length,viewer_has_voted:e.viewer_has_voted,voters:e.voters.nodes.map((e=>e.id))})))}),event_type:_.extensible_message_admin_text.event_type.toLowerCase(),question_id:o.id},logMessageBody:_.snippet,timestamp:_.timestamp_precise,author:_.message_sender.id};default:throw new Error('Unknown admin text type: "'+_.extensible_message_admin_text_type+'", if this happens to you let me know when it happens. Please open an issue at https://github.com/ntkhang03/fb-chat-api/issues.')}case"UserMessage":return{senderID:_.message_sender.id,body:_.message.text,threadID:t,messageID:_.message_id,reactions:_.message_reactions.map((e=>({[e.user.id]:e.reaction}))),attachments:_.blob_attachments&&_.blob_attachments.length>0?_.blob_attachments.length.map((t=>{let _;try{_=e._formatAttachment(t)}catch(e){_=t,_.error=e,_.type="unknown"}return _})):_.extensible_attachment&&Object.keys(_.extensible_attachment).length>0?[{type:"share",ID:_.extensible_attachment.legacy_attachment_id,url:_.extensible_attachment.story_attachment.url,title:_.extensible_attachment.story_attachment.title_with_entities.text,description:_.extensible_attachment.story_attachment.description.text,source:_.extensible_attachment.story_attachment.source,image:((_.extensible_attachment.story_attachment.media||{}).image||{}).uri,width:((_.extensible_attachment.story_attachment.media||{}).image||{}).width,height:((_.extensible_attachment.story_attachment.media||{}).image||{}).height,playable:(_.extensible_attachment.story_attachment.media||{}).is_playable||!1,duration:(_.extensible_attachment.story_attachment.media||{}).playable_duration_in_ms||0,subattachments:_.extensible_attachment.subattachments,properties:_.extensible_attachment.story_attachment.properties}]:[],mentions:_.message.ranges.map((e=>({[e.entity.id]:_.message.text.substring(e.offset,e.offset+e.length)}))),timestamp:_.timestamp_precise};default:throw new Error('Unknown message type: "'+_.__typename+'", if this happens to you let me know when it happens. Please open an issue at https://github.com/ntkhang03/fb-chat-api/issues.')}}module.exports=function(i,o,h){return function(o,F,s){let m=function(){},n=function(){};const a=new Promise((function(e,t){m=e,n=t}));if(s||(s=function(e,t){if(e)return n(e);m(t)}),!o||!F)return s({error:"getMessage: need threadID and messageID"});const l={av:h.globalOptions.pageID,queries:JSON.stringify({o0:{doc_id:"1768656253222505",query_params:{thread_and_message_id:{thread_id:o,message_id:F}}}})};return i.post("https://www.facebook.com/api/graphqlbatch/",h.jar,l).then(e.parseAndCheckLogin(h,i)).then((e=>{if(e[e.length-1].error_results>0)throw e[0].o0.errors;if(0===e[e.length-1].successful_results)throw{error:"getMessage: there was no successful_results",res:e};const t=e[0].o0.data.message;if(!t)throw t;var i,h;s(null,(i=o,(h=t).replied_to_message?Object.assign({type:"message_reply"},_(i,h),{messageReply:_(i,h.replied_to_message.message)}):_(i,h)))})).catch((e=>{t.error("getMessage",e),s(e)})),a}};const i=[{theme_color:"FF000000",theme_id:"788274591712841",theme_emoji:"🖤",gradient:'["FFF0F0F0"]',should_show_icon:"",theme_name_with_subtitle:"Monochrome"},{theme_color:"FFFF5CA1",theme_id:"169463077092846",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Hot Pink"},{theme_color:"FF2825B5",theme_id:"271607034185782",theme_emoji:null,gradient:'["FF5E007E","FF331290","FF2825B5"]',should_show_icon:"1",theme_name_with_subtitle:"Shadow"},{theme_color:"FFD9A900",theme_id:"2533652183614000",theme_emoji:null,gradient:'["FF550029","FFAA3232","FFD9A900"]',should_show_icon:"1",theme_name_with_subtitle:"Maple"},{theme_color:"FFFB45DE",theme_id:"2873642949430623",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Tulip"},{theme_color:"FF5E007E",theme_id:"193497045377796",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Grape"},{theme_color:"FF7AA286",theme_id:"1455149831518874",theme_emoji:"🌑",gradient:'["FF25C0E1","FFCE832A"]',should_show_icon:"",theme_name_with_subtitle:"Dune"},{theme_color:"FFFAAF00",theme_id:"672058580051520",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Honey"},{theme_color:"FF0084FF",theme_id:"196241301102133",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Default Blue"},{theme_color:"FFFFC300",theme_id:"174636906462322",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Yellow"},{theme_color:"FF44BEC7",theme_id:"1928399724138152",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Teal Blue"},{theme_color:"FF7646FF",theme_id:"234137870477637",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Bright Purple"},{theme_color:"FFF25C54",theme_id:"3022526817824329",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Peach"},{theme_color:"FFF01D6A",theme_id:"724096885023603",theme_emoji:null,gradient:'["FF005FFF","FF9200FF","FFFF2E19"]',should_show_icon:"1",theme_name_with_subtitle:"Berry"},{theme_color:"FFFF7CA8",theme_id:"624266884847972",theme_emoji:null,gradient:'["FFFF8FB2","FFA797FF","FF00E5FF"]',should_show_icon:"1",theme_name_with_subtitle:"Candy"},{theme_color:"FF6E5B04",theme_id:"365557122117011",theme_emoji:"💛",gradient:'["FFED9F9A","FFED9F9A","FFED9F9A"]',should_show_icon:"",theme_name_with_subtitle:"Support"},{theme_color:"FF0052CD",theme_id:"230032715012014",theme_emoji:"✌️",gradient:'["FF0052CD","FF00A1E6","FF0052CD"]',should_show_icon:"",theme_name_with_subtitle:"Tie-Dye"},{theme_color:"FF601DDD",theme_id:"1060619084701625",theme_emoji:"☁️",gradient:'["FFCA34FF","FF302CFF","FFBA009C"]',should_show_icon:"",theme_name_with_subtitle:"Lo-Fi"},{theme_color:"FF0099FF",theme_id:"3273938616164733",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Classic"},{theme_color:"FF1ADB5B",theme_id:"370940413392601",theme_emoji:null,gradient:'["FFFFD200","FF6EDF00","FF00DFBB"]',should_show_icon:"1",theme_name_with_subtitle:"Citrus"},{theme_color:"FFD696BB",theme_id:"2058653964378557",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Lavender Purple"},{theme_color:"FFC03232",theme_id:"1059859811490132",theme_emoji:"🙃",gradient:'["FFDB4040","FFA32424"]',should_show_icon:"",theme_name_with_subtitle:"Stranger Things"},{theme_color:"FFFA3C4C",theme_id:"2129984390566328",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Red"},{theme_color:"FF13CF13",theme_id:"2136751179887052",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Green"},{theme_color:"FFFF7E29",theme_id:"175615189761153",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Orange"},{theme_color:"FFE68585",theme_id:"980963458735625",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Coral Pink"},{theme_color:"FF20CEF5",theme_id:"2442142322678320",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Aqua Blue"},{theme_color:"FF0EDCDE",theme_id:"417639218648241",theme_emoji:null,gradient:'["FF19C9FF","FF00E6D2","FF0EE6B7"]',should_show_icon:"1",theme_name_with_subtitle:"Aqua"},{theme_color:"FFFF9C19",theme_id:"930060997172551",theme_emoji:null,gradient:'["FFFFDC2D","FFFF9616","FFFF4F00"]',should_show_icon:"1",theme_name_with_subtitle:"Mango"},{theme_color:"FFF01D6A",theme_id:"164535220883264",theme_emoji:null,gradient:'["FF005FFF","FF9200FF","FFFF2E19"]',should_show_icon:"1",theme_name_with_subtitle:"Berry"},{theme_color:"FFFF7CA8",theme_id:"205488546921017",theme_emoji:null,gradient:'["FFFF8FB2","FFA797FF","FF00E5FF"]',should_show_icon:"1",theme_name_with_subtitle:"Candy"},{theme_color:"FFFF6F07",theme_id:"1833559466821043",theme_emoji:"🌎",gradient:'["FFFF6F07"]',should_show_icon:"",theme_name_with_subtitle:"Earth"},{theme_color:"FF0B0085",theme_id:"339021464972092",theme_emoji:"🔈",gradient:'["FF2FA9E4","FF648FEB","FF9B73F2"]',should_show_icon:"",theme_name_with_subtitle:"Music"},{theme_color:"FF8A39EF",theme_id:"1652456634878319",theme_emoji:"🏳️🌈",gradient:'["FFFF0018","FFFF0417","FFFF310E","FFFF5D06","FFFF7A01","FFFF8701","FFFFB001","FFD9C507","FF79C718","FF01C92D","FF01BE69","FF01B3AA","FF0BA1DF","FF3F77E6","FF724CEC","FF8A39EF","FF8A39EF"]',should_show_icon:"",theme_name_with_subtitle:"Pride"},{theme_color:"FF004D7C",theme_id:"538280997628317",theme_emoji:"🌀",gradient:'["FF931410","FF931410","FF931410"]',should_show_icon:"",theme_name_with_subtitle:"Doctor Strange"},{theme_color:"FF4F4DFF",theme_id:"3190514984517598",theme_emoji:"🌤",gradient:'["FF0080FF","FF9F1AFF"]',should_show_icon:"",theme_name_with_subtitle:"Sky"},{theme_color:"FFE84B28",theme_id:"357833546030778",theme_emoji:"🐯",gradient:'["FFF69500","FFDA0050"]',should_show_icon:"1",theme_name_with_subtitle:"Lunar New Year"},{theme_color:"FFB24B77",theme_id:"627144732056021",theme_emoji:"🥳",gradient:'["FFF1614E","FF660F84"]',should_show_icon:"",theme_name_with_subtitle:"Celebration!"},{theme_color:"FF66A9FF",theme_id:"390127158985345",theme_emoji:"🥶",gradient:'["FF8CB3FF","FF409FFF"]',should_show_icon:"",theme_name_with_subtitle:"Chill"},{theme_color:"FF5797FC",theme_id:"275041734441112",theme_emoji:"😌",gradient:'["FF4AC9E4","FF5890FF","FF8C91FF"]',should_show_icon:"",theme_name_with_subtitle:"Care"},{theme_color:"FFFF595C",theme_id:"3082966625307060",theme_emoji:"💫",gradient:'["FFFF239A","FFFF8C21"]',should_show_icon:"",theme_name_with_subtitle:"Astrology"},{theme_color:"FF0171FF",theme_id:"184305226956268",theme_emoji:"☁️",gradient:'["FF0026ee","FF00b2ff"]',should_show_icon:"",theme_name_with_subtitle:"J Balvin"},{theme_color:"FFA033FF",theme_id:"621630955405500",theme_emoji:"🎉",gradient:'["FFFF7061","FFFF5280","FFA033FF","FF0099FF"]',should_show_icon:"",theme_name_with_subtitle:"Birthday"},{theme_color:"FF006528",theme_id:"539927563794799",theme_emoji:"🍄",gradient:'["FF00d52f","FF006528"]',should_show_icon:"",theme_name_with_subtitle:"Cottagecore"},{theme_color:"FF4D3EC2",theme_id:"736591620215564",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Ocean"},{theme_color:"FF4e4bf5",theme_id:"3259963564026002",theme_emoji:null,gradient:'["FFAA00FF","FF0080FF"]',should_show_icon:"1",theme_name_with_subtitle:"Default"},{theme_color:"FF3A12FF",theme_id:"582065306070020",theme_emoji:null,gradient:'["FFFAAF00","FFFF2E2E","FF3A12FF"]',should_show_icon:"1",theme_name_with_subtitle:"Rocket"},{theme_color:"FF3A1D8A",theme_id:"273728810607574",theme_emoji:null,gradient:'["FFFB45DE","FF841DD5","FF3A1D8A"]',should_show_icon:"1",theme_name_with_subtitle:"Unicorn"},{theme_color:"FF9FD52D",theme_id:"262191918210707",theme_emoji:null,gradient:'["FF2A7FE3","FF00BF91","FF9FD52D"]',should_show_icon:"1",theme_name_with_subtitle:"Tropical"},{theme_color:"FFF7B267",theme_id:"909695489504566",theme_emoji:null,gradient:'["FFF25C54","FFF4845F","FFF7B267"]',should_show_icon:"1",theme_name_with_subtitle:"Sushi"},{theme_color:"FF1ADB5B",theme_id:"557344741607350",theme_emoji:null,gradient:'["FFFFD200","FF6EDF00","FF00DFBB"]',should_show_icon:"1",theme_name_with_subtitle:"Citrus"},{theme_color:"FF4D3EC2",theme_id:"280333826736184",theme_emoji:null,gradient:'["FFFF625B","FFC532AD","FF4D3EC2"]',should_show_icon:"1",theme_name_with_subtitle:"Lollipop"},{theme_color:"FFFF311E",theme_id:"1257453361255152",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Rose"},{theme_color:"FFA797FF",theme_id:"571193503540759",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Lavender"},{theme_color:"FF6EDF00",theme_id:"3151463484918004",theme_emoji:null,gradient:null,should_show_icon:"1",theme_name_with_subtitle:"Kiwi"},{theme_color:"FF9D59D2",theme_id:"737761000603635",theme_emoji:"💛",gradient:'["FFFFD600","FFFCB37B","FF9D59D2","FF282828"]',should_show_icon:"",theme_name_with_subtitle:"Non-Binary"}];
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),t=require("npmlog");function a(e,t=""){if(e)return e;{const e=t.split(".").pop();return e===t?"":e}}function i(e){switch(e.__typename){case"MessageImage":return{type:"photo",ID:e.legacy_attachment_id,filename:e.filename,original_extension:a(e.original_extension,e.filename),thumbnailUrl:e.thumbnail.uri,previewUrl:e.preview.uri,previewWidth:e.preview.width,previewHeight:e.preview.height,largePreviewUrl:e.large_preview.uri,largePreviewHeight:e.large_preview.height,largePreviewWidth:e.large_preview.width,url:e.large_preview.uri,width:e.large_preview.width,height:e.large_preview.height,name:e.filename,attributionApp:e.attribution_app?{attributionAppID:e.attribution_app.id,name:e.attribution_app.name,logo:e.attribution_app.square_logo}:null};case"MessageAnimatedImage":return{type:"animated_image",ID:e.legacy_attachment_id,filename:e.filename,original_extension:a(e.original_extension,e.filename),previewUrl:e.preview_image.uri,previewWidth:e.preview_image.width,previewHeight:e.preview_image.height,url:e.animated_image.uri,width:e.animated_image.width,height:e.animated_image.height,thumbnailUrl:e.preview_image.uri,name:e.filename,facebookUrl:e.animated_image.uri,rawGifImage:e.animated_image.uri,animatedGifUrl:e.animated_image.uri,animatedGifPreviewUrl:e.preview_image.uri,animatedWebpUrl:e.animated_image.uri,animatedWebpPreviewUrl:e.preview_image.uri,attributionApp:e.attribution_app?{attributionAppID:e.attribution_app.id,name:e.attribution_app.name,logo:e.attribution_app.square_logo}:null};case"MessageVideo":return{type:"video",ID:e.legacy_attachment_id,filename:e.filename,original_extension:a(e.original_extension,e.filename),duration:e.playable_duration_in_ms,thumbnailUrl:e.large_image.uri,previewUrl:e.large_image.uri,previewWidth:e.large_image.width,previewHeight:e.large_image.height,url:e.playable_url,width:e.original_dimensions.x,height:e.original_dimensions.y,videoType:e.video_type.toLowerCase()};case"MessageFile":return{type:"file",ID:e.message_file_fbid,filename:e.filename,original_extension:a(e.original_extension,e.filename),url:e.url,isMalicious:e.is_malicious,contentType:e.content_type,name:e.filename,mimeType:"",fileSize:-1};case"MessageAudio":return{type:"audio",ID:e.url_shimhash,filename:e.filename,original_extension:a(e.original_extension,e.filename),duration:e.playable_duration_in_ms,audioType:e.audio_type,url:e.playable_url,isVoiceMail:e.is_voicemail};default:return{error:"Don't know about attachment type "+e.__typename}}}function n(e){return{reaction:e.reaction,userID:e.user.id}}function r(e){if(null==e)return{};switch(e.__typename){case"ThemeColorExtensibleMessageAdminText":return{color:e.theme_color};case"ThreadNicknameExtensibleMessageAdminText":return{nickname:e.nickname,participantID:e.participant_id};case"ThreadIconExtensibleMessageAdminText":return{threadIcon:e.thread_icon};case"InstantGameUpdateExtensibleMessageAdminText":return{gameID:null==e.game?null:e.game.id,update_type:e.update_type,collapsed_text:e.collapsed_text,expanded_text:e.expanded_text,instant_game_update_data:e.instant_game_update_data};case"GameScoreExtensibleMessageAdminText":return{game_type:e.game_type};case"RtcCallLogExtensibleMessageAdminText":return{event:e.event,is_video_call:e.is_video_call,server_info_data:e.server_info_data};case"GroupPollExtensibleMessageAdminText":return{event_type:e.event_type,total_count:e.total_count,question:e.question};case"AcceptPendingThreadExtensibleMessageAdminText":return{accepter_id:e.accepter_id,requester_id:e.requester_id};case"ConfirmFriendRequestExtensibleMessageAdminText":return{friend_request_recipient:e.friend_request_recipient,friend_request_sender:e.friend_request_sender};case"AddContactExtensibleMessageAdminText":return{contact_added_id:e.contact_added_id,contact_adder_id:e.contact_adder_id};case"AdExtensibleMessageAdminText":return{ad_client_token:e.ad_client_token,ad_id:e.ad_id,ad_preferences_link:e.ad_preferences_link,ad_properties:e.ad_properties};case"ParticipantJoinedGroupCallExtensibleMessageAdminText":case"ThreadEphemeralTtlModeExtensibleMessageAdminText":case"StartedSharingVideoExtensibleMessageAdminText":case"LightweightEventCreateExtensibleMessageAdminText":case"LightweightEventNotifyExtensibleMessageAdminText":case"LightweightEventNotifyBeforeEventExtensibleMessageAdminText":case"LightweightEventUpdateTitleExtensibleMessageAdminText":case"LightweightEventUpdateTimeExtensibleMessageAdminText":case"LightweightEventUpdateLocationExtensibleMessageAdminText":case"LightweightEventDeleteExtensibleMessageAdminText":return{};default:return{error:"Don't know what to with event data type "+e.__typename}}}module.exports=function(a,s,m){return function(s,d,_,l){let o=function(){},p=function(){};const g=new Promise((function(e,t){o=e,p=t}));l||(l=function(e,t){if(e)return p(e);o(t)});const c={av:m.globalOptions.pageID,queries:JSON.stringify({o0:{doc_id:"1498317363570230",query_params:{id:s,message_limit:d,load_messages:1,load_read_receipts:!1,before:_}}})};return a.post("https://www.facebook.com/api/graphqlbatch/",m.jar,c).then(e.parseAndCheckLogin(m,a)).then((function(t){if(t.error)throw t;if(0!==t[t.length-1].error_results)throw new Error("There was an error_result.");l(null,function(t){const a=t.o0.data.message_thread,s=a.thread_key.thread_fbid?a.thread_key.thread_fbid:a.thread_key.other_user_id;return a.messages.nodes.map((function(t){switch(t.__typename){case"UserMessage":var m;t.sticker&&(m=[{type:"sticker",ID:t.sticker.id,url:t.sticker.url,packID:t.sticker.pack?t.sticker.pack.id:null,spriteUrl:t.sticker.sprite_image,spriteUrl2x:t.sticker.sprite_image_2x,width:t.sticker.width,height:t.sticker.height,caption:t.snippet,description:t.sticker.label,frameCount:t.sticker.frame_count,frameRate:t.sticker.frame_rate,framesPerRow:t.sticker.frames_per_row,framesPerCol:t.sticker.frames_per_col,stickerID:t.sticker.id,spriteURI:t.sticker.sprite_image,spriteURI2x:t.sticker.sprite_image_2x}]);var d={};return null!==t.message&&t.message.ranges.forEach((e=>{d[e.entity.id]=t.message.text.substr(e.offset,e.length)})),{type:"message",attachments:m||(t.blob_attachments&&t.blob_attachments.length>0?t.blob_attachments.map(i):t.extensible_attachment?[(_=t.extensible_attachment,_.story_attachment?{type:"share",ID:_.legacy_attachment_id,url:_.story_attachment.url,title:_.story_attachment.title_with_entities.text,description:_.story_attachment.description&&_.story_attachment.description.text,source:null==_.story_attachment.source?null:_.story_attachment.source.text,image:null==_.story_attachment.media||null==_.story_attachment.media.animated_image&&null==_.story_attachment.media.image?null:(_.story_attachment.media.animated_image||_.story_attachment.media.image).uri,width:null==_.story_attachment.media||null==_.story_attachment.media.animated_image&&null==_.story_attachment.media.image?null:(_.story_attachment.media.animated_image||_.story_attachment.media.image).width,height:null==_.story_attachment.media||null==_.story_attachment.media.animated_image&&null==_.story_attachment.media.image?null:(_.story_attachment.media.animated_image||_.story_attachment.media.image).height,playable:null==_.story_attachment.media?null:_.story_attachment.media.is_playable,duration:null==_.story_attachment.media?null:_.story_attachment.media.playable_duration_in_ms,playableUrl:null==_.story_attachment.media?null:_.story_attachment.media.playable_url,subattachments:_.story_attachment.subattachments,properties:_.story_attachment.properties.reduce((function(e,t){return e[t.key]=t.value.text,e}),{}),animatedImageSize:"",facebookUrl:"",styleList:"",target:"",thumbnailUrl:null==_.story_attachment.media||null==_.story_attachment.media.animated_image&&null==_.story_attachment.media.image?null:(_.story_attachment.media.animated_image||_.story_attachment.media.image).uri,thumbnailWidth:null==_.story_attachment.media||null==_.story_attachment.media.animated_image&&null==_.story_attachment.media.image?null:(_.story_attachment.media.animated_image||_.story_attachment.media.image).width,thumbnailHeight:null==_.story_attachment.media||null==_.story_attachment.media.animated_image&&null==_.story_attachment.media.image?null:(_.story_attachment.media.animated_image||_.story_attachment.media.image).height}:{error:"Don't know what to do with extensible_attachment."})]:[]),body:null!==t.message?t.message.text:"",isGroup:"GROUP"===a.thread_type,messageID:t.message_id,senderID:t.message_sender.id,threadID:s,timestamp:t.timestamp_precise,mentions:d,isUnread:t.unread,messageReactions:t.message_reactions?t.message_reactions.map(n):null,isSponsored:t.is_sponsored,snippet:t.snippet};case"ThreadNameMessage":return{type:"event",messageID:t.message_id,threadID:s,isGroup:"GROUP"===a.thread_type,senderID:t.message_sender.id,timestamp:t.timestamp_precise,eventType:"change_thread_name",snippet:t.snippet,eventData:{threadName:t.thread_name},author:t.message_sender.id,logMessageType:"log:thread-name",logMessageData:{name:t.thread_name}};case"ThreadImageMessage":return{type:"event",messageID:t.message_id,threadID:s,isGroup:"GROUP"===a.thread_type,senderID:t.message_sender.id,timestamp:t.timestamp_precise,eventType:"change_thread_image",snippet:t.snippet,eventData:null==t.image_with_metadata?{}:{threadImage:{attachmentID:t.image_with_metadata.legacy_attachment_id,width:t.image_with_metadata.original_dimensions.x,height:t.image_with_metadata.original_dimensions.y,url:t.image_with_metadata.preview.uri}},logMessageType:"log:thread-icon",logMessageData:{thread_icon:t.image_with_metadata?t.image_with_metadata.preview.uri:null}};case"ParticipantLeftMessage":return{type:"event",messageID:t.message_id,threadID:s,isGroup:"GROUP"===a.thread_type,senderID:t.message_sender.id,timestamp:t.timestamp_precise,eventType:"remove_participants",snippet:t.snippet,eventData:{participantsRemoved:t.participants_removed.map((function(e){return e.id}))},logMessageType:"log:unsubscribe",logMessageData:{leftParticipantFbId:t.participants_removed.map((function(e){return e.id}))}};case"ParticipantsAddedMessage":return{type:"event",messageID:t.message_id,threadID:s,isGroup:"GROUP"===a.thread_type,senderID:t.message_sender.id,timestamp:t.timestamp_precise,eventType:"add_participants",snippet:t.snippet,eventData:{participantsAdded:t.participants_added.map((function(e){return e.id}))},logMessageType:"log:subscribe",logMessageData:{addedParticipants:t.participants_added.map((function(e){return e.id}))}};case"VideoCallMessage":return{type:"event",messageID:t.message_id,threadID:s,isGroup:"GROUP"===a.thread_type,senderID:t.message_sender.id,timestamp:t.timestamp_precise,eventType:"video_call",snippet:t.snippet,logMessageType:"other"};case"VoiceCallMessage":return{type:"event",messageID:t.message_id,threadID:s,isGroup:"GROUP"===a.thread_type,senderID:t.message_sender.id,timestamp:t.timestamp_precise,eventType:"voice_call",snippet:t.snippet,logMessageType:"other"};case"GenericAdminTextMessage":return{type:"event",messageID:t.message_id,threadID:s,isGroup:"GROUP"===a.thread_type,senderID:t.message_sender.id,timestamp:t.timestamp_precise,snippet:t.snippet,eventType:t.extensible_message_admin_text_type.toLowerCase(),eventData:r(t.extensible_message_admin_text),logMessageType:e.getAdminTextMessageType(t.extensible_message_admin_text_type),logMessageData:t.extensible_message_admin_text};default:return{error:"Don't know about message type "+t.__typename}}var _}))}(t[0]))})).catch((function(e){return t.error("getThreadHistoryGraphQL",e),l(e)})),g}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),t=require("npmlog");function n(e){return{reminderID:e.id,eventCreatorID:e.lightweight_event_creator.id,time:e.time,eventType:e.lightweight_event_type.toLowerCase(),locationName:e.location_name,locationCoordinates:e.location_coordinates,locationPage:e.location_page,eventStatus:e.lightweight_event_status.toLowerCase(),note:e.note,repeatMode:e.repeat_mode.toLowerCase(),eventTitle:e.event_title,triggerMessage:e.trigger_message,secondsToNotifyBefore:e.seconds_to_notify_before,allowsRsvp:e.allows_rsvp,relatedEvent:e.related_event,members:e.event_reminder_members.edges.map((function(e){return{memberID:e.node.id,state:e.guest_list_state.toLowerCase()}}))}}function a(e){if(e.errors)return e.errors;const t=e.message_thread;if(!t)return null;const a=t.last_message,i=a&&a.nodes&&a.nodes[0]&&a.nodes[0].message_sender&&a.nodes[0].message_sender.messaging_actor?a.nodes[0].message_sender.messaging_actor.id:null,s=a&&a.nodes&&a.nodes[0]?a.nodes[0].snippet:null,o=t.last_read_receipt,r=o&&o.nodes&&o.nodes[0]&&o.nodes[0].timestamp_precise?o.nodes[0].timestamp_precise:null;return{threadID:t.thread_key.thread_fbid?t.thread_key.thread_fbid:t.thread_key.other_user_id,threadName:t.name,participantIDs:t.all_participants.edges.map((e=>e.node.messaging_actor.id)),userInfo:t.all_participants.edges.map((e=>({id:e.node.messaging_actor.id,name:e.node.messaging_actor.name,firstName:e.node.messaging_actor.short_name,vanity:e.node.messaging_actor.username,url:e.node.messaging_actor.url,thumbSrc:e.node.messaging_actor.big_image_src.uri,profileUrl:e.node.messaging_actor.big_image_src.uri,gender:e.node.messaging_actor.gender,type:e.node.messaging_actor.__typename,isFriend:e.node.messaging_actor.is_viewer_friend,isBirthday:!!e.node.messaging_actor.is_birthday}))),unreadCount:t.unread_count,messageCount:t.messages_count,timestamp:t.updated_time_precise,muteUntil:t.mute_until,isGroup:"GROUP"==t.thread_type,isSubscribed:t.is_viewer_subscribed,isArchived:t.has_viewer_archived,folder:t.folder,cannotReplyReason:t.cannot_reply_reason,eventReminders:t.event_reminders?t.event_reminders.nodes.map(n):null,emoji:t.customization_info?t.customization_info.emoji:null,color:t.customization_info&&t.customization_info.outgoing_bubble_color?t.customization_info.outgoing_bubble_color.slice(2):null,threadTheme:t.thread_theme,nicknames:t.customization_info&&t.customization_info.participant_customizations?t.customization_info.participant_customizations.reduce((function(e,t){return t.nickname&&(e[t.participant_id]=t.nickname),e}),{}):{},adminIDs:t.thread_admins,approvalMode:Boolean(t.approval_mode),approvalQueue:t.group_approval_queue.nodes.map((e=>({inviterID:e.inviter.id,requesterID:e.requester.id,timestamp:e.request_timestamp,request_source:e.request_source}))),reactionsMuteMode:t.reactions_mute_mode.toLowerCase(),mentionsMuteMode:t.mentions_mute_mode.toLowerCase(),isPinProtected:t.is_pin_protected,relatedPageThread:t.related_page_thread,name:t.name,snippet:s,snippetSender:i,snippetAttachments:[],serverTimestamp:t.updated_time_precise,imageSrc:t.image?t.image.uri:null,isCanonicalUser:t.is_canonical_neo_user,isCanonical:"GROUP"!=t.thread_type,recipientsLoadable:!0,hasEmailParticipant:!1,readOnly:!1,canReply:null==t.cannot_reply_reason,lastMessageTimestamp:t.last_message?t.last_message.timestamp_precise:null,lastMessageType:"message",lastReadTimestamp:r,threadType:"GROUP"==t.thread_type?2:1,inviteLink:{enable:!!t.joinable_mode&&1==t.joinable_mode.mode,link:t.joinable_mode?t.joinable_mode.link:null}}}module.exports=function(n,i,s){return function(i,o){let r=function(){},_=function(){};const d=new Promise((function(e,t){r=e,_=t}));"Function"!=e.getType(o)&&"AsyncFunction"!=e.getType(o)&&(o=function(e,t){if(e)return _(e);r(t)}),"Array"!==e.getType(i)&&(i=[i]);let m={};return i.map((function(e,t){m["o"+t]={doc_id:"3449967031715030",query_params:{id:e,message_limit:0,load_messages:!1,load_read_receipts:!1,before:null}}})),m={queries:JSON.stringify(m),batch_name:"MessengerGraphQLThreadFetcher"},n.post("https://www.facebook.com/api/graphqlbatch/",s.jar,m).then(e.parseAndCheckLogin(s,n)).then((function(e){if(e.error)throw e;const t={};for(let n=e.length-2;n>=0;n--){const s=a(e[n][Object.keys(e[n])[0]].data);t[s?.threadID||i[i.length-1-n]]=s}1==Object.values(t).length?o(null,Object.values(t)[0]):o(null,t)})).catch((function(e){return t.error("getThreadInfoGraphQL",e),o(e)})),d}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),t=require("npmlog");function n(e){return{reminderID:e.id,eventCreatorID:e.lightweight_event_creator.id,time:e.time,eventType:e.lightweight_event_type.toLowerCase(),locationName:e.location_name,locationCoordinates:e.location_coordinates,locationPage:e.location_page,eventStatus:e.lightweight_event_status.toLowerCase(),note:e.note,repeatMode:e.repeat_mode.toLowerCase(),eventTitle:e.event_title,triggerMessage:e.trigger_message,secondsToNotifyBefore:e.seconds_to_notify_before,allowsRsvp:e.allows_rsvp,relatedEvent:e.related_event,members:e.event_reminder_members.edges.map((function(e){return{memberID:e.node.id,state:e.guest_list_state.toLowerCase()}}))}}module.exports=function(s,i,a){return function(i,r,o,m){if(m||"Function"!==e.getType(o)&&"AsyncFunction"!==e.getType(o)||(m=o,o=[""]),"Number"!==e.getType(i)||!Number.isInteger(i)||i<=0)throw{error:"getThreadList: limit must be a positive integer"};if("Null"!==e.getType(r)&&("Number"!==e.getType(r)||!Number.isInteger(r)))throw{error:"getThreadList: timestamp must be an integer or null"};if("String"===e.getType(o)&&(o=[o]),"Array"!==e.getType(o))throw{error:"getThreadList: tags must be an array"};let d=function(){},_=function(){};const c=new Promise((function(e,t){d=e,_=t}));"Function"!==e.getType(m)&&"AsyncFunction"!==e.getType(m)&&(m=function(e,t){if(e)return _(e);d(t)});const u={av:a.globalOptions.pageID,queries:JSON.stringify({o0:{doc_id:"3336396659757871",query_params:{limit:i+(r?1:0),before:r,tags:o,includeDeliveryReceipts:!0,includeSeqID:!1}}}),batch_name:"MessengerGraphQLThreadlistFetcher"};return s.post("https://www.facebook.com/api/graphqlbatch/",a.jar,u).then(e.parseAndCheckLogin(a,s)).then((e=>{if(e[e.length-1].error_results>0)throw e[0].o0.errors;if(0===e[e.length-1].successful_results)throw{error:"getThreadList: there was no successful_results",res:e};r&&e[0].o0.data.viewer.message_threads.nodes.shift(),m(null,e[0].o0.data.viewer.message_threads.nodes.map((e=>function(e){const t=e.last_message,s=t&&t.nodes&&t.nodes[0]&&t.nodes[0].message_sender&&t.nodes[0].message_sender.messaging_actor?t.nodes[0].message_sender.messaging_actor.id:null,i=t&&t.nodes&&t.nodes[0]?t.nodes[0].snippet:null,a=e.last_read_receipt,r=a&&a.nodes&&a.nodes[0]&&a.nodes[0].timestamp_precise?a.nodes[0].timestamp_precise:null;return{threadID:e.thread_key.thread_fbid?e.thread_key.thread_fbid:e.thread_key.other_user_id,threadName:e.name,participantIDs:e.all_participants.edges.map((e=>e.node.messaging_actor.id)),userInfo:e.all_participants.edges.map((e=>({id:e.node.messaging_actor.id,name:e.node.messaging_actor.name,firstName:e.node.messaging_actor.short_name,vanity:e.node.messaging_actor.username,url:e.node.messaging_actor.url,thumbSrc:e.node.messaging_actor.big_image_src.uri,profileUrl:e.node.messaging_actor.big_image_src.uri,gender:e.node.messaging_actor.gender,type:e.node.messaging_actor.__typename,isFriend:e.node.messaging_actor.is_viewer_friend,isBirthday:!!e.node.messaging_actor.is_birthday}))),unreadCount:e.unread_count,messageCount:e.messages_count,timestamp:e.updated_time_precise,muteUntil:e.mute_until,isGroup:"GROUP"==e.thread_type,isSubscribed:e.is_viewer_subscribed,isArchived:e.has_viewer_archived,folder:e.folder,cannotReplyReason:e.cannot_reply_reason,eventReminders:e.event_reminders?e.event_reminders.nodes.map(n):null,emoji:e.customization_info?e.customization_info.emoji:null,color:e.customization_info&&e.customization_info.outgoing_bubble_color?e.customization_info.outgoing_bubble_color.slice(2):null,threadTheme:e.thread_theme,nicknames:e.customization_info&&e.customization_info.participant_customizations?e.customization_info.participant_customizations.reduce((function(e,t){return t.nickname&&(e[t.participant_id]=t.nickname),e}),{}):{},adminIDs:e.thread_admins,approvalMode:Boolean(e.approval_mode),approvalQueue:e.group_approval_queue.nodes.map((e=>({inviterID:e.inviter.id,requesterID:e.requester.id,timestamp:e.request_timestamp,request_source:e.request_source}))),reactionsMuteMode:e.reactions_mute_mode.toLowerCase(),mentionsMuteMode:e.mentions_mute_mode.toLowerCase(),isPinProtected:e.is_pin_protected,relatedPageThread:e.related_page_thread,name:e.name,snippet:i,snippetSender:s,snippetAttachments:[],serverTimestamp:e.updated_time_precise,imageSrc:e.image?e.image.uri:null,isCanonicalUser:e.is_canonical_neo_user,isCanonical:"GROUP"!=e.thread_type,recipientsLoadable:!0,hasEmailParticipant:!1,readOnly:!1,canReply:null==e.cannot_reply_reason,lastMessageTimestamp:e.last_message?e.last_message.timestamp_precise:null,lastMessageType:"message",lastReadTimestamp:r,threadType:"GROUP"==e.thread_type?2:1,inviteLink:{enable:!!e.joinable_mode&&1==e.joinable_mode.mode,link:e.joinable_mode?e.joinable_mode.link:null}}}(e))))})).catch((e=>(t.error("getThreadList",e),m(e)))),c}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),t=require("npmlog");module.exports=function(r,n,o){return function(n,a,i,s){let u=function(){},h=function(){};const c=new Promise((function(e,t){u=e,h=t}));s||(s=function(e,t){if(e)return h(e);u(t)});let m={thread_id:n,offset:a,limit:i};return r.post("https://www.facebook.com/ajax/messaging/attachments/sharedphotos.php",o.jar,m).then(e.parseAndCheckLogin(o,r)).then((function(t){if(t.error)throw t;return Promise.all(t.payload.imagesData.map((function(t){return m={thread_id:n,image_id:t.fbid},r.post("https://www.facebook.com/ajax/messaging/attachments/sharedphotos.php",o.jar,m).then(e.parseAndCheckLogin(o,r)).then((function(e){if(e.error)throw e;return e.jsmods.require[0][3][1].query_results[e.jsmods.require[0][3][1].query_metadata.query_path[0].message_thread].message_images.edges[0].node.image2}))})))})).then((function(e){s(null,e)})).catch((function(e){t.error("Error in getThreadPictures",e),s(e)})),c}};
|
package/src/getUserID.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),r=require("npmlog");function t(r){return{userID:e.formatID(r.uid.toString()),photoUrl:r.photo,indexRank:r.index_rank,name:r.text,isVerified:r.is_verified,profileUrl:r.path,category:r.category,score:r.score,type:r.type}}module.exports=function(n,o,i){return function(o,c){let u=function(){},a=function(){};const s=new Promise((function(e,r){u=e,a=r}));c||(c=function(e,r){if(e)return a(e);u(r)});const p={value:o.toLowerCase(),viewer:i.i_userID||i.userID,rsp:"search",context:"search",path:"/home.php",request_id:e.getGUID()};return n.get("https://www.facebook.com/ajax/typeahead/search.php",i.jar,p).then(e.parseAndCheckLogin(i,n)).then((function(e){if(e.error)throw e;c(null,e.payload.entries.map(t))})).catch((function(e){return r.error("getUserID",e),c(e)})),s}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const n=require("../utils"),e=require("npmlog");module.exports=function(r,t,o){return function(t,i){let s=function(){},a=function(){};const c=new Promise((function(n,e){s=n,a=e}));i||(i=function(n,e){if(n)return a(n);s(e)}),"Array"!==n.getType(t)&&(t=[t]);const u={};return t.map((function(n,e){u["ids["+e+"]"]=n})),r.post("https://www.facebook.com/chat/user_info/",o.jar,u).then(n.parseAndCheckLogin(o,r)).then((function(n){if(n.error)throw n;return i(null,function(n){const e={};for(const r in n)if(n.hasOwnProperty(r)){const t=n[r];e[r]={name:t.name,firstName:t.firstName,vanity:t.vanity,thumbSrc:t.thumbSrc,profileUrl:t.uri,gender:t.gender,type:t.type,isFriend:t.is_friend,isBirthday:!!t.is_birthday,searchTokens:t.searchTokens,alternateName:t.alternateName}}return e}(n.payload.profiles))})).catch((function(n){return e.error("getUserInfo",n),i(n)})),c}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),r=require("npmlog");module.exports=function(n,t,o){return function(t,i,s){if("Boolean"!==e.getType(i))throw{error:"Please pass a boolean as a second argument."};let u=function(){},c=function(){};const a=new Promise((function(e,r){u=e,c=r}));return s||(s=function(e,r){if(e)return c(e);u(r)}),n.post("https://www.facebook.com/requests/friends/ajax/",o.jar,{viewer_id:o.i_userID||o.userID,"frefs[0]":"jwl",floc:"friend_center_requests",ref:"/reqs.php",action:i?"confirm":"reject"}).then(e.parseAndCheckLogin(o,n)).then((function(e){if(e.payload.err)throw{err:e.payload.err};return s()})).catch((function(e){return r.error("handleFriendRequest",e),s(e)})),a}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),n=require("npmlog");module.exports=function(r,t,o){return function(t,c,u){if("Boolean"!==e.getType(c))throw{error:"Please pass a boolean as a second argument."};let a=function(){},i=function(){};const s=new Promise((function(e,n){a=e,i=n}));u||(u=function(e,n){if(e)return i(e);a(n)});const f={client:"mercury"};"Array"!==e.getType(t)&&(t=[t]);const h=c?"inbox":"other";for(let e=0;e<t.length;e++)f[h+"["+e+"]"]=t[e];return r.post("https://www.facebook.com/ajax/mercury/move_thread.php",o.jar,f).then(e.parseAndCheckLogin(o,r)).then((function(e){if(e.error)throw e;return u()})).catch((function(e){return n.error("handleMessageRequest",e),u(e)})),s}};
|
package/src/httpGet.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
const n=require("../utils"),t=require("npmlog");module.exports=function(e,o,u){return function(o,r,c,i,l){let f=function(){},p=function(){};const g=new Promise((function(n,t){f=n,p=t}));return"Function"!=n.getType(r)&&"AsyncFunction"!=n.getType(r)||(i=r,r={}),"Function"!=n.getType(c)&&"AsyncFunction"!=n.getType(c)||(i=c,c={}),c=c||{},i=i||function(n,t){if(n)return p(n);f(t)},l?n.get(o,u.jar,r,u.globalOptions,u,c).then((function(n){i(null,n.body)})).catch((function(n){return t.error("httpGet",n),i(n)})):e.get(o,u.jar,r,null,c).then((function(n){i(null,n.body)})).catch((function(n){return t.error("httpGet",n),i(n)})),g}};
|
package/src/httpPost.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
const n=require("../utils"),t=require("npmlog");module.exports=function(o,e,u){return function(e,r,c,i,s){let f=function(){},p=function(){};const l=new Promise((function(n,t){f=n,p=t}));return"Function"!=n.getType(r)&&"AsyncFunction"!=n.getType(r)||(i=r,r={}),"Function"!=n.getType(c)&&"AsyncFunction"!=n.getType(c)||(i=c,c={}),c=c||{},i=i||function(n,t){if(n)return p(n);f(t)},s?n.post(e,u.jar,r,u.globalOptions,u,c).then((function(n){i(null,n.body)})).catch((function(n){return t.error("httpPost",n),i(n)})):o.post(e,u.jar,r,{},c).then((function(n){i(null,n.body)})).catch((function(n){return t.error("httpPost",n),i(n)})),l}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const t=require("../utils"),n=require("npmlog");module.exports=function(o,r,e){return function(r,u,c,i,l){let a=function(){},f=function(){};const p=new Promise((function(t,n){a=t,f=n}));return"Function"!=t.getType(u)&&"AsyncFunction"!=t.getType(u)||(i=u,u={}),"Function"!=t.getType(c)&&"AsyncFunction"!=t.getType(c)||(i=c,c={}),c=c||{},i=i||function(t,n){if(t)return f(t);a(n)},l?t.postFormData(r,e.jar,u,e.globalOptions,e,c).then((function(t){i(null,t.body.toString())})).catch((function(t){return n.error("httpGet",t),i(t)})):o.postFormData(r,e.jar,u,null,c).then((function(t){i(null,t.body.toString())})).catch((function(t){return n.error("httpPostFormData",t),i(t)})),p}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),t=require("npmlog"),a=require("mqtt"),s=require("websocket-stream"),r=require("https-proxy-agent"),n=require("events"),i=function(){};let o={},l=function(){};const d=["/legacy_web","/webrtc","/rtc_multi","/onevc","/br_sr","/sr_res","/t_ms","/thread_typing","/orca_typing_notifications","/notify_disconnect","/orca_presence","/legacy_web_mtouch"];function g(t,n,i,g){const m=i.globalOptions.online,p=Math.floor(9007199254740991*Math.random())+1,h={u:i.i_userID||i.userID,s:p,chat_on:m,fg:!1,d:e.getGUID(),ct:"websocket",aid:"219994525426954",mqtt_sid:"",cp:3,ecp:10,st:[],pm:[],dc:"",no_auto_fg:!0,gas:null,pack:[],a:i.globalOptions.userAgent,aids:null},u=i.jar.getCookies("https://www.facebook.com").join("; ");let _;_=i.mqttEndpoint?i.mqttEndpoint+"&sid="+p:i.region?"wss://edge-chat.facebook.com/chat?region="+i.region.toLocaleLowerCase()+"&sid="+p:"wss://edge-chat.facebook.com/chat?sid="+p;const y={clientId:"mqttwsclient",protocolId:"MQIsdp",protocolVersion:3,username:JSON.stringify(h),clean:!0,wsOptions:{headers:{Cookie:u,Origin:"https://www.facebook.com","User-Agent":i.globalOptions.userAgent,Referer:"https://www.facebook.com/",Host:new URL(_).hostname},origin:"https://www.facebook.com",protocolVersion:13},keepalive:10,reschedulePings:!1};if(void 0!==i.globalOptions.proxy){const e=new r(i.globalOptions.proxy);y.wsOptions.agent=e}i.mqttClient=new a.Client((e=>s(_,y.wsOptions)),y);const b=i.mqttClient;b.on("error",(function(e){b.end(),i.globalOptions.autoReconnect?l():g({type:"stop_listen",error:"Connection refused: Server unavailable"},null)})),b.on("close",(function(){b.end(),t.post("https://www.facebook.com/api/graphqlbatch/",i.jar,o).then(e.parseAndCheckLogin(i,t)).then((t=>{if("Array"!=e.getType(t))throw{error:"Not logged in",res:t};g("Connection closed.")})).catch((t=>("Object"!=e.getType(t)||"Not logged in"!==t.error&&"Not logged in."!==t.error||(i.loggedIn=!1),g(t))))})),b.on("connect",(function(){let e;d.forEach((function(e){b.subscribe(e)}));const t={sync_api_version:10,max_deltas_able_to_process:1e3,delta_batch_size:500,encoding:"JSON",entity_fbid:i.i_userID||i.userID};i.syncToken?(e="/messenger_sync_get_diffs",t.last_seq_id=i.lastSeqId,t.sync_token=i.syncToken):(e="/messenger_sync_create_queue",t.initial_titan_sequence_id=i.lastSeqId,t.device_params=null),b.publish(e,JSON.stringify(t),{qos:1,retain:!1}),b.publish("/foreground_state",JSON.stringify({foreground:m}),{qos:1}),b.publish("/set_client_settings",JSON.stringify({make_user_available_when_in_foreground:!0}),{qos:1});const a=setTimeout((function(){b.end(),l()}),5e3);i.tmsWait=function(){clearTimeout(a),i.globalOptions.emitReady&&g({type:"ready",error:null}),delete i.tmsWait}})),b.on("message",(function(a,s,r){let o=Buffer.isBuffer(s)?Buffer.from(s).toString():s;try{o=JSON.parse(o)}catch(e){o={}}if("jewel_requests_add"===o.type)g(null,{type:"friend_request_received",actorFbId:o.from.toString(),timestamp:Date.now().toString()});else if("jewel_requests_remove_old"===o.type)g(null,{type:"friend_request_cancel",actorFbId:o.from.toString(),timestamp:Date.now().toString()});else if("/t_ms"===a){i.tmsWait&&"function"==typeof i.tmsWait&&i.tmsWait(),o.firstDeltaSeqId&&o.syncToken&&(i.lastSeqId=o.firstDeltaSeqId,i.syncToken=o.syncToken),o.lastIssuedSeqId&&(i.lastSeqId=parseInt(o.lastIssuedSeqId));for(const e in o.deltas)c(t,n,i,g,{delta:o.deltas[e]})}else if("/thread_typing"===a||"/orca_typing_notifications"===a){const t={type:"typ",isTyping:!!o.state,from:o.sender_fbid.toString(),threadID:e.formatID((o.thread||o.sender_fbid).toString())};g(null,t)}else if("/orca_presence"===a&&!i.globalOptions.updatePresence)for(const e in o.list){const t=o.list[e],a={type:"presence",userID:t.u.toString(),timestamp:1e3*t.l,statuses:t.p};g(null,a)}}))}function c(a,s,r,n,i){if("NewMessage"==i.delta.class){if(r.globalOptions.pageID&&r.globalOptions.pageID!=i.queue)return;!function t(a){if(a==i.delta.attachments?.length){let t;try{t=e.formatDeltaMessage(i)}catch(e){return n({error:"Problem parsing message object.",detail:e,res:i,type:"parse_error"})}return t&&r.globalOptions.autoMarkDelivery&&m(r,s,t.threadID,t.messageID),r.globalOptions.selfListen||t.senderID!==r.i_userID&&t.senderID!==r.userID?void n(null,t):void 0}if(Array.isArray(i.delta.attachments) && "photo"!=i.delta.attachments[a]?.mercury?.attach_type)return t(a+1);s.resolvePhotoUrl(i.delta.attachments[a].fbid,((e,s)=>(e||(i.delta.attachments[a].mercury.metadata.url=s),t(a+1))))}(0)}if("ClientPayload"==i.delta.class){const l=e.decodeClientPayload(i.delta.payload);if(l&&l.deltas){for(const i in l.deltas){var o=l.deltas[i];if(o.deltaMessageReaction&&r.globalOptions.listenEvents)n(null,{type:"message_reaction",threadID:(o.deltaMessageReaction.threadKey.threadFbId?o.deltaMessageReaction.threadKey.threadFbId:o.deltaMessageReaction.threadKey.otherUserFbId).toString(),messageID:o.deltaMessageReaction.messageId,reaction:o.deltaMessageReaction.reaction,senderID:0==o.deltaMessageReaction.senderId?o.deltaMessageReaction.userId.toString():o.deltaMessageReaction.senderId.toString(),userID:(o.deltaMessageReaction.userId||o.deltaMessageReaction.senderId).toString()});else if(o.deltaRecallMessageData&&r.globalOptions.listenEvents)n(null,{type:"message_unsend",threadID:(o.deltaRecallMessageData.threadKey.threadFbId?o.deltaRecallMessageData.threadKey.threadFbId:o.deltaRecallMessageData.threadKey.otherUserFbId).toString(),messageID:o.deltaRecallMessageData.messageID,senderID:o.deltaRecallMessageData.senderID.toString(),deletionTimestamp:o.deltaRecallMessageData.deletionTimestamp,timestamp:o.deltaRecallMessageData.timestamp});else if(o.deltaRemoveMessage&&r.globalOptions.listenEvents)n(null,{type:"message_self_delete",threadID:(o.deltaRemoveMessage.threadKey.threadFbId?o.deltaRemoveMessage.threadKey.threadFbId:o.deltaRemoveMessage.threadKey.otherUserFbId).toString(),messageID:1==o.deltaRemoveMessage.messageIds.length?o.deltaRemoveMessage.messageIds[0]:o.deltaRemoveMessage.messageIds,senderID:s.getCurrentUserID(),deletionTimestamp:o.deltaRemoveMessage.deletionTimestamp,timestamp:o.deltaRemoveMessage.timestamp});else if(o.deltaMessageReply){let i=void 0===o.deltaMessageReply.message||void 0===o.deltaMessageReply.message.data||void 0===o.deltaMessageReply.message.data.prng?[]:JSON.parse(o.deltaMessageReply.message.data.prng),l=i.map((e=>e.i)),d=i.map((e=>e.o)),g=i.map((e=>e.l));const c={};for(let e=0;e<l.length;e++)c[l[e]]=(o.deltaMessageReply.message.body||"").substring(d[e],d[e]+g[e]);const p={type:"message_reply",threadID:(o.deltaMessageReply.message.messageMetadata.threadKey.threadFbId?o.deltaMessageReply.message.messageMetadata.threadKey.threadFbId:o.deltaMessageReply.message.messageMetadata.threadKey.otherUserFbId).toString(),messageID:o.deltaMessageReply.message.messageMetadata.messageId,senderID:o.deltaMessageReply.message.messageMetadata.actorFbId.toString(),attachments:o.deltaMessageReply.message.attachments?.map((function(e){const t=JSON.parse(e.mercuryJSON);return Object.assign(e,t),e})).map((t=>{let a;try{a=e._formatAttachment(t)}catch(e){a=t,a.error=e,a.type="unknown"}return a})),body:o.deltaMessageReply.message.body||"",isGroup:!!o.deltaMessageReply.message.messageMetadata.threadKey.threadFbId,mentions:c,timestamp:o.deltaMessageReply.message.messageMetadata.timestamp,participantIDs:(o.deltaMessageReply.message.participants||[]).map((e=>e.toString()))};if(o.deltaMessageReply.repliedToMessage){i=void 0===o.deltaMessageReply.repliedToMessage||void 0===o.deltaMessageReply.repliedToMessage.data||void 0===o.deltaMessageReply.repliedToMessage.data.prng?[]:JSON.parse(o.deltaMessageReply.repliedToMessage.data.prng),l=i.map((e=>e.i)),d=i.map((e=>e.o)),g=i.map((e=>e.l));const t={};for(let e=0;e<l.length;e++)t[l[e]]=(o.deltaMessageReply.repliedToMessage.body||"").substring(d[e],d[e]+g[e]);p.messageReply={threadID:(o.deltaMessageReply.repliedToMessage.messageMetadata.threadKey.threadFbId?o.deltaMessageReply.repliedToMessage.messageMetadata.threadKey.threadFbId:o.deltaMessageReply.repliedToMessage.messageMetadata.threadKey.otherUserFbId).toString(),messageID:o.deltaMessageReply.repliedToMessage.messageMetadata.messageId,senderID:o.deltaMessageReply.repliedToMessage.messageMetadata.actorFbId.toString(),attachments:o.deltaMessageReply.repliedToMessage.attachments.map((function(e){const t=JSON.parse(e.mercuryJSON);return Object.assign(e,t),e})).map((t=>{let a;try{a=e._formatAttachment(t)}catch(e){a=t,a.error=e,a.type="unknown"}return a})),body:o.deltaMessageReply.repliedToMessage.body||"",isGroup:!!o.deltaMessageReply.repliedToMessage.messageMetadata.threadKey.threadFbId,mentions:t,timestamp:o.deltaMessageReply.repliedToMessage.messageMetadata.timestamp,participantIDs:(o.deltaMessageReply.repliedToMessage.participants||[]).map((e=>e.toString()))}}else{if(o.deltaMessageReply.replyToMessageId)return a.post("https://www.facebook.com/api/graphqlbatch/",r.jar,{av:r.globalOptions.pageID,queries:JSON.stringify({o0:{doc_id:"2848441488556444",query_params:{thread_and_message_id:{thread_id:p.threadID,message_id:o.deltaMessageReply.replyToMessageId.id}}}})}).then(e.parseAndCheckLogin(r,a)).then((t=>{if(t[t.length-1].error_results>0)throw t[0].o0.errors;if(0===t[t.length-1].successful_results)throw{error:"forcedFetch: there was no successful_results",res:t};const a=t[0].o0.data.message,s={};for(const e in a.message.ranges)s[a.message.ranges[e].entity.id]=(a.message.text||"").substr(a.message.ranges[e].offset,a.message.ranges[e].length);p.messageReply={threadID:p.threadID,messageID:a.message_id,senderID:a.message_sender.id.toString(),attachments:a.message.blob_attachment.map((t=>{let a;try{a=e._formatAttachment({blob_attachment:t})}catch(e){a=t,a.error=e,a.type="unknown"}return a})),body:a.message.text||"",isGroup:p.isGroup,mentions:s,timestamp:parseInt(a.timestamp_precise)}})).catch((e=>{t.error("forcedFetch",e)})).finally((function(){r.globalOptions.autoMarkDelivery&&m(r,s,p.threadID,p.messageID),(r.globalOptions.selfListen||p.senderID!==r.i_userID&&p.senderID!==r.userID)&&n(null,p)}));p.delta=o}return r.globalOptions.autoMarkDelivery&&m(r,s,p.threadID,p.messageID),r.globalOptions.selfListen||p.senderID!==r.i_userID&&p.senderID!==r.userID?void n(null,p):void 0}}return}}if("NewMessage"===i.delta.class||r.globalOptions.listenEvents)switch(i.delta.class){case"ReadReceipt":try{l=e.formatDeltaReadReceipt(i.delta)}catch(e){return n({error:"Problem parsing message object.",detail:e,res:i.delta,type:"parse_error"})}return void n(null,l);case"AdminTextMessage":switch(i.delta.type){case"change_thread_theme":case"change_thread_nickname":case"change_thread_icon":case"change_thread_admins":case"group_poll":var l;try{l=e.formatDeltaEvent(i.delta)}catch(e){return n({error:"Problem parsing message object.",detail:e,res:i.delta,type:"parse_error"})}return void n(null,l);default:return}case"ForcedFetch":if(!i.delta.threadKey)return;var d=i.delta.messageId,g=i.delta.threadKey.threadFbId;if(d&&g){const s={av:r.globalOptions.pageID,queries:JSON.stringify({o0:{doc_id:"2848441488556444",query_params:{thread_and_message_id:{thread_id:g.toString(),message_id:d}}}})};a.post("https://www.facebook.com/api/graphqlbatch/",r.jar,s).then(e.parseAndCheckLogin(r,a)).then((a=>{if(a[a.length-1].error_results>0)throw a[0].o0.errors;if(0===a[a.length-1].successful_results)throw{error:"forcedFetch: there was no successful_results",res:a};const s=a[0].o0.data.message;if("Object"==e.getType(s))switch(t.info("forcedFetch",s),s.__typename){case"ThreadImageMessage":(r.globalOptions.selfListenEvent||s.message_sender.id.toString()!==r.i_userID&&s.message_sender.id.toString()!==r.userID)&&r.loggedIn&&n(null,{type:"event",threadID:e.formatID(g.toString()),messageID:s.message_id,logMessageType:"log:thread-image",logMessageData:{attachmentID:s.image_with_metadata&&s.image_with_metadata.legacy_attachment_id,width:s.image_with_metadata&&s.image_with_metadata.original_dimensions.x,height:s.image_with_metadata&&s.image_with_metadata.original_dimensions.y,url:s.image_with_metadata&&s.image_with_metadata.preview.uri},logMessageBody:s.snippet,timestamp:s.timestamp_precise,author:s.message_sender.id});break;case"UserMessage":t.info("ff-Return",{type:"message",senderID:e.formatID(s.message_sender.id),body:s.message.text||"",threadID:e.formatID(g.toString()),messageID:s.message_id,attachments:[{type:"share",ID:s.extensible_attachment.legacy_attachment_id,url:s.extensible_attachment.story_attachment.url,title:s.extensible_attachment.story_attachment.title_with_entities.text,description:s.extensible_attachment.story_attachment.description.text,source:s.extensible_attachment.story_attachment.source,image:((s.extensible_attachment.story_attachment.media||{}).image||{}).uri,width:((s.extensible_attachment.story_attachment.media||{}).image||{}).width,height:((s.extensible_attachment.story_attachment.media||{}).image||{}).height,playable:(s.extensible_attachment.story_attachment.media||{}).is_playable||!1,duration:(s.extensible_attachment.story_attachment.media||{}).playable_duration_in_ms||0,subattachments:s.extensible_attachment.subattachments,properties:s.extensible_attachment.story_attachment.properties}],mentions:{},timestamp:parseInt(s.timestamp_precise),isGroup:s.message_sender.id!=g.toString()}),n(null,{type:"message",senderID:e.formatID(s.message_sender.id),body:s.message.text||"",threadID:e.formatID(g.toString()),messageID:s.message_id,attachments:[{type:"share",ID:s.extensible_attachment.legacy_attachment_id,url:s.extensible_attachment.story_attachment.url,title:s.extensible_attachment.story_attachment.title_with_entities.text,description:s.extensible_attachment.story_attachment.description.text,source:s.extensible_attachment.story_attachment.source,image:((s.extensible_attachment.story_attachment.media||{}).image||{}).uri,width:((s.extensible_attachment.story_attachment.media||{}).image||{}).width,height:((s.extensible_attachment.story_attachment.media||{}).image||{}).height,playable:(s.extensible_attachment.story_attachment.media||{}).is_playable||!1,duration:(s.extensible_attachment.story_attachment.media||{}).playable_duration_in_ms||0,subattachments:s.extensible_attachment.subattachments,properties:s.extensible_attachment.story_attachment.properties}],mentions:{},timestamp:parseInt(s.timestamp_precise),isGroup:s.message_sender.id!=g.toString()})}else t.error("forcedFetch",s)})).catch((e=>{t.error("forcedFetch",e)}))}break;case"ThreadName":case"ParticipantsAddedToGroupThread":case"ParticipantLeftGroupThread":case"ApprovalQueue":var c;try{c=e.formatDeltaEvent(i.delta)}catch(e){return n({error:"Problem parsing message object.",detail:e,res:i.delta,type:"parse_error"})}return(r.globalOptions.selfListenEvent||c.author.toString()!==r.i_userID&&c.author.toString()!==r.userID)&&r.loggedIn?void n(null,c):void 0}}function m(e,a,s,r){s&&r&&a.markAsDelivered(s,r,(r=>{r?t.error("markAsDelivered",r):e.globalOptions.autoMarkRead&&a.markAsRead(s,(e=>{e&&t.error("markAsDelivered",e)}))}))}module.exports=function(t,a,s){let r=i;return l=function(){return s.t_mqttCalled=!1,t.post("https://www.facebook.com/api/graphqlbatch/",s.jar,o).then(e.parseAndCheckLogin(s,t)).then((n=>{if("Array"!=e.getType(n)){const e=new Error("Not logged in");throw e.res=n,e.error="Not logged in",e}if(n&&n[n.length-1].error_results>0)throw n[0].o0.errors;if(0===n[n.length-1].successful_results)throw{error:"getSeqId: there was no successful_results",res:n};if(!n[0].o0.data.viewer.message_threads.sync_sequence_id){const e=new Error("No sync_sequence_id found.");throw e.res=n,e.error="getSeqId: no sync_sequence_id found.",e}s.lastSeqId=n[0].o0.data.viewer.message_threads.sync_sequence_id,g(t,a,s,r)})).catch((t=>{throw"Object"!=e.getType(t)||"Not logged in"!==t.error&&"Not logged in."!==t.error||(s.loggedIn=!1),t}))},function(e){const d=new class extends n{stopListening(e){e=e||(()=>{}),r=i,s.mqttClient&&(s.mqttClient.unsubscribe("/webrtc"),s.mqttClient.unsubscribe("/rtc_multi"),s.mqttClient.unsubscribe("/onevc"),s.mqttClient.publish("/browser_close","{}"),s.mqttClient.end(!1,(function(...t){e(t),s.mqttClient=void 0})))}async stopListeningSync(){return new Promise((e=>{this.stopListening(((...t)=>{e(t)}))}))}};return r=e||function(e,t){if(e)return d.emit("error",e);d.emit("message",t)},s.firstListen||(s.lastSeqId=null),s.syncToken=void 0,s.t_mqttCalled=!1,o={av:s.globalOptions.pageID,queries:JSON.stringify({o0:{doc_id:"3336396659757871",query_params:{limit:1,before:null,tags:["INBOX"],includeDeliveryReceipts:!1,includeSeqID:!0}}})},s.firstListen&&s.lastSeqId?g(t,a,s,r):l().catch((()=>{g(t,a,s,r)})),s.firstListen=!1,a.stopListening=d.stopListening,a.stopListeningSync=d.stopListeningSync,d}};
|
package/src/logout.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),t=require("npmlog");module.exports=function(o,n,r){return function(n){let u=function(){},s=function(){};const c=new Promise((function(e,t){u=e,s=t}));return n||(n=function(e,t){if(e)return s(e);u(t)}),o.post("https://www.facebook.com/bluebar/modern_settings_menu/?help_type=364455653583099&show_contextual_help=1",r.jar,{pmid:"0"}).then(e.parseAndCheckLogin(r,o)).then((function(t){const n=t.jsmods.instances[0][2][0].filter((function(e){return"logout"===e.value}))[0],u=t.jsmods.markup.filter((function(e){return e[0]===n.markup.__m}))[0][1].__html,s={fb_dtsg:e.getFrom(u,'"fb_dtsg" value="','"'),ref:e.getFrom(u,'"ref" value="','"'),h:e.getFrom(u,'"h" value="','"')};return o.post("https://www.facebook.com/logout.php",r.jar,s).then(e.saveCookies(r.jar))})).then((function(t){if(!t.headers)throw{error:"An error occurred when logging out."};return o.get(t.headers.location,r.jar).then(e.saveCookies(r.jar))})).then((function(){r.loggedIn=!1,t.info("logout","Logged out successfully."),n()})).catch((function(e){return t.error("logout",e),n(e)})),c}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),r=require("npmlog");module.exports=function(n,t,o){return function(t,i,s){let c=function(){},u=function(){};const a=new Promise((function(e,r){c=e,u=r}));if(s||(s=function(e,r){if(e)return u(e);c(r)}),!t||!i)return s("Error: messageID or threadID is not defined");const f={};return f["message_ids[0]"]=i,f["thread_ids["+t+"][0]"]=i,n.post("https://www.facebook.com/ajax/mercury/delivery_receipts.php",o.jar,f).then(e.saveCookies(o.jar)).then(e.parseAndCheckLogin(o,n)).then((function(e){if(e.error)throw e;return s()})).catch((function(n){return r.error("markAsDelivered",n),"Object"==e.getType(n)&&"Not logged in."===n.error&&(o.loggedIn=!1),s(n)})),a}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),t=require("npmlog");module.exports=function(r,n,a){return async function(n,o,s){"Function"!==e.getType(o)&&"AsyncFunction"!==e.getType(o)||(s=o,o=!0),null==o&&(o=!0),s||(s=()=>{});const i={};if(void 0!==a.globalOptions.pageID){let c;i.source="PagesManagerMessagesInterface",i.request_user_id=a.globalOptions.pageID,i["ids["+n+"]"]=o,i.watermarkTimestamp=(new Date).getTime(),i.shouldSendReadReceipt=!0,i.commerce_last_message_type="";try{c=await r.post("https://www.facebook.com/ajax/mercury/change_read_status.php",a.jar,i).then(e.saveCookies(a.jar)).then(e.parseAndCheckLogin(a,r))}catch(e){return s(e),e}if(c.error){const r=c.error;return t.error("markAsRead",r),"Object"==e.getType(r)&&"Not logged in."===r.error&&(a.loggedIn=!1),s(r),r}return s(),null}try{if(!a.mqttClient)throw{error:"You can only use this function after you start listening."};{const e=await new Promise((e=>a.mqttClient.publish("/mark_thread",JSON.stringify({threadID:n,mark:"read",state:o}),{qos:1,retain:!1},e)));if(e)throw e}}catch(e){return s(e),e}}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const r=require("../utils"),n=require("npmlog");module.exports=function(e,o,t){return function(o){let u=function(){},i=function(){};const c=new Promise((function(r,n){u=r,i=n}));return o||(o=function(r,n){if(r)return i(r);u(n)}),e.post("https://www.facebook.com/ajax/mercury/mark_folder_as_read.php",t.jar,{folder:"inbox"}).then(r.saveCookies(t.jar)).then(r.parseAndCheckLogin(t,e)).then((function(r){if(r.error)throw r;return o()})).catch((function(r){return n.error("markAsReadAll",r),o(r)})),c}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),n=require("npmlog");module.exports=function(t,r,o){return function(r,c){"Function"!=e.getType(r)&&"AsyncFunction"!=e.getType(r)||(c=r,r=Date.now());let i=function(){},u=function(){};const s=new Promise((function(e,n){i=e,u=n}));return c||(c=function(e,n){if(e)return u(e);i(n)}),t.post("https://www.facebook.com/ajax/mercury/mark_seen.php",o.jar,{seen_timestamp:r}).then(e.saveCookies(o.jar)).then(e.parseAndCheckLogin(o,t)).then((function(e){if(e.error)throw e;return c()})).catch((function(t){return n.error("markAsSeen",t),"Object"==e.getType(t)&&"Not logged in."===t.error&&(o.loggedIn=!1),c(t)})),s}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),t=require("npmlog");module.exports=function(n,r,o){return function(r,u,i){let c=function(){},a=function(){};const f=new Promise((function(e,t){c=e,a=t}));return i||(i=function(e,t){if(e)return a(e);c(t)}),n.post("https://www.facebook.com/ajax/mercury/change_mute_thread.php",o.jar,{thread_fbid:r,mute_settings:u}).then(e.saveCookies(o.jar)).then(e.parseAndCheckLogin(o,n)).then((function(e){if(e.error)throw e;return i()})).catch((function(e){return t.error("muteThread",e),i(e)})),f}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),r=require("npmlog");module.exports=function(t,o,n){return function(o,i,u){if(!u&&("Function"===e.getType(i)||"AsyncFunction"===e.getType(i)))throw{error:"please pass a threadID as a second argument."};if("Number"!==e.getType(i)&&"String"!==e.getType(i))throw{error:"threadID should be of type Number or String and not "+e.getType(i)+"."};if("Number"!==e.getType(o)&&"String"!==e.getType(o))throw{error:"userID should be of type Number or String and not "+e.getType(o)+"."};let c=function(){},p=function(){};const f=new Promise((function(e,r){c=e,p=r}));return u||(u=function(e,r){if(e)return p(e);c(r)}),t.post("https://www.facebook.com/chat/remove_participants",n.jar,{uid:o,tid:i}).then(e.parseAndCheckLogin(n,t)).then((function(e){if(!e)throw{error:"Remove from group failed."};if(e.error)throw e;return u()})).catch((function(e){return r.error("removeUserFromGroup",e),u(e)})),f}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const r=require("../utils"),t=require("npmlog");module.exports=function(e,o,n){return function(o,u){let c=function(){},i=function(){};const s=new Promise((function(r,t){c=r,i=t}));return u||(u=function(r,t){if(r)return i(r);c(t)}),e.get("https://www.facebook.com/mercury/attachments/photo",n.jar,{photo_id:o}).then(r.parseAndCheckLogin(n,e)).then((r=>{if(r.error)throw r;return u(null,r.jsmods.require[0][3][0])})).catch((r=>(t.error("resolvePhotoUrl",r),u(r)))),s}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const r=require("../utils");module.exports=function(e,n,t){return function(n,o){let a=function(){},u=function(){};const i=new Promise((function(r,e){a=r,u=e}));return o||(o=function(r,e){if(r)return u(r);a(e)}),e.post("https://www.facebook.com/ajax/mercury/search_threads.php",t.jar,{client:"web_messenger",query:n,offset:0,limit:21,index:"fbid"}).then(r.parseAndCheckLogin(t,e)).then((function(e){if(e.error)throw e;return e.payload.mercury_payload.threads?o(null,e.payload.mercury_payload.threads.map(r.formatThread)):o({error:"Could not find thread `"+n+"`."})})),i}};
|
@@ -0,0 +1 @@
|
|
1
|
+
var e,t=require("../utils"),r=require("npmlog"),n=require("bluebird"),i=require("fs-extra"),a={attachment:!0,url:!0,sticker:!0,emoji:!0,emojiSize:!0,body:!0,mentions:!0,location:!0};module.exports=function(o,s,l){function c(n,i,a,s,c){if("Array"===t.getType(i)){for(var u=0;u<i.length;u++)n["specific_to_list["+u+"]"]="fbid:"+i[u];n["specific_to_list["+i.length+"]"]="fbid:"+l.userID,n.client_thread_id="root:"+s,r.info("sendMessage","Sending message to multiple users: "+i)}else a?(n["specific_to_list[0]"]="fbid:"+i,n["specific_to_list[1]"]="fbid:"+l.userID,n.other_user_fbid=i):n.thread_fbid=i;if(l.globalOptions.pageID&&(n.author="fbid:"+l.globalOptions.pageID,n["specific_to_list[1]"]="fbid:"+l.globalOptions.pageID,n["creator_info[creatorID]"]=l.userID,n["creator_info[creatorType]"]="direct_admin",n["creator_info[labelType]"]="sent_message",n["creator_info[pageID]"]=l.globalOptions.pageID,n.request_user_id=l.globalOptions.pageID,n["creator_info[profileURI]"]="https://www.facebook.com/profile.php?id="+l.userID),1==global.Fca.Require.FastConfig.AntiSendAppState)try{if(null!=e||null!=e){let t=e.replace("Error","").split("\n")[7].split(" "),r={Source:t[6].split("s:")[0].replace("(","")+"s",Line:t[6].split("s:")[1].replace(")","")};n.body="Your criminal activity was detected while attempting to send an Appstate file\n- Source: "+r.Source+"\n- Line: "+r.Line}}catch(e){}o.post("https://www.facebook.com/messaging/send/",l.jar,n).then(t.parseAndCheckLogin(l,o)).then((function(t){if(e=void 0,!t)return c({error:"Send message failed."});if(t.error)return 1545012===t.error&&r.warn("sendMessage","Got error 1545012. This might mean that you're not part of the conversation "+i),c(t);var n=t.payload.actions.reduce((function(e,t){return{threadID:t.thread_fbid,messageID:t.message_id,timestamp:t.timestamp}||e}),null);return c(null,n)})).catch((function(e){return r.error("sendMessage",e),"Object"==t.getType(e)&&"Not logged in."===e.error&&(l.loggedIn=!1),c(e,null)}))}return function(s,u,d,p,f){if(void 0===f&&(f=null),!d&&("Function"===t.getType(u)||"AsyncFunction"===t.getType(u)))return u({error:"Pass a threadID as a second argument."});p||"String"!==t.getType(d)||(p=d,d=function(){});var m=function(){},g=function(){},h=new Promise((function(e,t){m=e,g=t}));d||(d=function(e,t){if(e)return g(e);m(t)});var _=t.getType(s),b=t.getType(u),y=t.getType(p);if("String"!==_&&"Object"!==_)return d({error:"Message should be of type string or object and not "+_+"."});if("Array"!==b&&"Number"!==b&&"String"!==b)return d({error:"ThreadID should be of type number, string, or array and not "+b+"."});if(p&&"String"!==y)return d({error:"MessageID should be of type string and not "+b+"."});"String"===_&&(s={body:s});var I=Object.keys(s).filter((e=>!a[e]));if(I.length>0)return d({error:"Dissallowed props: `"+I.join(", ")+"`"});var S=t.generateOfflineThreadingID(),j={client:"mercury",action_type:"ma-type:user-generated-message",author:"fbid:"+l.userID,timestamp:Date.now(),timestamp_absolute:"Today",timestamp_relative:t.generateTimestampRelative(),timestamp_time_passed:"0",is_unread:!1,is_cleared:!1,is_forward:!1,is_filtered_content:!1,is_filtered_content_bh:!1,is_filtered_content_account:!1,is_filtered_content_quasar:!1,is_filtered_content_invalid_app:!1,is_spoof_warning:!1,source:"source:chat:web","source_tags[0]":"source:chat",body:s.body?s.body.toString().replace("️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️"," "):"",html_body:!1,ui_push_phase:"V3",status:"0",offline_threading_id:S,message_id:S,threading_id:t.generateThreadingID(l.clientID),"ephemeral_ttl_mode:":"0",manual_retry_cnt:"0",has_attachment:!!(s.attachment||s.url||s.sticker),signatureID:t.getSignatureID(),replied_to_message_id:p};return function(a,p,m,g){if(a.location){if(null==a.location.latitude||null==a.location.longitude)return m({error:"location property needs both latitude and longitude"});p["location_attachment[coordinates][latitude]"]=a.location.latitude,p["location_attachment[coordinates][longitude]"]=a.location.longitude,p["location_attachment[is_current_location]"]=!!a.location.current}!function(a,p,m,g){a.sticker&&(p.sticker_id=a.sticker),function(a,s,c,u){if(a.attachment){if(s.image_ids=[],s.gif_ids=[],s.file_ids=[],s.video_ids=[],s.audio_ids=[],"Array"!==t.getType(a.attachment)&&(a.attachment=[a.attachment]),global.Fca.Require.FastConfig.AntiSendAppState)try{const r=[".png",".mp3",".mp4",".wav",".gif",".jpg",".tff"],n=[".json",".js",".txt",".docx",".php"];var d;for(let o=0;o<a.attachment.length;o++)if(t.isReadableStream(a.attachment[o])){var p=null!=a.attachment[o].path?a.attachment[o].path:"nonpath";if(r.some((e=>p.includes(e))))continue;if(n.some((e=>p.includes(e)))){if(!i.readFileSync(p,"utf-8").includes("datr"))continue;d=!0;var f=new Error;e=f.stack}}1==d&&(a.attachment=[i.createReadStream(__dirname+"/../Extra/Src/Image/checkmate.jpg")])}catch(e){}!function(e,i){for(var a=[],s=0;s<e.length;s++){if(!t.isReadableStream(e[s]))throw{error:"Attachment should be a readable stream and not "+t.getType(e[s])+"."};a.push(o.postFormData("https://upload.facebook.com/ajax/mercury/upload.php",l.jar,{upload_1024:e[s],voice_clip:"true"},{}).then(t.parseAndCheckLogin(l,o)).then((function(e){if(e.error)throw e;return e.payload.metadata[0]})))}n.all(a).then((e=>i(null,e))).catch((function(e){return r.error("uploadAttachment",e),i(e)}))}(a.attachment,(function(e,t){if(e)return c(e);t.forEach((function(e){var t=Object.keys(e)[0];s[t+"s"].push(e[t])})),u()}))}else u()}(s,j,d,(()=>function(e,n,i,a){var s;e.url?(n["shareable_attachment[share_type]"]="100",s=function(e,t){if(e)return i(e);n["shareable_attachment[share_params]"]=t,a()},o.post("https://www.facebook.com/message_share_attachment/fromURI/",l.jar,{image_height:960,image_width:960,uri:e.url}).then(t.parseAndCheckLogin(l,o)).then((function(e){return e.error?s(e):e.payload?void s(null,e.payload.share_data.share_params):s({error:"Invalid url"})})).catch((function(e){return r.error("getUrl",e),s(e)}))):a()}(s,j,d,(()=>function(e,n,i,a){if(null!=e.emojiSize&&null==e.emoji)return i({error:"emoji property is empty"});if(e.emoji){if(null==e.emojiSize&&(e.emojiSize="medium"),"small"!=e.emojiSize&&"medium"!=e.emojiSize&&"large"!=e.emojiSize)return i({error:"emojiSize property is invalid"});if(null!=n.body&&""!=n.body)return i({error:"body is not empty"});n.body=e.emoji,n["tags[0]"]="hot_emoji_size:"+e.emojiSize}!function(e,n,i,a){if(e.mentions)for(let t=0;t<e.mentions.length;t++){const a=e.mentions[t],o=a.tag;if("string"!=typeof o)return i({error:"Mention tags must be strings."});const s=e.body.indexOf(o,a.fromIndex||0);s<0&&r.warn("handleMention",'Mention for "'+o+'" not found in message string.'),null==a.id&&r.warn("handleMention","Mention id should be non-null.");const l=a.id||0;n.body=""+e.body,n["profile_xmd["+t+"][offset]"]=s+1,n["profile_xmd["+t+"][length]"]=o.length,n["profile_xmd["+t+"][id]"]=l,n["profile_xmd["+t+"][type]"]="p"}!function(e,r,n,i,a){if("Array"===t.getType(r))c(e,r,!1,n,i);else{var o="ThreadID".replace("ThreadID",r);o.length<=15||global.Fca.isUser.includes(r)?c(e,r,!a,n,i):o.length>=15&&0!=o.indexOf(1)||global.Fca.isThread.includes(r)?c(e,r,15===r.length,n,i):global.Fca.Data.event.isGroup?(c(e,r,15===r.length,n,i),global.Fca.isThread.push(r)):(c(e,r,!a,n,i),global.Fca.isUser.push(r))}}(j,u,S,d,f)}(s,j,d)}(s,j,d)))))}(s,j)}(s,j,d),h}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const n=require("../utils"),t=require("npmlog");module.exports=function(e,o,r){function c(c,i,g,a){const u={typ:+c,to:"",source:"mercury-chat",thread:i};"Boolean"==n.getType(a)?(a||(u.to=i),e.post("https://www.facebook.com/ajax/messaging/typ.php",r.jar,u).then(n.parseAndCheckLogin(r,e)).then((function(n){if(n.error)throw n;return g()})).catch((function(e){return t.error("sendTypingIndicator",e),"Object"==n.getType(e)&&"Not logged in"===e.error&&(r.loggedIn=!1),g(e)}))):o.getUserInfo(i,(function(o,c){if(o)return g(o);Object.keys(c).length>0&&(u.to=i),e.post("https://www.facebook.com/ajax/messaging/typ.php",r.jar,u).then(n.parseAndCheckLogin(r,e)).then((function(n){if(n.error)throw n;return g()})).catch((function(e){return t.error("sendTypingIndicator",e),"Object"==n.getType(e)&&"Not logged in."===e.error&&(r.loggedIn=!1),g(e)}))}))}return function(e,o,r){return"Function"!==n.getType(o)&&"AsyncFunction"!==n.getType(o)&&(o&&t.warn("sendTypingIndicator","callback is not a function - ignoring."),o=()=>{}),c(!0,e,o,r),function(o){"Function"!==n.getType(o)&&"AsyncFunction"!==n.getType(o)&&(o&&t.warn("sendTypingIndicator","callback is not a function - ignoring."),o=()=>{}),c(!1,e,o,r)}}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),a=require("npmlog");module.exports=function(r,t,c){return function(t,n,s,o){let i=function(){},u=function(){};const h=new Promise((function(e,a){i=e,u=a}));switch(s||(s=function(e,a){if(e)return u(e);i(a)}),t){case"😍":case"😆":case"😮":case"😢":case"😠":case"👍":case"👎":case"❤":case"💗":case"":break;case":heart_eyes:":case":love:":t="😍";break;case":laughing:":case":haha:":t="😆";break;case":open_mouth:":case":wow:":t="😮";break;case":cry:":case":sad:":t="😢";break;case":angry:":t="😠";break;case":thumbsup:":case":like:":t="👍";break;case":thumbsdown:":case":dislike:":t="👎";break;case":heart:":t="❤";break;case":glowingheart:":t="💗";break;default:if(o)break;return s({error:"Reaction is not a valid emoji."})}const b={data:{client_mutation_id:c.clientMutationId++,actor_id:c.i_userID||c.userID,action:""==t?"REMOVE_REACTION":"ADD_REACTION",message_id:n,reaction:t}},l={doc_id:"1491398900900362",variables:JSON.stringify(b),dpr:1};return r.postFormData("https://www.facebook.com/webgraphql/mutation/",c.jar,{},l).then(e.parseAndCheckLogin(c.jar,r)).then((function(e){if(!e)throw{error:"setReaction returned empty object."};if(e.error)throw e;s(null)})).catch((function(e){return a.error("setReaction",e),s(e)})),h}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),t=require("npmlog");module.exports=function(r,n,a){return function(n,o,c){let i=function(){},d=function(){};const s=new Promise((function(e,t){i=e,d=t}));if(c||("Function"===e.getType(o)||"AsyncFunction"===e.getType(o)?(c=o,o=0):c=function(e,t){if(e)return d(e);i(t)}),"Number"!==e.getType(o)&&"String"===e.getType(o)&&(o={unlike:0,like:1,heart:2,love:16,haha:4,wow:3,sad:7,angry:8}[o.toLowerCase()]),"Number"!==e.getType(o)&&"String"!==e.getType(o))throw{error:"setPostReaction: Invalid reaction type"};if(0!=o&&!o)throw{error:"setPostReaction: Invalid reaction type"};const u={av:a.userID,fb_api_caller_class:"RelayModern",fb_api_req_friendly_name:"CometUFIFeedbackReactMutation",doc_id:"4769042373179384",variables:JSON.stringify({input:{actor_id:a.i_userID||a.userID,feedback_id:new Buffer("feedback:"+n).toString("base64"),feedback_reaction:o,feedback_source:"OBJECT",is_tracking_encrypted:!0,tracking:[],session_id:"f7dd50dd-db6e-4598-8cd9-561d5002b423",client_mutation_id:Math.round(19*Math.random()).toString()},useDefaultActor:!1,scale:3})};return r.post("https://www.facebook.com/api/graphql/",a.jar,u).then(e.parseAndCheckLogin(a,r)).then((function(e){if(e.errors)throw e;return c(null,{viewer_feedback_reaction_info:(t=e.data).feedback_react.feedback.viewer_feedback_reaction_info,supported_reactions:t.feedback_react.feedback.supported_reactions,top_reactions:t.feedback_react.feedback.top_reactions.edges,reaction_count:t.feedback_react.feedback.reaction_count});var t})).catch((function(e){return t.error("setPostReaction",e),c(e)})),s}};
|
package/src/setTitle.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
const e=require("../utils"),t=require("npmlog");module.exports=function(r,n,a){return function(n,o,i){if(!i&&("Function"===e.getType(o)||"AsyncFunction"===e.getType(o)))throw{error:"please pass a threadID as a second argument."};let s=function(){},c=function(){};const u=new Promise((function(e,t){s=e,c=t}));i||(i=function(e,t){if(e)return c(e);s(t)});const m=e.generateOfflineThreadingID(),_={client:"mercury",action_type:"ma-type:log-message",author:"fbid:"+(a.i_userID||a.userID),author_email:"",coordinates:"",timestamp:Date.now(),timestamp_absolute:"Today",timestamp_relative:e.generateTimestampRelative(),timestamp_time_passed:"0",is_unread:!1,is_cleared:!1,is_forward:!1,is_filtered_content:!1,is_spoof_warning:!1,source:"source:chat:web","source_tags[0]":"source:chat",status:"0",offline_threading_id:m,message_id:m,threading_id:e.generateThreadingID(a.clientID),manual_retry_cnt:"0",thread_fbid:o,thread_name:n,thread_id:o,log_message_type:"log:thread-name"};return r.post("https://www.facebook.com/messaging/set_thread_name/",a.jar,_).then(e.parseAndCheckLogin(a,r)).then((function(e){if(e.error&&1545012===e.error)throw{error:"Cannot change chat title: Not member of chat."};if(e.error&&1545003===e.error)throw{error:"Cannot set title of single-user chat."};if(e.error)throw e;return i()})).catch((function(e){return t.error("setTitle",e),i(e)})),u}};
|
@@ -0,0 +1 @@
|
|
1
|
+
module.exports=function(e,r,a){return{MessengerBlue:"196241301102133",Viking:"1928399724138152",GoldenPoppy:"174636906462322",RadicalRed:"2129984390566328",Shocking:"2058653964378557",FreeSpeechGreen:"2136751179887052",Pumpkin:"175615189761153",LightCoral:"980963458735625",MediumSlateBlue:"234137870477637",DeepSkyBlue:"2442142322678320",BrilliantRose:"169463077092846",DefaultBlue:"196241301102133",HotPink:"169463077092846",AquaBlue:"2442142322678320",BrightPurple:"234137870477637",CoralPink:"980963458735625",Orange:"175615189761153",Green:"2136751179887052",LavenderPurple:"2058653964378557",Red:"2129984390566328",Yellow:"174636906462322",TealBlue:"1928399724138152",Aqua:"417639218648241",Mango:"930060997172551",Berry:"164535220883264",Citrus:"370940413392601",Candy:"205488546921017",Earth:"1833559466821043",Support:"365557122117011",Music:"339021464972092",Pride:"1652456634878319",DoctorStrange:"538280997628317",LoFi:"1060619084701625",Sky:"3190514984517598",LunarNewYear:"357833546030778",Celebration:"627144732056021",Chill:"390127158985345",StrangerThings:"1059859811490132",Dune:"1455149831518874",Care:"275041734441112",Astrology:"3082966625307060",JBalvin:"184305226956268",Birthday:"621630955405500",Cottagecore:"539927563794799",Ocean:"736591620215564",Love:"741311439775765",TieDye:"230032715012014",Monochrome:"788274591712841",Default:"3259963564026002",Rocket:"582065306070020",Berry2:"724096885023603",Candy2:"624266884847972",Unicorn:"273728810607574",Tropical:"262191918210707",Maple:"2533652183614000",Sushi:"909695489504566",Citrus2:"557344741607350",Lollipop:"280333826736184",Shadow:"271607034185782",Rose:"1257453361255152",Lavender:"571193503540759",Tulip:"2873642949430623",Classic:"3273938616164733",Peach:"3022526817824329",Honey:"672058580051520",Kiwi:"3151463484918004",Grape:"193497045377796",NonBinary:"737761000603635",ThankfulForFriends:"1318983195536293",Transgender:"504518465021637",TaylorSwift:"769129927636836",NationalComingOutDay:"788102625833584",Autumn:"822549609168155",Cyberpunk2077:"780962576430091"}};
|
package/src/unfriend.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
const n=require("../utils"),e=require("npmlog");module.exports=function(r,t,o){return function(t,i){let u=function(){},c=function(){};const f=new Promise((function(n,e){u=n,c=e}));return i||(i=function(n,e){if(n)return c(n);u(e)}),r.post("https://www.facebook.com/ajax/profile/removefriendconfirm.php",o.jar,{uid:t,unref:"bd_friends_tab",floc:"friends_tab","nctr[_mod]":"pagelet_timeline_app_collection_"+(o.i_userID||o.userID)+":2356318349:2"}).then(n.parseAndCheckLogin(o,r)).then((function(n){if(n.error)throw n;return i()})).catch((function(n){return e.error("unfriend",n),i(n)})),f}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const n=require("../utils"),e=require("npmlog");module.exports=function(r,t,o){return function(t,u){let s=function(){},i=function(){};const c=new Promise((function(n,e){s=n,i=e}));return u||(u=function(n,e){if(n)return i(n);s(e)}),r.post("https://www.facebook.com/messaging/unsend_message/",o.jar,{message_id:t}).then(n.parseAndCheckLogin(o,r)).then((function(n){if(n.error)throw n;return u()})).catch((function(n){return e.error("unsendMessage",n),u(n)})),c}};
|
@@ -0,0 +1 @@
|
|
1
|
+
const t=require("../utils"),e=require("npmlog"),r=require("bluebird");module.exports=function(n,a,o){return function(a,u){if(!a&&!t.isReadableStream(a)&&"Array"===!t.getType(a)&&"Array"===t.getType(a)&&!a.length)throw{error:"Please pass an attachment or an array of attachments."};let i=function(){},c=function(){};const l=new Promise((function(t,e){i=t,c=e}));return u||(u=function(t,e){if(t)return c(t);i(e)}),"Array"!==t.getType(a)&&(a=[a]),function(a,u){u=u||function(){};const i=[];for(let e=0;e<a.length;e++){if(!t.isReadableStream(a[e]))throw{error:"Attachment should be a readable stream and not "+t.getType(a[e])+"."};i.push(n.postFormData("https://upload.facebook.com/ajax/mercury/upload.php",o.jar,{upload_1024:a[e],voice_clip:"true"},{}).then(t.parseAndCheckLogin(o,n)).then((function(t){if(t.error)throw t;return t.payload.metadata[0]})))}r.all(i).then((function(t){u(null,t)})).catch((function(t){return e.error("uploadAttachment",t),u(t)}))}(a,((t,e)=>{if(t)return u(t);u(null,e)})),l}};
|
package/utils.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
var e=require("url"),t=require("npmlog");require("lodash");var a,r=require("stream"),i=require("bluebird"),n=require("querystring"),s=i.promisify(require("request").defaults({jar:!0}));function o(e,t,a,r){var i={"Content-Type":"application/x-www-form-urlencoded",Referer:"https://www.facebook.com/",Host:e.replace("https://","").split("/")[0],Origin:"https://www.facebook.com","user-agent":t.userAgent||"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36",Connection:"keep-alive","sec-fetch-site":"same-origin","sec-fetch-mode":"cors"};return r&&Object.assign(i,r),a&&a.region&&(i["X-MSGR-Region"]=a.region),i}function d(e,t,a,r,i){if("Object"===M(a))for(var n in a)a.hasOwnProperty(n)&&"Object"===M(a[n])&&(a[n]=JSON.stringify(a[n]));var d={headers:o(e,r,i),timeout:6e4,qs:a,url:e,method:"GET",jar:t,gzip:!0};return s(d).then((function(e){return e}))}function m(e,t,a,r,i,n){var d={headers:o(e,r),timeout:6e4,url:e,method:"POST",form:a,jar:t,gzip:!0};return s(d).then((function(e){return e}))}function c(e,t,a,r,i,n){var d=o(e,i,n);return d["Content-Type"]="multipart/form-data",s({headers:d,timeout:6e4,url:e,method:"POST",formData:a,qs:r,jar:t,gzip:!0}).then((function(e){return e}))}var l={},h={_:"%",A:"%2",B:"000",C:"%7d",D:"%7b%22",E:"%2c%22",F:"%22%3a",G:"%2c%22ut%22%3a1",H:"%2c%22bls%22%3a",I:"%2c%22n%22%3a%22%",J:"%22%3a%7b%22i%22%3a0%7d",K:"%2c%22pt%22%3a0%2c%22vis%22%3a",L:"%2c%22ch%22%3a%7b%22h%22%3a%22",M:"%7b%22v%22%3a2%2c%22time%22%3a1",N:".channel%22%2c%22sub%22%3a%5b",O:"%2c%22sb%22%3a1%2c%22t%22%3a%5b",P:"%2c%22ud%22%3a100%2c%22lc%22%3a0",Q:"%5d%2c%22f%22%3anull%2c%22uct%22%3a",R:".channel%22%2c%22sub%22%3a%5b1%5d",S:"%22%2c%22m%22%3a0%7d%2c%7b%22i%22%3a",T:"%2c%22blc%22%3a1%2c%22snd%22%3a1%2c%22ct%22%3a",U:"%2c%22blc%22%3a0%2c%22snd%22%3a1%2c%22ct%22%3a",V:"%2c%22blc%22%3a0%2c%22snd%22%3a0%2c%22ct%22%3a",W:"%2c%22s%22%3a0%2c%22blo%22%3a0%7d%2c%22bl%22%3a%7b%22ac%22%3a",X:"%2c%22ri%22%3a0%7d%2c%22state%22%3a%7b%22p%22%3a0%2c%22ut%22%3a1",Y:"%2c%22pt%22%3a0%2c%22vis%22%3a1%2c%22bls%22%3a0%2c%22blc%22%3a0%2c%22snd%22%3a1%2c%22ct%22%3a",Z:"%2c%22sb%22%3a1%2c%22t%22%3a%5b%5d%2c%22f%22%3anull%2c%22uct%22%3a0%2c%22s%22%3a0%2c%22blo%22%3a0%7d%2c%22bl%22%3a%7b%22ac%22%3a"};function u(t,a){a=a||{id:"",image_data:{}};var r=(t=t.mercury?t.mercury:t).blob_attachment,i=r&&r.__typename?r.__typename:t.attach_type;switch(!i&&t.sticker_attachment?(i="StickerAttachment",r=t.sticker_attachment):!i&&t.extensible_attachment&&(i=t.extensible_attachment.story_attachment&&t.extensible_attachment.story_attachment.target&&t.extensible_attachment.story_attachment.target.__typename&&"MessageLocation"===t.extensible_attachment.story_attachment.target.__typename?"MessageLocation":"ExtensibleAttachment",r=t.extensible_attachment),i){case"sticker":return{type:"sticker",ID:t.metadata.stickerID.toString(),url:t.url,packID:t.metadata.packID.toString(),spriteUrl:t.metadata.spriteURI,spriteUrl2x:t.metadata.spriteURI2x,width:t.metadata.width,height:t.metadata.height,caption:a.caption,description:a.description,frameCount:t.metadata.frameCount,frameRate:t.metadata.frameRate,framesPerRow:t.metadata.framesPerRow,framesPerCol:t.metadata.framesPerCol,stickerID:t.metadata.stickerID.toString(),spriteURI:t.metadata.spriteURI,spriteURI2x:t.metadata.spriteURI2x};case"file":return{type:"file",filename:t.name,ID:a.id.toString(),url:t.url,isMalicious:a.is_malicious,contentType:a.mime_type,name:t.name,mimeType:a.mime_type,fileSize:a.file_size};case"photo":return{type:"photo",ID:t.metadata.fbid.toString(),filename:t.fileName,thumbnailUrl:t.thumbnail_url,previewUrl:t.preview_url,previewWidth:t.preview_width,previewHeight:t.preview_height,largePreviewUrl:t.large_preview_url,largePreviewWidth:t.large_preview_width,largePreviewHeight:t.large_preview_height,url:t.metadata.url,width:t.metadata.dimensions.split(",")[0],height:t.metadata.dimensions.split(",")[1],name:t.fileName};case"animated_image":return{type:"animated_image",ID:a.id.toString(),filename:a.filename,previewUrl:t.preview_url,previewWidth:t.preview_width,previewHeight:t.preview_height,url:a.image_data.url,width:a.image_data.width,height:a.image_data.height,name:t.name,facebookUrl:t.url,thumbnailUrl:t.thumbnail_url,mimeType:a.mime_type,rawGifImage:a.image_data.raw_gif_image,rawWebpImage:a.image_data.raw_webp_image,animatedGifUrl:a.image_data.animated_gif_url,animatedGifPreviewUrl:a.image_data.animated_gif_preview_url,animatedWebpUrl:a.image_data.animated_webp_url,animatedWebpPreviewUrl:a.image_data.animated_webp_preview_url};case"share":return{type:"share",ID:t.share.share_id.toString(),url:a.href,title:t.share.title,description:t.share.description,source:t.share.source,image:t.share.media.image,width:t.share.media.image_size.width,height:t.share.media.image_size.height,playable:t.share.media.playable,duration:t.share.media.duration,subattachments:t.share.subattachments,properties:{},animatedImageSize:t.share.media.animated_image_size,facebookUrl:t.share.uri,target:t.share.target,styleList:t.share.style_list};case"video":return{type:"video",ID:t.metadata.fbid.toString(),filename:t.name,previewUrl:t.preview_url,previewWidth:t.preview_width,previewHeight:t.preview_height,url:t.url,width:t.metadata.dimensions.width,height:t.metadata.dimensions.height,duration:t.metadata.duration,videoType:"unknown",thumbnailUrl:t.thumbnail_url};case"error":return{type:"error",attachment1:t,attachment2:a};case"MessageImage":return{type:"photo",ID:r.legacy_attachment_id,filename:r.filename,thumbnailUrl:r.thumbnail.uri,previewUrl:r.preview.uri,previewWidth:r.preview.width,previewHeight:r.preview.height,largePreviewUrl:r.large_preview.uri,largePreviewWidth:r.large_preview.width,largePreviewHeight:r.large_preview.height,url:r.large_preview.uri,width:r.original_dimensions.x,height:r.original_dimensions.y,name:r.filename};case"MessageAnimatedImage":return{type:"animated_image",ID:r.legacy_attachment_id,filename:r.filename,previewUrl:r.preview_image.uri,previewWidth:r.preview_image.width,previewHeight:r.preview_image.height,url:r.animated_image.uri,width:r.animated_image.width,height:r.animated_image.height,thumbnailUrl:r.preview_image.uri,name:r.filename,facebookUrl:r.animated_image.uri,rawGifImage:r.animated_image.uri,animatedGifUrl:r.animated_image.uri,animatedGifPreviewUrl:r.preview_image.uri,animatedWebpUrl:r.animated_image.uri,animatedWebpPreviewUrl:r.preview_image.uri};case"MessageVideo":return{type:"video",filename:r.filename,ID:r.legacy_attachment_id,previewUrl:r.large_image.uri,previewWidth:r.large_image.width,previewHeight:r.large_image.height,url:r.playable_url,width:r.original_dimensions.x,height:r.original_dimensions.y,duration:r.playable_duration_in_ms,videoType:r.video_type.toLowerCase(),thumbnailUrl:r.large_image.uri};case"MessageAudio":return{type:"audio",filename:r.filename,ID:r.url_shimhash,audioType:r.audio_type,duration:r.playable_duration_in_ms,url:r.playable_url,isVoiceMail:r.is_voicemail};case"StickerAttachment":return{type:"sticker",ID:r.id,url:r.url,packID:r.pack?r.pack.id:null,spriteUrl:r.sprite_image,spriteUrl2x:r.sprite_image_2x,width:r.width,height:r.height,caption:r.label,description:r.label,frameCount:r.frame_count,frameRate:r.frame_rate,framesPerRow:r.frames_per_row,framesPerCol:r.frames_per_column,stickerID:r.id,spriteURI:r.sprite_image,spriteURI2x:r.sprite_image_2x};case"MessageLocation":var s,o,d,m,c,l=r.story_attachment.url,h=r.story_attachment.media,u=n.parse(e.parse(l).query).u,g=n.parse(e.parse(u).query).where1,p=g.split(", ");try{s=Number.parseFloat(p[0]),o=Number.parseFloat(p[1])}catch(e){}return h&&h.image&&(d=h.image.uri,m=h.image.width,c=h.image.height),{type:"location",ID:r.legacy_attachment_id,latitude:s,longitude:o,image:d,width:m,height:c,url:u||l,address:g,facebookUrl:r.story_attachment.url,target:r.story_attachment.target,styleList:r.story_attachment.style_list};case"ExtensibleAttachment":return{type:"share",ID:r.legacy_attachment_id,url:r.story_attachment.url,title:r.story_attachment.title_with_entities.text,description:r.story_attachment.description&&r.story_attachment.description.text,source:r.story_attachment.source?r.story_attachment.source.text:null,image:r.story_attachment.media&&r.story_attachment.media.image&&r.story_attachment.media.image.uri,width:r.story_attachment.media&&r.story_attachment.media.image&&r.story_attachment.media.image.width,height:r.story_attachment.media&&r.story_attachment.media.image&&r.story_attachment.media.image.height,playable:r.story_attachment.media&&r.story_attachment.media.is_playable,duration:r.story_attachment.media&&r.story_attachment.media.playable_duration_in_ms,playableUrl:null==r.story_attachment.media?null:r.story_attachment.media.playable_url,subattachments:r.story_attachment.subattachments,properties:r.story_attachment.properties.reduce((function(e,t){return e[t.key]=t.value.text,e}),{}),facebookUrl:r.story_attachment.url,target:r.story_attachment.target,styleList:r.story_attachment.style_list};case"MessageFile":return{type:"file",filename:r.filename,ID:r.message_file_fbid,url:r.url,isMalicious:r.is_malicious,contentType:r.content_type,name:r.filename,mimeType:"",fileSize:-1};default:throw new Error("unrecognized attach_file of type "+i+"`"+JSON.stringify(t,null,4)+" attachment2: "+JSON.stringify(a,null,4)+"`")}}function g(e){return null!=e&&null!=e?e.replace(/(fb)?id[:.]/,""):e}function p(e){var t,a,r,i,n=e.message?e.message:e,s={type:"message",senderName:n.sender_name,senderID:g(n.sender_fbid.toString()),participantNames:n.group_thread_info?n.group_thread_info.participant_names:[n.sender_name.split(" ")[0]],participantIDs:n.group_thread_info?n.group_thread_info.participant_ids.map((function(e){return g(e.toString())})):[g(n.sender_fbid)],body:n.body||"",threadID:g((n.thread_fbid||n.other_user_fbid).toString()),threadName:n.group_thread_info?n.group_thread_info.name:n.sender_name,location:n.coordinates?n.coordinates:null,messageID:n.mid?n.mid.toString():n.message_id,attachments:(t=n.attachments,a=n.attachmentIds,r=n.attachment_map,i=n.share_map,r=i||r,t?t.map((function(e,t){return r&&a&&r[a[t]]?u(e,r[a[t]]):u(e)})):[]),timestamp:n.timestamp,timestampAbsolute:n.timestamp_absolute,timestampRelative:n.timestamp_relative,timestampDatetime:n.timestamp_datetime,tags:n.tags,reactions:n.reactions?n.reactions:[],isUnread:n.is_unread};return"pages_messaging"===e.type&&(s.pageID=e.realtime_viewer_fbid.toString()),s.isGroup=s.participantIDs.length>2,s}function _(e){switch(e.type){case"joinable_group_link_mode_change":return"log:link-status";case"magic_words":return"log:magic-words";case"change_thread_theme":return"log:thread-color";case"change_thread_icon":return"log:thread-icon";case"change_thread_nickname":return"log:user-nickname";case"change_thread_admins":return"log:thread-admins";case"group_poll":return"log:thread-poll";case"change_thread_approval_mode":return"log:thread-approval-mode";case"messenger_call_log":case"participant_joined_group_call":return"log:thread-call";case"pin_messages_v2":return"log:thread-pinned"}}function f(e){var t=["LAN","HÂN","LINH","MAI","HOA","THU","BĂNG","MỸ","CHÂU","THẢO","THOA","MẪN","THÙY","THỦY","NGA","NGÂN","NGHI","THƯ","NGỌC","BÍCH","VÂN","DIỆP","CHI","TIÊN","XUÂN","GIANG","NHUNG","DUNG","NHƯ","YẾN","QUYÊN","YẾN","TƯỜNG","VY","PHƯƠNG","LIÊN","LAN","HÀ","MAI","ĐAN","HẠ","QUYÊN","LY","HÒA","OANH","HƯƠNG","HẰNG","QUỲNH","HẠNH","NHIÊN","NHẠN"],a=["ANH","THANH","TÂM","DƯƠNG","AN","LÂM","MIÊN","TÚ","LÂM","BẰNG","KHÁNH","NHẬT","VỸ",".",",","/","%","&","*","-","+"];try{var r,i=e.split(" ");if(" "==(e=i[i.length-1])||null==e)return"UNKNOWN";switch(t.includes(e.toUpperCase())){case!0:r=a.includes(e.toUpperCase())||["HƯNG","HUY","KHẢI","KHANG","KHOA","KHÔI","KIÊN","KIỆT","LONG","MINH","ÂN","BẢO","BÌNH","CƯỜNG","ĐẠT","ĐỨC","DŨNG","DUY","HOÀNG","HÙNG","HƯNG","NGHĨA","NGUYÊN","THẮNG","THIỆN","THỊNH","TÒA","TRIẾT","TRUNG","TRƯỜNG","TUẤN","NHÂN","VŨ","VINH","PHONG","PHÚC","QUÂN","QUANG","SƠN","TÀI","THẮNG","ĐĂNG","VĂN","VĨ","QUANG","MẠNH"].includes(e.toUpperCase())?["FEMALE","MALE"][Math.floor(2*Math.random())]:"FEMALE";break;case!1:r=a.includes(e.toUpperCase())||t.includes(e.toUpperCase())?["FEMALE","MALE"][Math.floor(2*Math.random())]:"MALE"}}catch(e){return"UNKNOWN"}return r||"UNKNOWN"}function b(e,t,a){var r=e.indexOf(t)+t.length;if(r<t.length)return"";var i=e.substring(r),n=i.indexOf(a);if(-1===n)throw Error("Could not find endTime `"+a+"` in the given string.");return i.substring(0,n)}function y(e){let t=e.replace(/for\s*\(\s*;\s*;\s*\)\s*;\s*/,"").split(/\}\r\n *\{/);return 1===t.length?t:"["+t.join("},{")+"]"}!function(){var e=[];for(var t in h)l[h[t]]=t,e.push(h[t]);e.reverse(),a=new RegExp(e.join("|"),"g")}();var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],w=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function v(e,t){return e[0]+"="+e[1]+"; Path="+e[3]+"; Domain="+t+".com"}function M(e){return Object.prototype.toString.call(e).slice(8,-1)}module.exports={isReadableStream:function(e){return e instanceof r.Stream&&("Function"===M(e._read)||"AsyncFunction"===M(e._read))&&"Object"===M(e._readableState)},get:d,post:m,postFormData:c,generateThreadingID:function(e){return"<"+Date.now()+":"+Math.floor(4294967295*Math.random())+"-"+e+"@mail.projektitan.com>"},generateOfflineThreadingID:function(){var e=Date.now(),t=("0000000000000000000000"+Math.floor(4294967295*Math.random()).toString(2)).slice(-22);return function(e){for(var t="";"0"!==e;){for(var a=0,r="",i=0;i<e.length;i++)(a=2*a+parseInt(e[i],10))>=10?(r+="1",a-=10):r+="0";t=a.toString()+t,e=r.slice(r.indexOf("1"))}return t}(e.toString(2)+t)},getGUID:function(){var e=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var a=Math.floor((e+16*Math.random())%16);return e=Math.floor(e/16),("x"==t?a:7&a|8).toString(16)}))},getFrom:b,makeParsable:y,arrToForm:function(e){return t=function(e){return e.name},a=function(e){return e.val},e.reduce((function(e,r){return e[t(r)]=a(r),e}),{});var t,a},getSignatureID:function(){return Math.floor(2147483648*Math.random()).toString(16)},getJar:s.jar,generateTimestampRelative:function(){var e=new Date;return e.getHours()+":"+function(e,t){for(e=String(e),t=t||2;e.length<t;)e="0"+e;return e}(e.getMinutes())},makeDefaults:function(e,t,a){for(var r=1,i=b(e,'name="fb_dtsg" value="','"'),n="2",s=0;s<i.length;s++)n+=i.charCodeAt(s);var o=b(e,'revision":',",");function l(e){var s={__user:t,__req:(r++).toString(36),__rev:o,__a:1,fb_dtsg:a.fb_dtsg?a.fb_dtsg:i,jazoest:a.ttstamp?a.ttstamp:n};if(!e)return s;for(var d in e)e.hasOwnProperty(d)&&(s[d]||(s[d]=e[d]));return s}return{get:function(e,t,r,i){return d(e,t,l(r),a.globalOptions,i||a)},post:function(e,t,r,i){return m(e,t,l(r),a.globalOptions)},postFormData:function(e,t,r,i,n){return c(e,t,l(r),l(i),a.globalOptions,n||a)}}},parseAndCheckLogin:function e(a,r,n){return null==n&&(n=0),function(s){return i.try((function(){if(t.verbose("parseAndCheckLogin",s.body),s.statusCode>=500&&s.statusCode<600){if(n>=5)throw{error:"Request retry failed. Check the `res` and `statusCode` property on this error.",statusCode:s.statusCode,res:s.body};n++;var o=Math.floor(5e3*Math.random());t.warn("parseAndCheckLogin","Got status code "+s.statusCode+" - "+n+". attempt to retry in "+o+" milliseconds...");var d=s.request.uri.protocol+"//"+s.request.uri.hostname+s.request.uri.pathname;return"multipart/form-data"===s.request.headers["Content-Type"].split(";")[0]?i.delay(o).then((()=>r.postFormData(d,a.jar,s.request.formData,{}))).then(e(a,r,n)):i.delay(o).then((()=>r.post(d,a.jar,s.request.formData))).then(e(a,r,n))}if(200!==s.statusCode)throw new Error("parseAndCheckLogin got status code: "+s.statusCode+". Bailing out of trying to parse response.");var m=null;try{m=JSON.parse(y(s.body))}catch(e){throw{error:"JSON.parse error. Check the `detail` property on this error.",detail:e,res:s.body}}if(m.redirect&&"GET"===s.request.method)return r.get(m.redirect,a.jar).then(e(a,r));if(m.jsmods&&m.jsmods.require&&Array.isArray(m.jsmods.require[0])&&"Cookie"===m.jsmods.require[0][0]){m.jsmods.require[0][3][0]=m.jsmods.require[0][3][0].replace("_js_","");var c=v(m.jsmods.require[0][3],"facebook"),l=v(m.jsmods.require[0][3],"messenger");a.jar.setCookie(c,"https://www.facebook.com"),a.jar.setCookie(l,"https://www.messenger.com")}if(m.jsmods&&Array.isArray(m.jsmods.require)){var h=m.jsmods.require;for(var u in h)if("DTSG"===h[u][0]&&"setToken"===h[u][1]){a.fb_dtsg=h[u][3][0],a.ttstamp="2";for(var g=0;g<a.fb_dtsg.length;g++)a.ttstamp+=a.fb_dtsg.charCodeAt(g)}}return 1357001===m.error?global.Fca.Require.FastConfig.AutoLogin?global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.AutoLogin,(function(){return global.Fca.Action("AutoLogin")})):global.Fca.Require.FastConfig.AutoLogin?void 0:global.Fca.Require.logger.Error(global.Fca.Require.Language.Index.ErrAppState):m}))}},getGender:f,getData_Path:function e(t,a,r){if(0===a.length&&null!=t)return t;if(null==t)return r;const i=a[0];if(null==i)return r;const n=a.slice(1);return e(t[i],n,r++)},setData_Path:function e(t,a,r){if(!a.length)return t;const i=a[0];let n=t[i];return n||(t[i]=r,n=t[i]),a.shift(),n=a.length?e(n,a,r):r,t},getPaths:function e(t,a=[]){let r=[];for(let i in t)"object"==typeof t[i]?r=r.concat(e(t[i],[...a,i])):r.push([...a,i]);return r},saveCookies:function(e){return function(t){return(t.headers["set-cookie"]||[]).forEach((function(t){t.indexOf(".facebook.com")>-1&&(e.setCookie(t,"https://www.facebook.com"),e.setCookie(t.replace(/domain=\.facebook\.com/,"domain=.messenger.com"),"https://www.messenger.com"))})),t}},getType:M,_formatAttachment:u,formatHistoryMessage:function(e){return"ma-type:log-message"===e.action_type?("log:generic-admin-text"===(i=(r=(t=e).message?t.message:t).log_message_type)?(a=r.log_message_data.untypedData,i=_(r.log_message_data.message_type)):a=r.log_message_data,Object.assign(p(r),{type:"event",logMessageType:i,logMessageData:a,logMessageBody:r.log_message_body})):p(e);var t,a,r,i},formatID:g,formatMessage:p,formatDeltaEvent:function(e){var t,a;switch(e.class){case"AdminTextMessage":t=_(e),a=e.untypedData;break;case"ThreadName":t="log:thread-name",a={name:e.name};break;case"ParticipantsAddedToGroupThread":t="log:subscribe",a={addedParticipants:e.addedParticipants};break;case"ParticipantLeftGroupThread":t="log:unsubscribe",a={leftParticipantFbId:e.leftParticipantFbId};break;case"UserLocation":t="log:user-location",a={Image:e.attachments[0].mercury.extensible_attachment.story_attachment.media.image,Location:e.attachments[0].mercury.extensible_attachment.story_attachment.target.location_title,coordinates:e.attachments[0].mercury.extensible_attachment.story_attachment.target.coordinate,url:e.attachments[0].mercury.extensible_attachment.story_attachment.url}}if(!0===g((e.messageMetadata.threadKey.threadFbId||e.messageMetadata.threadKey.otherUserFbId).toString()))switch(t){case"log:thread-color":{let t=i(g((e.messageMetadata.threadKey.threadFbId||e.messageMetadata.threadKey.otherUserFbId).toString()));t.emoji=a.theme_emoji||t.emoji,t.color=a.theme_color||t.color,r(g((e.messageMetadata.threadKey.threadFbId||e.messageMetadata.threadKey.otherUserFbId).toString()),t)}break;case"log:thread-icon":{let t=i(g((e.messageMetadata.threadKey.threadFbId||e.messageMetadata.threadKey.otherUserFbId).toString()));t.emoji=a.thread_icon||t.emoji,r(g((e.messageMetadata.threadKey.threadFbId||e.messageMetadata.threadKey.otherUserFbId).toString()),t)}break;case"log:user-nickname":{let t=i(g((e.messageMetadata.threadKey.threadFbId||e.messageMetadata.threadKey.otherUserFbId).toString()));t.nicknames[a.participant_id]=0==a.nickname.length?t.userInfo.find((e=>e.id==String(a.participant_id))).name:a.nickname,r(g((e.messageMetadata.threadKey.threadFbId||e.messageMetadata.threadKey.otherUserFbId).toString()),t)}break;case"log:thread-admins":{let t=i(g((e.messageMetadata.threadKey.threadFbId||e.messageMetadata.threadKey.otherUserFbId).toString()));switch(a.ADMIN_EVENT){case"add_admin":t.adminIDs.push({id:a.TARGET_ID});break;case"remove_admin":t.adminIDs=t.adminIDs.filter((e=>e.id!=a.TARGET_ID))}r(g((e.messageMetadata.threadKey.threadFbId||e.messageMetadata.threadKey.otherUserFbId).toString()),t)}break;case"log:thread-approval-mode":{let t=i(g((e.messageMetadata.threadKey.threadFbId||e.messageMetadata.threadKey.otherUserFbId).toString()));t.approvalMode=1!=t.approvalMode,r(g((e.messageMetadata.threadKey.threadFbId||e.messageMetadata.threadKey.otherUserFbId).toString()),t)}break;case"log:thread-name":{let t=i(g((e.messageMetadata.threadKey.threadFbId||e.messageMetadata.threadKey.otherUserFbId).toString()));t.threadName=a.name||g((e.messageMetadata.threadKey.threadFbId||e.messageMetadata.threadKey.otherUserFbId).toString()),r(g((e.messageMetadata.threadKey.threadFbId||e.messageMetadata.threadKey.otherUserFbId).toString()),t)}break;case"log:subscribe":{let t=i(g((e.messageMetadata.threadKey.threadFbId||e.messageMetadata.threadKey.otherUserFbId).toString()));for(let e of a.addedParticipants)t.userInfo.some((t=>t.id==e.userFbId))||(t.userInfo.push({id:e.userFbId,name:e.fullName,gender:f(e.fullName)}),t.participantIDs.push(e.userFbId));r(g((e.messageMetadata.threadKey.threadFbId||e.messageMetadata.threadKey.otherUserFbId).toString()),t)}break;case"log:unsubscribe":{let t=i(g((e.messageMetadata.threadKey.threadFbId||e.messageMetadata.threadKey.otherUserFbId).toString()));t.participantIDs=t.participantIDs.filter((e=>e!=a.leftParticipantFbId)),t.userInfo=t.userInfo.filter((e=>e.id!=a.leftParticipantFbId)),t.adminIDs.some((e=>e.id==a.leftParticipantFbId))&&(t.adminIDs=t.adminIDs.filter((e=>e.id!=a.leftParticipantFbId))),r(g((e.messageMetadata.threadKey.threadFbId||e.messageMetadata.threadKey.otherUserFbId).toString()),t)}}return{type:"event",threadID:g((e.messageMetadata.threadKey.threadFbId||e.messageMetadata.threadKey.otherUserFbId).toString()),logMessageType:t,logMessageData:a,logMessageBody:e.messageMetadata.adminText,author:e.messageMetadata.actorFbId,participantIDs:e.participants||[]}},formatDeltaMessage:function(e){for(var t=e.delta.messageMetadata,a=void 0===e.delta.data||void 0===e.delta.data.prng?[]:JSON.parse(e.delta.data.prng),r=a.map((e=>e.i)),i=a.map((e=>e.o)),n=a.map((e=>e.l)),s={},o=e.delta.body||"",d=""==o?[]:o.trim().split(/\s+/),m=0;m<r.length;m++)s[r[m]]=e.delta.body.substring(i[m],i[m]+n[m]);return{type:"message",senderID:g(t.actorFbId.toString()),threadID:g((t.threadKey.threadFbId||t.threadKey.otherUserFbId).toString()),messageID:t.messageId,args:d,body:o,attachments:(e.delta.attachments||[]).map((e=>u(e))),mentions:s,timestamp:t.timestamp,isGroup:!!t.threadKey.threadFbId,participantIDs:e.delta.participants||[]}},formatProxyPresence:function(e,t){return void 0===e.lat||void 0===e.p?null:{type:"presence",timestamp:1e3*e.lat,userID:t||"",statuses:e.p}},formatPresence:function(e,t){return{type:"presence",timestamp:1e3*e.la,userID:t||"",statuses:e.a}},formatTyp:function(e){return{isTyping:!!e.st,from:e.from.toString(),threadID:g((e.to||e.thread_fbid||e.from).toString()),fromMobile:!e.hasOwnProperty("from_mobile")||e.from_mobile,userID:(e.realtime_viewer_fbid||e.from).toString(),type:"typ"}},formatDeltaReadReceipt:function(e){return{reader:(e.threadKey.otherUserFbId||e.actorFbId).toString(),time:e.actionTimestampMs,threadID:g((e.threadKey.otherUserFbId||e.threadKey.threadFbId).toString()),type:"read_receipt"}},formatCookie:v,formatThread:function(e){return{threadID:g(e.thread_fbid.toString()),participants:e.participants.map(g),participantIDs:e.participants.map(g),name:e.name,nicknames:e.custom_nickname,snippet:e.snippet,snippetAttachments:e.snippet_attachments,snippetSender:g((e.snippet_sender||"").toString()),unreadCount:e.unread_count,messageCount:e.message_count,imageSrc:e.image_src,timestamp:e.timestamp,muteUntil:e.mute_until,isCanonicalUser:e.is_canonical_user,isCanonical:e.is_canonical,isSubscribed:e.is_subscribed,folder:e.folder,isArchived:e.is_archived,recipientsLoadable:e.recipients_loadable,hasEmailParticipant:e.has_email_participant,readOnly:e.read_only,canReply:e.can_reply,cannotReplyReason:e.cannot_reply_reason,lastMessageTimestamp:e.last_message_timestamp,lastReadTimestamp:e.last_read_timestamp,lastMessageType:e.last_message_type,emoji:e.custom_like_icon,color:e.custom_color,adminIDs:e.admin_ids,threadType:e.thread_type}},formatReadReceipt:function(e){return{reader:e.reader.toString(),time:e.time,threadID:g((e.thread_fbid||e.reader).toString()),type:"read_receipt"}},formatRead:function(e){return{threadID:g((e.chat_ids&&e.chat_ids[0]||e.thread_fbids&&e.thread_fbids[0]).toString()),time:e.timestamp,type:"read"}},generatePresence:function(e){var t,r=Date.now();return"E"+(t=JSON.stringify({v:3,time:parseInt(r/1e3,10),user:e,state:{ut:0,t2:[],lm2:null,uct2:r,tr:null,tw:Math.floor(4294967295*Math.random())+1,at:r},ch:{["p_"+e]:0}}),encodeURIComponent(t).replace(/([_A-Z])|%../g,(function(e,t){return t?"%"+t.charCodeAt(0).toString(16):e})).toLowerCase().replace(a,(function(e){return l[e]})))},generateAccessiblityCookie:function(){var e=Date.now();return encodeURIComponent(JSON.stringify({sr:0,"sr-ts":e,jk:0,"jk-ts":e,kb:0,"kb-ts":e,hcm:0,"hcm-ts":e}))},formatDate:function(e){var t=e.getUTCDate();t=t>=10?t:"0"+t;var a=e.getUTCHours();a=a>=10?a:"0"+a;var r=e.getUTCMinutes();r=r>=10?r:"0"+r;var i=e.getUTCSeconds();return i=i>=10?i:"0"+i,w[e.getUTCDay()]+", "+t+" "+I[e.getUTCMonth()]+" "+e.getUTCFullYear()+" "+a+":"+r+":"+i+" GMT"},decodeClientPayload:function(e){return JSON.parse(function(e){var t,a,r,i,n,s;for(t="",r=e.length,a=0;a<r;)switch((i=e[a++])>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:t+=String.fromCharCode(i);break;case 12:case 13:n=e[a++],t+=String.fromCharCode((31&i)<<6|63&n);break;case 14:n=e[a++],s=e[a++],t+=String.fromCharCode((15&i)<<12|(63&n)<<6|(63&s)<<0)}return t}(e))},getAppState:function(e,t){var a,r=require("pretty-ms"),i=globalThis.Fca.getText,n=e.getCookies("https://www.facebook.com").concat(e.getCookies("https://facebook.com")).concat(e.getCookies("https://www.messenger.com")),s=require("./logger"),o=require("./Language/index.json").find((e=>e.Language==globalThis.Fca.Require.FastConfig.Language)).Folder.Index;return a=n,globalThis.Fca.Setting.get("getAppState")||s.Normal(i(o.ProcessDone,""+r(Date.now()-globalThis.Fca.startTime)),(function(){globalThis.Fca.Setting.set("getAppState",!0)})),a},getAdminTextMessageType:_,setProxy:function(e){return s=i.promisify(null==typeof e?require("request").defaults({jar:!0}):require("request").defaults({jar:!0,proxy:e}))}};
|