surya-sahil-fca 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +175 -0
- package/DOCS.md +2636 -0
- package/LICENSE-MIT +21 -0
- package/README.md +107 -0
- package/func/checkUpdate.js +222 -0
- package/func/logger.js +48 -0
- package/index.d.ts +746 -0
- package/index.js +8 -0
- package/module/config.js +34 -0
- package/module/login.js +126 -0
- package/module/loginHelper.js +747 -0
- package/module/options.js +45 -0
- package/package.json +82 -0
- package/src/api/messaging/changeGroupImage.js +90 -0
- package/src/api/messaging/changeNickname.js +70 -0
- package/src/api/messaging/changeThreadName.js +123 -0
- package/src/api/messaging/createCommentPost.js +207 -0
- package/src/api/messaging/sendMessage.js +272 -0
- package/src/api/messaging/sendTypingIndicator.js +67 -0
- package/src/api/messaging/setMessageReaction.js +76 -0
- package/src/api/messaging/setTitle.js +119 -0
- package/src/api/messaging/stickers.js +257 -0
- package/src/core/sendReqMqtt.js +96 -0
- package/src/database/models/index.js +49 -0
- package/src/database/models/thread.js +31 -0
- package/src/database/models/user.js +32 -0
- package/src/database/threadData.js +98 -0
- package/src/database/userData.js +89 -0
- package/src/utils/client.js +320 -0
- package/src/utils/constants.js +23 -0
- package/src/utils/format.js +1115 -0
- package/src/utils/headers.js +115 -0
- package/src/utils/request.js +305 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,746 @@
|
|
|
1
|
+
declare module 'surya-sahil-fca' {
|
|
2
|
+
import type EventEmitter from "events";
|
|
3
|
+
import type { Duplex, Readable, Transform } from "stream";
|
|
4
|
+
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// Type Definitions
|
|
7
|
+
// ============================================================================
|
|
8
|
+
|
|
9
|
+
type ReadableStream = Readable | Duplex | Transform;
|
|
10
|
+
|
|
11
|
+
// ============================================================================
|
|
12
|
+
// Login Function
|
|
13
|
+
// ============================================================================
|
|
14
|
+
|
|
15
|
+
function login(
|
|
16
|
+
credentials: Partial<{
|
|
17
|
+
email: string;
|
|
18
|
+
password: string;
|
|
19
|
+
appState: AppstateData;
|
|
20
|
+
Cookie?: string | string[] | Record<string, string>;
|
|
21
|
+
}>,
|
|
22
|
+
options: Partial<IFCAU_Options>,
|
|
23
|
+
callback: (err: Error | null, api: IFCAU_API) => void
|
|
24
|
+
): void;
|
|
25
|
+
function login(
|
|
26
|
+
credentials: Partial<{
|
|
27
|
+
email: string;
|
|
28
|
+
password: string;
|
|
29
|
+
appState: AppstateData;
|
|
30
|
+
Cookie?: string | string[] | Record<string, string>;
|
|
31
|
+
}>,
|
|
32
|
+
options: Partial<IFCAU_Options>
|
|
33
|
+
): Promise<IFCAU_API>;
|
|
34
|
+
function login(
|
|
35
|
+
credentials: Partial<{
|
|
36
|
+
email: string;
|
|
37
|
+
password: string;
|
|
38
|
+
appState: AppstateData;
|
|
39
|
+
Cookie?: string | string[] | Record<string, string>;
|
|
40
|
+
}>,
|
|
41
|
+
callback: (err: Error | null, api: IFCAU_API) => void
|
|
42
|
+
): void;
|
|
43
|
+
function login(
|
|
44
|
+
credentials: Partial<{
|
|
45
|
+
email: string;
|
|
46
|
+
password: string;
|
|
47
|
+
appState: AppstateData;
|
|
48
|
+
Cookie?: string | string[] | Record<string, string>;
|
|
49
|
+
}>
|
|
50
|
+
): Promise<IFCAU_API>;
|
|
51
|
+
|
|
52
|
+
export default login;
|
|
53
|
+
export { login };
|
|
54
|
+
|
|
55
|
+
// ============================================================================
|
|
56
|
+
// Core Types
|
|
57
|
+
// ============================================================================
|
|
58
|
+
|
|
59
|
+
export type Cookie = {
|
|
60
|
+
key: string;
|
|
61
|
+
value: string;
|
|
62
|
+
domain: string;
|
|
63
|
+
path?: string;
|
|
64
|
+
hostOnly?: boolean;
|
|
65
|
+
creation?: string;
|
|
66
|
+
lastAccessed?: string;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export type AppstateData = {
|
|
70
|
+
appState: Cookie[];
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export type MessageObject = {
|
|
74
|
+
body: string;
|
|
75
|
+
sticker?: string;
|
|
76
|
+
attachment?: ReadableStream | ReadableStream[];
|
|
77
|
+
url?: string;
|
|
78
|
+
emoji?: string;
|
|
79
|
+
emojiSize?: string;
|
|
80
|
+
mentions?: {
|
|
81
|
+
tag: string;
|
|
82
|
+
id: string;
|
|
83
|
+
fromIndex?: number;
|
|
84
|
+
}[];
|
|
85
|
+
location?: {
|
|
86
|
+
latitude: number;
|
|
87
|
+
longitude: number;
|
|
88
|
+
current?: boolean;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// ============================================================================
|
|
93
|
+
// Send Message Function
|
|
94
|
+
// ============================================================================
|
|
95
|
+
|
|
96
|
+
function sendMessage(
|
|
97
|
+
message: string | MessageObject,
|
|
98
|
+
threadID: string | string[],
|
|
99
|
+
callback?: (err?: Error, data?: { threadID: string; messageID: string; timestamp: number }) => void,
|
|
100
|
+
replyMessageID?: string,
|
|
101
|
+
isGroup?: boolean
|
|
102
|
+
): Promise<{ threadID: string; messageID: string; timestamp: number }>;
|
|
103
|
+
function sendMessage(
|
|
104
|
+
message: string | MessageObject,
|
|
105
|
+
threadID: string | string[],
|
|
106
|
+
replyMessageID?: string,
|
|
107
|
+
isGroup?: boolean
|
|
108
|
+
): Promise<{ threadID: string; messageID: string; timestamp: number }>;
|
|
109
|
+
|
|
110
|
+
// ============================================================================
|
|
111
|
+
// API Interface
|
|
112
|
+
// ============================================================================
|
|
113
|
+
|
|
114
|
+
export type IFCAU_API = {
|
|
115
|
+
// Group Management
|
|
116
|
+
addUserToGroup: (userID: string, threadID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
117
|
+
removeUserFromGroup: (userID: string, threadID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
118
|
+
createNewGroup: (participantIDs: string[], groupTitle?: string, callback?: (err: Error, threadID: string) => void) => Promise<string>;
|
|
119
|
+
|
|
120
|
+
// Admin & Permissions
|
|
121
|
+
changeAdminStatus: (threadID: string, adminIDs: string | string[], adminStatus: boolean, callback?: (err?: Error) => void) => Promise<void>;
|
|
122
|
+
changeApprovalMode: (approvalMode: 0 | 1, threadID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
123
|
+
|
|
124
|
+
// Thread Management
|
|
125
|
+
changeArchivedStatus: (threadOrThreads: string | string[], archive: boolean, callback?: (err?: Error) => void) => Promise<void>;
|
|
126
|
+
changeBlockedStatus: (userID: string, blocked: boolean, callback?: (err?: Error) => void) => Promise<void>;
|
|
127
|
+
changeGroupImage: (image: ReadableStream, threadID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
128
|
+
changeNickname: (nickname: string, threadID: string, participantID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
129
|
+
changeThreadColor: (color: string, threadID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
130
|
+
changeThreadEmoji: (emoji: string | null, threadID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
131
|
+
setTitle: (newTitle: string, threadID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
132
|
+
deleteThread: (threadOrThreads: string | string[], callback?: (err?: Error) => void) => Promise<void>;
|
|
133
|
+
muteThread: (threadID: string, muteSeconds: number, callback?: (err?: Error) => void) => Promise<void>;
|
|
134
|
+
|
|
135
|
+
// Messages
|
|
136
|
+
sendMessage: typeof sendMessage;
|
|
137
|
+
editMessage: (text: string, messageID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
138
|
+
deleteMessage: (messageOrMessages: string | string[], callback?: (err?: Error) => void) => Promise<void>;
|
|
139
|
+
unsendMessage: (messageID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
140
|
+
unsendMessageMqtt: (messageID: string, threadID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
141
|
+
forwardMessage: (messageID: string, threadID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
142
|
+
forwardAttachment: (attachmentID: string, userOrUsers: string | string[], callback?: (err?: Error) => void) => Promise<void>;
|
|
143
|
+
pinMessage: (pinMode: boolean, messageID: string, threadID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
144
|
+
|
|
145
|
+
// Reactions & Interactions
|
|
146
|
+
setMessageReaction: (reaction: string, messageID: string, callback?: (err?: Error) => void, forceCustomReaction?: boolean) => Promise<void>;
|
|
147
|
+
setMessageReactionMqtt: (reaction: string, messageID: string, threadID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
148
|
+
sendTypingIndicator: (threadID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
149
|
+
sendTypingIndicatorMqtt: (isTyping: boolean, threadID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
150
|
+
|
|
151
|
+
// Polls
|
|
152
|
+
createPoll: (title: string, threadID: string, options?: { [item: string]: boolean }, callback?: (err?: Error) => void) => Promise<void>;
|
|
153
|
+
|
|
154
|
+
// Read & Delivery Status
|
|
155
|
+
markAsRead: (threadID: string, read?: boolean, callback?: (err?: Error) => void) => Promise<void>;
|
|
156
|
+
markAsReadAll: (callback?: (err?: Error) => void) => Promise<void>;
|
|
157
|
+
markAsDelivered: (threadID: string, messageID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
158
|
+
markAsSeen: (seenTimestamp?: number, callback?: (err?: Error) => void) => Promise<void>;
|
|
159
|
+
|
|
160
|
+
// Thread Information
|
|
161
|
+
getThreadInfo: (threadID: string, callback?: (err: Error | null, thread: IFCAU_Thread) => void) => Promise<IFCAU_Thread>;
|
|
162
|
+
getThreadList: (limit: number, timestamp: number | null, tags: string[], callback?: (err: Error | null, threads: IFCAU_ThreadList) => void) => Promise<IFCAU_ThreadList>;
|
|
163
|
+
getThreadHistory: (threadID: string, amount: number, time?: number, callback?: (err: Error | null, messages: any[]) => void) => Promise<any[]>;
|
|
164
|
+
getThreadPictures: (threadID: string, offset: number, limit: number, callback?: (err: Error | null, pictures: string[]) => void) => Promise<string[]>;
|
|
165
|
+
|
|
166
|
+
// User Information
|
|
167
|
+
getUserInfo: (userOrUsers: string | string[], callback?: (err: Error | null, users: { [id: string]: IFCAU_User }) => void) => Promise<{ [id: string]: IFCAU_User }>;
|
|
168
|
+
getUserID: (name: string, callback?: (err: Error | null, obj: IFCAU_UserIDResponse) => void) => Promise<IFCAU_UserIDResponse>;
|
|
169
|
+
getFriendsList: (callback?: (err: Error | null, friends: IFCAU_Friend[]) => void) => Promise<IFCAU_Friend[]>;
|
|
170
|
+
getCurrentUserID: () => string;
|
|
171
|
+
|
|
172
|
+
// Utilities
|
|
173
|
+
getAppState: () => any;
|
|
174
|
+
getEmojiUrl: (c: string, size: number, pixelRatio: number) => string;
|
|
175
|
+
resolvePhotoUrl: (photoID: string, callback?: (err: Error | null, url: string) => void) => Promise<string>;
|
|
176
|
+
threadColors: {
|
|
177
|
+
[color: string]: string;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// Message Requests
|
|
181
|
+
handleMessageRequest: (threadOrThreads: string | string[], accept: boolean, callback?: (err?: Error) => void) => Promise<void>;
|
|
182
|
+
|
|
183
|
+
// Event Listeners
|
|
184
|
+
listen: (callback?: (err: Error | null, message: IFCAU_ListenMessage) => void) => EventEmitter;
|
|
185
|
+
listenMqtt: (callback?: (err: Error | null, message: IFCAU_ListenMessage) => void) => EventEmitter & { stopListening: (callback?: () => void) => void };
|
|
186
|
+
|
|
187
|
+
// Middleware System
|
|
188
|
+
useMiddleware: (middleware: IFCAU_Middleware | string, fn?: IFCAU_Middleware) => () => void;
|
|
189
|
+
removeMiddleware: (identifier: string | IFCAU_Middleware) => boolean;
|
|
190
|
+
clearMiddleware: () => void;
|
|
191
|
+
listMiddleware: () => string[];
|
|
192
|
+
setMiddlewareEnabled: (name: string, enabled: boolean) => boolean;
|
|
193
|
+
readonly middlewareCount: number;
|
|
194
|
+
|
|
195
|
+
// Configuration & Session
|
|
196
|
+
setOptions: (options: Partial<IFCAU_Options>) => void;
|
|
197
|
+
logout: (callback?: (err?: Error) => void) => Promise<void>;
|
|
198
|
+
|
|
199
|
+
// Message Scheduler
|
|
200
|
+
scheduler: {
|
|
201
|
+
scheduleMessage: (message: string | MessageObject, threadID: string | string[], when: Date | number | string, options?: { replyMessageID?: string; isGroup?: boolean; callback?: (err?: Error) => void }) => string;
|
|
202
|
+
cancelScheduledMessage: (id: string) => boolean;
|
|
203
|
+
getScheduledMessage: (id: string) => IFCAU_ScheduledMessage | null;
|
|
204
|
+
listScheduledMessages: () => IFCAU_ScheduledMessage[];
|
|
205
|
+
cancelAllScheduledMessages: () => number;
|
|
206
|
+
getScheduledCount: () => number;
|
|
207
|
+
cleanup: () => void;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
// Auto-save AppState
|
|
211
|
+
enableAutoSaveAppState: (options?: { filePath?: string; interval?: number; saveOnLogin?: boolean }) => () => void;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
// ============================================================================
|
|
215
|
+
// Listen Message Types
|
|
216
|
+
// ============================================================================
|
|
217
|
+
|
|
218
|
+
export type IFCAU_ListenMessage =
|
|
219
|
+
| {
|
|
220
|
+
type: "message";
|
|
221
|
+
attachments: IFCAU_Attachment[];
|
|
222
|
+
args: string[];
|
|
223
|
+
body: string;
|
|
224
|
+
isGroup: boolean;
|
|
225
|
+
mentions: { [id: string]: string };
|
|
226
|
+
messageID: string;
|
|
227
|
+
senderID: string;
|
|
228
|
+
threadID: string;
|
|
229
|
+
isUnread: boolean;
|
|
230
|
+
participantIDs: string[];
|
|
231
|
+
}
|
|
232
|
+
| {
|
|
233
|
+
type: "event";
|
|
234
|
+
author: string;
|
|
235
|
+
logMessageBody: string;
|
|
236
|
+
logMessageData: {
|
|
237
|
+
image: {
|
|
238
|
+
attachmentID: string;
|
|
239
|
+
width: number;
|
|
240
|
+
height: number;
|
|
241
|
+
url: string;
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
logMessageType: "log:thread-image";
|
|
245
|
+
threadID: string;
|
|
246
|
+
}
|
|
247
|
+
| {
|
|
248
|
+
type: "event";
|
|
249
|
+
author: string;
|
|
250
|
+
logMessageBody: string;
|
|
251
|
+
logMessageData: {
|
|
252
|
+
addedParticipants: {
|
|
253
|
+
fanoutPolicy: string;
|
|
254
|
+
firstName: string;
|
|
255
|
+
fullName: string;
|
|
256
|
+
groupJoinStatus: string;
|
|
257
|
+
initialFolder: string;
|
|
258
|
+
initialFolderId: {
|
|
259
|
+
systemFolderId: string;
|
|
260
|
+
};
|
|
261
|
+
lastUnsubscribeTimestampMs: string;
|
|
262
|
+
userFbId: string;
|
|
263
|
+
isMessengerUser: boolean;
|
|
264
|
+
}[];
|
|
265
|
+
};
|
|
266
|
+
logMessageType: "log:subscribe";
|
|
267
|
+
threadID: string;
|
|
268
|
+
participantIDs: string[];
|
|
269
|
+
}
|
|
270
|
+
| {
|
|
271
|
+
type: "event";
|
|
272
|
+
author: string;
|
|
273
|
+
logMessageBody: string;
|
|
274
|
+
logMessageData: { leftParticipantFbId: string };
|
|
275
|
+
logMessageType: "log:unsubscribe";
|
|
276
|
+
threadID: string;
|
|
277
|
+
participantIDs: string[];
|
|
278
|
+
}
|
|
279
|
+
| {
|
|
280
|
+
type: "event";
|
|
281
|
+
author: string;
|
|
282
|
+
logMessageBody: string;
|
|
283
|
+
logMessageData: { name: string };
|
|
284
|
+
logMessageType: "log:thread-name";
|
|
285
|
+
threadID: string;
|
|
286
|
+
participantIDs: string[];
|
|
287
|
+
}
|
|
288
|
+
| {
|
|
289
|
+
type: "event";
|
|
290
|
+
author: string;
|
|
291
|
+
logMessageBody: string;
|
|
292
|
+
logMessageData: {
|
|
293
|
+
theme_color: string;
|
|
294
|
+
gradient?: string;
|
|
295
|
+
should_show_icon: string;
|
|
296
|
+
theme_id: string;
|
|
297
|
+
accessibility_label: string;
|
|
298
|
+
theme_name_with_subtitle: string;
|
|
299
|
+
theme_emoji?: string;
|
|
300
|
+
};
|
|
301
|
+
logMessageType: "log:thread-color";
|
|
302
|
+
threadID: string;
|
|
303
|
+
participantIDs: string[];
|
|
304
|
+
}
|
|
305
|
+
| {
|
|
306
|
+
type: "event";
|
|
307
|
+
author: string;
|
|
308
|
+
logMessageBody: string;
|
|
309
|
+
logMessageData: {
|
|
310
|
+
thread_quick_reaction_instruction_key_id: string;
|
|
311
|
+
thread_quick_reaction_emoji: string;
|
|
312
|
+
thread_quick_reaction_emoji_url: string;
|
|
313
|
+
};
|
|
314
|
+
logMessageType: "log:thread-icon";
|
|
315
|
+
threadID: string;
|
|
316
|
+
participantIDs: string[];
|
|
317
|
+
}
|
|
318
|
+
| {
|
|
319
|
+
type: "event";
|
|
320
|
+
author: string;
|
|
321
|
+
logMessageBody: string;
|
|
322
|
+
logMessageData: {
|
|
323
|
+
nickname: string;
|
|
324
|
+
participant_id: string;
|
|
325
|
+
};
|
|
326
|
+
logMessageType: "log:user-nickname";
|
|
327
|
+
threadID: string;
|
|
328
|
+
participantIDs: string[];
|
|
329
|
+
}
|
|
330
|
+
| {
|
|
331
|
+
type: "event";
|
|
332
|
+
author: string;
|
|
333
|
+
logMessageBody: string;
|
|
334
|
+
logMessageData: {
|
|
335
|
+
THREAD_CATEGORY: string;
|
|
336
|
+
TARGET_ID: string;
|
|
337
|
+
ADMIN_TYPE: string;
|
|
338
|
+
ADMIN_EVENT: 'add_admin' | 'remove_admin';
|
|
339
|
+
};
|
|
340
|
+
logMessageType: "log:thread-admins";
|
|
341
|
+
threadID: string;
|
|
342
|
+
participantIDs: string[];
|
|
343
|
+
}
|
|
344
|
+
| {
|
|
345
|
+
type: "event";
|
|
346
|
+
author: string;
|
|
347
|
+
logMessageBody: string;
|
|
348
|
+
logMessageData: {
|
|
349
|
+
removed_option_ids: string;
|
|
350
|
+
question_json: string;
|
|
351
|
+
event_type: 'question_creation' | 'update_vote' | 'add_unvoted_option' | 'multiple_updates';
|
|
352
|
+
added_option_ids: string;
|
|
353
|
+
new_option_texts: string;
|
|
354
|
+
new_option_ids: string;
|
|
355
|
+
question_id: string;
|
|
356
|
+
};
|
|
357
|
+
logMessageType: "log:thread-poll";
|
|
358
|
+
threadID: string;
|
|
359
|
+
participantIDs: string[];
|
|
360
|
+
}
|
|
361
|
+
| {
|
|
362
|
+
type: "event";
|
|
363
|
+
author: string;
|
|
364
|
+
logMessageBody: string;
|
|
365
|
+
logMessageData: { APPROVAL_MODE: '0' | '1'; THREAD_CATEGORY: string };
|
|
366
|
+
logMessageType: "log:thread-approval-mode";
|
|
367
|
+
threadID: string;
|
|
368
|
+
participantIDs: string[];
|
|
369
|
+
}
|
|
370
|
+
| {
|
|
371
|
+
type: "event";
|
|
372
|
+
author: string;
|
|
373
|
+
logMessageBody: string;
|
|
374
|
+
logMessageData: any;
|
|
375
|
+
logMessageType: "log:thread-call";
|
|
376
|
+
threadID: string;
|
|
377
|
+
participantIDs: string[];
|
|
378
|
+
}
|
|
379
|
+
| {
|
|
380
|
+
type: "typ";
|
|
381
|
+
from: string;
|
|
382
|
+
fromMobile: boolean;
|
|
383
|
+
isTyping: boolean;
|
|
384
|
+
threadID: string;
|
|
385
|
+
}
|
|
386
|
+
| {
|
|
387
|
+
type: "read";
|
|
388
|
+
threadID: string;
|
|
389
|
+
time: number;
|
|
390
|
+
}
|
|
391
|
+
| {
|
|
392
|
+
type: "read_receipt";
|
|
393
|
+
reader: string;
|
|
394
|
+
threadID: string;
|
|
395
|
+
time: number;
|
|
396
|
+
}
|
|
397
|
+
| {
|
|
398
|
+
type: "message_reaction";
|
|
399
|
+
threadID: string;
|
|
400
|
+
messageID: string;
|
|
401
|
+
reaction: string;
|
|
402
|
+
senderID: string;
|
|
403
|
+
userID: string;
|
|
404
|
+
reactionTimestamp: number;
|
|
405
|
+
}
|
|
406
|
+
| {
|
|
407
|
+
type: "presence";
|
|
408
|
+
statuses: number;
|
|
409
|
+
timestamp: number;
|
|
410
|
+
userID: string;
|
|
411
|
+
}
|
|
412
|
+
| {
|
|
413
|
+
type: "message_unsend";
|
|
414
|
+
threadID: string;
|
|
415
|
+
senderID: string;
|
|
416
|
+
messageID: string;
|
|
417
|
+
deletionTimestamp: number;
|
|
418
|
+
}
|
|
419
|
+
| {
|
|
420
|
+
type: "message_reply";
|
|
421
|
+
attachments: IFCAU_Attachment[];
|
|
422
|
+
args: string[];
|
|
423
|
+
body: string;
|
|
424
|
+
isGroup: boolean;
|
|
425
|
+
mentions: { [id: string]: string };
|
|
426
|
+
messageID: string;
|
|
427
|
+
senderID: string;
|
|
428
|
+
threadID: string;
|
|
429
|
+
isUnread: boolean;
|
|
430
|
+
participantIDs: string[];
|
|
431
|
+
messageReply: {
|
|
432
|
+
attachments: IFCAU_Attachment[];
|
|
433
|
+
body: string;
|
|
434
|
+
isGroup: boolean;
|
|
435
|
+
mentions: { [id: string]: string };
|
|
436
|
+
messageID: string;
|
|
437
|
+
senderID: string;
|
|
438
|
+
threadID: string;
|
|
439
|
+
isUnread: boolean;
|
|
440
|
+
};
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
// ============================================================================
|
|
444
|
+
// Attachment Types
|
|
445
|
+
// ============================================================================
|
|
446
|
+
|
|
447
|
+
export type IFCAU_Attachment =
|
|
448
|
+
| {
|
|
449
|
+
type: "sticker";
|
|
450
|
+
ID: string;
|
|
451
|
+
url: string;
|
|
452
|
+
packID: string;
|
|
453
|
+
spriteUrl: string;
|
|
454
|
+
spriteUrl2x: string;
|
|
455
|
+
width: number;
|
|
456
|
+
height: number;
|
|
457
|
+
caption: string;
|
|
458
|
+
description: string;
|
|
459
|
+
frameCount: number;
|
|
460
|
+
frameRate: number;
|
|
461
|
+
framesPerRow: number;
|
|
462
|
+
framesPerCol: number;
|
|
463
|
+
}
|
|
464
|
+
| {
|
|
465
|
+
type: "file";
|
|
466
|
+
ID: string;
|
|
467
|
+
filename: string;
|
|
468
|
+
url: string;
|
|
469
|
+
isMalicious: boolean;
|
|
470
|
+
contentType: string;
|
|
471
|
+
}
|
|
472
|
+
| {
|
|
473
|
+
type: "photo";
|
|
474
|
+
ID: string;
|
|
475
|
+
filename: string;
|
|
476
|
+
thumbnailUrl: string;
|
|
477
|
+
previewUrl: string;
|
|
478
|
+
previewWidth: number;
|
|
479
|
+
previewHeight: number;
|
|
480
|
+
largePreviewUrl: string;
|
|
481
|
+
largePreviewWidth: number;
|
|
482
|
+
largePreviewHeight: number;
|
|
483
|
+
url: string;
|
|
484
|
+
width: number;
|
|
485
|
+
height: number;
|
|
486
|
+
}
|
|
487
|
+
| {
|
|
488
|
+
type: "animated_image";
|
|
489
|
+
ID: string;
|
|
490
|
+
filename: string;
|
|
491
|
+
previewUrl: string;
|
|
492
|
+
previewWidth: number;
|
|
493
|
+
previewHeight: number;
|
|
494
|
+
url: string;
|
|
495
|
+
width: number;
|
|
496
|
+
height: number;
|
|
497
|
+
}
|
|
498
|
+
| {
|
|
499
|
+
type: "video";
|
|
500
|
+
ID: string;
|
|
501
|
+
filename: string;
|
|
502
|
+
previewUrl: string;
|
|
503
|
+
previewWidth: number;
|
|
504
|
+
previewHeight: number;
|
|
505
|
+
url: string;
|
|
506
|
+
width: number;
|
|
507
|
+
height: number;
|
|
508
|
+
duration: number;
|
|
509
|
+
videoType: string;
|
|
510
|
+
}
|
|
511
|
+
| {
|
|
512
|
+
type: "audio";
|
|
513
|
+
ID: string;
|
|
514
|
+
filename: string;
|
|
515
|
+
audioType: string;
|
|
516
|
+
duration: number;
|
|
517
|
+
url: string;
|
|
518
|
+
isVoiceMail: boolean;
|
|
519
|
+
}
|
|
520
|
+
| {
|
|
521
|
+
type: "location";
|
|
522
|
+
ID: string;
|
|
523
|
+
latitude: number;
|
|
524
|
+
longitude: number;
|
|
525
|
+
image: string;
|
|
526
|
+
width: number;
|
|
527
|
+
height: number;
|
|
528
|
+
url: string;
|
|
529
|
+
address: string;
|
|
530
|
+
}
|
|
531
|
+
| {
|
|
532
|
+
type: "share";
|
|
533
|
+
ID: string;
|
|
534
|
+
url: string;
|
|
535
|
+
title: string;
|
|
536
|
+
description: string;
|
|
537
|
+
source: string;
|
|
538
|
+
image: string;
|
|
539
|
+
width: number;
|
|
540
|
+
height: number;
|
|
541
|
+
playable: boolean;
|
|
542
|
+
duration: number;
|
|
543
|
+
playableUrl: string;
|
|
544
|
+
subattachments: any;
|
|
545
|
+
properties: any;
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
// ============================================================================
|
|
549
|
+
// User Types
|
|
550
|
+
// ============================================================================
|
|
551
|
+
|
|
552
|
+
export type IFCAU_User = {
|
|
553
|
+
name: string;
|
|
554
|
+
firstName?: string;
|
|
555
|
+
vanity?: string;
|
|
556
|
+
thumbSrc: string;
|
|
557
|
+
profileUrl: string | null;
|
|
558
|
+
gender?: number;
|
|
559
|
+
type: string;
|
|
560
|
+
isFriend?: boolean;
|
|
561
|
+
isBirthday: boolean;
|
|
562
|
+
searchToken: any;
|
|
563
|
+
alternateName?: string;
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
export type IFCAU_UserIDResponse = {
|
|
567
|
+
userID: string;
|
|
568
|
+
photoUrl: string;
|
|
569
|
+
indexRank: number;
|
|
570
|
+
name: string;
|
|
571
|
+
isVerified: boolean;
|
|
572
|
+
profileUrl: string;
|
|
573
|
+
category: string;
|
|
574
|
+
score: number;
|
|
575
|
+
type: string;
|
|
576
|
+
}[];
|
|
577
|
+
|
|
578
|
+
export type IFCAU_Friend = {
|
|
579
|
+
alternativeName: string;
|
|
580
|
+
firstName: string;
|
|
581
|
+
gender: string;
|
|
582
|
+
userID: string;
|
|
583
|
+
isFriend: boolean;
|
|
584
|
+
fullName: string;
|
|
585
|
+
profilePicture: string;
|
|
586
|
+
type: string;
|
|
587
|
+
profileUrl: string;
|
|
588
|
+
vanity: string;
|
|
589
|
+
isBirthday: boolean;
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
// ============================================================================
|
|
593
|
+
// Thread Types
|
|
594
|
+
// ============================================================================
|
|
595
|
+
|
|
596
|
+
export type IFCAU_Thread = {
|
|
597
|
+
threadID: string;
|
|
598
|
+
participantIDs: string[];
|
|
599
|
+
threadName: string;
|
|
600
|
+
userInfo: (IFCAU_User & { id: string })[];
|
|
601
|
+
nicknames: { [id: string]: string } | null;
|
|
602
|
+
unreadCount: number;
|
|
603
|
+
messageCount: number;
|
|
604
|
+
imageSrc: string;
|
|
605
|
+
timestamp: number;
|
|
606
|
+
muteUntil: number | null;
|
|
607
|
+
isGroup: boolean;
|
|
608
|
+
isSubscribed: boolean;
|
|
609
|
+
folder: 'INBOX' | 'ARCHIVE' | string;
|
|
610
|
+
isArchived: boolean;
|
|
611
|
+
cannotReplyReason: string | null;
|
|
612
|
+
lastReadTimestamp: number;
|
|
613
|
+
emoji: string | null;
|
|
614
|
+
color: string | null;
|
|
615
|
+
adminIDs: string[];
|
|
616
|
+
approvalMode: boolean;
|
|
617
|
+
approvalQueue: { inviterID: string; requesterID: string; timestamp: string }[];
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
export type IFCAU_ThreadList = {
|
|
621
|
+
threadID: string;
|
|
622
|
+
name: string;
|
|
623
|
+
unreadCount: number;
|
|
624
|
+
messageCount: number;
|
|
625
|
+
imageSrc: string;
|
|
626
|
+
emoji: string | null;
|
|
627
|
+
color: string | null;
|
|
628
|
+
nicknames: { userid: string; nickname: string }[];
|
|
629
|
+
muteUntil: number | null;
|
|
630
|
+
participants: IFCAU_ThreadList_Participants[];
|
|
631
|
+
adminIDs: string[];
|
|
632
|
+
folder: "INBOX" | "ARCHIVED" | "PENNDING" | "OTHER" | string;
|
|
633
|
+
isGroup: boolean;
|
|
634
|
+
customizationEnabled: boolean;
|
|
635
|
+
participantAddMode: string;
|
|
636
|
+
reactionMuteMode: string;
|
|
637
|
+
isArchived: boolean;
|
|
638
|
+
isSubscribed: boolean;
|
|
639
|
+
timestamp: number;
|
|
640
|
+
snippet: string;
|
|
641
|
+
snippetAttachments: string;
|
|
642
|
+
snippetSender: string;
|
|
643
|
+
lastMessageTimestamp: number;
|
|
644
|
+
listReadTimestamp: number | null;
|
|
645
|
+
cannotReplyReason: string | null;
|
|
646
|
+
approvalMode: string;
|
|
647
|
+
}[];
|
|
648
|
+
|
|
649
|
+
export type IFCAU_ThreadList_Participants =
|
|
650
|
+
| {
|
|
651
|
+
accountType: "User";
|
|
652
|
+
userID: string;
|
|
653
|
+
name: string;
|
|
654
|
+
shortName: string;
|
|
655
|
+
gender: string;
|
|
656
|
+
url: string;
|
|
657
|
+
profilePicture: string;
|
|
658
|
+
username: string | null;
|
|
659
|
+
isViewerFriend: boolean;
|
|
660
|
+
isMessengerUser: boolean;
|
|
661
|
+
isVerified: boolean;
|
|
662
|
+
isMessageBlockedByViewer: boolean;
|
|
663
|
+
isViewerCoworker: boolean;
|
|
664
|
+
}
|
|
665
|
+
| {
|
|
666
|
+
accountType: "Page";
|
|
667
|
+
userID: string;
|
|
668
|
+
name: string;
|
|
669
|
+
url: string;
|
|
670
|
+
profilePicture: string;
|
|
671
|
+
username: string | null;
|
|
672
|
+
acceptMessengerUserFeedback: boolean;
|
|
673
|
+
isMessengerUser: boolean;
|
|
674
|
+
isVerified: boolean;
|
|
675
|
+
isMessengerPlatformBot: boolean;
|
|
676
|
+
isMessageBlockedByViewer: boolean;
|
|
677
|
+
}
|
|
678
|
+
| {
|
|
679
|
+
accountType: "ReducedMessagingActor";
|
|
680
|
+
userID: string;
|
|
681
|
+
name: string;
|
|
682
|
+
url: string;
|
|
683
|
+
profilePicture: string;
|
|
684
|
+
username: string | null;
|
|
685
|
+
acceptMessengerUserFeedback: boolean;
|
|
686
|
+
isMessageBlockedByViewer: boolean;
|
|
687
|
+
}
|
|
688
|
+
| {
|
|
689
|
+
accountType: "UnavailableMessagingActor";
|
|
690
|
+
userID: string;
|
|
691
|
+
name: string;
|
|
692
|
+
url: null;
|
|
693
|
+
profilePicture: string;
|
|
694
|
+
username: null;
|
|
695
|
+
acceptMessengerUserFeedback: boolean;
|
|
696
|
+
isMessageBlockedByViewer: boolean;
|
|
697
|
+
}
|
|
698
|
+
| {
|
|
699
|
+
accountType: string;
|
|
700
|
+
userID: string;
|
|
701
|
+
name: string;
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
// ============================================================================
|
|
705
|
+
// Middleware Types
|
|
706
|
+
// ============================================================================
|
|
707
|
+
|
|
708
|
+
export type IFCAU_Middleware = (event: IFCAU_ListenMessage, next: (err?: Error | false | null) => void) => void | Promise<void> | false | null;
|
|
709
|
+
|
|
710
|
+
// ============================================================================
|
|
711
|
+
// Scheduler Types
|
|
712
|
+
// ============================================================================
|
|
713
|
+
|
|
714
|
+
export type IFCAU_ScheduledMessage = {
|
|
715
|
+
id: string;
|
|
716
|
+
message: string | MessageObject;
|
|
717
|
+
threadID: string | string[];
|
|
718
|
+
timestamp: number;
|
|
719
|
+
createdAt: number;
|
|
720
|
+
options: {
|
|
721
|
+
replyMessageID?: string;
|
|
722
|
+
isGroup?: boolean;
|
|
723
|
+
callback?: (err?: Error) => void;
|
|
724
|
+
};
|
|
725
|
+
timeUntilSend: number;
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
// ============================================================================
|
|
729
|
+
// Options Type
|
|
730
|
+
// ============================================================================
|
|
731
|
+
|
|
732
|
+
export type IFCAU_Options = {
|
|
733
|
+
pauseLog: boolean;
|
|
734
|
+
logLevel: "silly" | "verbose" | "info" | "http" | "warn" | "error" | "silent";
|
|
735
|
+
selfListen: boolean;
|
|
736
|
+
listenEvents: boolean;
|
|
737
|
+
pageID: string;
|
|
738
|
+
updatePresence: boolean;
|
|
739
|
+
forceLogin: boolean;
|
|
740
|
+
userAgent: string;
|
|
741
|
+
autoMarkDelivery: boolean;
|
|
742
|
+
autoMarkRead: boolean;
|
|
743
|
+
proxy: string;
|
|
744
|
+
online: boolean;
|
|
745
|
+
};
|
|
746
|
+
}
|