autobot-fca 1.0.0 → 1.0.1

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/dist/index.cjs CHANGED
@@ -54,6 +54,7 @@ function createFcaClient(api) {
54
54
  const existingClient = api.client || {};
55
55
  const messages = {
56
56
  send: api.messages && api.messages.send || api.sendMessage || existingClient.messages && existingClient.messages.send || ((msg, tid) => ({ messageID: "mid." + Date.now(), threadID: tid })),
57
+ sendMqtt: api.messages && api.messages.sendMqtt || api.sendMessageMqtt || existingClient.messages && existingClient.messages.sendMqtt || ((msg, tid) => ({ messageID: "mid." + Date.now(), threadID: tid, viaMqtt: true })),
57
58
  edit: api.messages && api.messages.edit || api.editMessage || existingClient.messages && existingClient.messages.edit || ((text, mid) => ({ success: true, messageID: mid, text, timestamp: Date.now() })),
58
59
  reply: api.messages && api.messages.reply || api.replyMessage || existingClient.messages && existingClient.messages.reply || ((msg, mid) => ({ messageID: "mid." + Date.now(), replyTo: mid })),
59
60
  unsend: api.messages && api.messages.unsend || api.unsendMessage || existingClient.messages && existingClient.messages.unsend || ((mid) => ({ success: true, messageID: mid })),
@@ -61,7 +62,11 @@ function createFcaClient(api) {
61
62
  react: api.messages && api.messages.react || api.setMessageReaction || existingClient.messages && existingClient.messages.react || ((reaction, mid) => ({ success: true, reaction, messageID: mid })),
62
63
  delete: api.messages && api.messages.delete || api.deleteMessage || existingClient.messages && existingClient.messages.delete || ((mids) => ({ success: true, messageIDs: Array.isArray(mids) ? mids : [mids] })),
63
64
  sendTypingIndicator: api.messages && api.messages.sendTypingIndicator || api.sendTypingIndicator || existingClient.messages && existingClient.messages.sendTypingIndicator || ((tid) => () => {
64
- })
65
+ }),
66
+ pin: api.messages && api.messages.pin || api.pinMessage || existingClient.messages && existingClient.messages.pin || ((mid, tid) => ({ success: true, messageID: mid, threadID: tid, pinned: true })),
67
+ unpin: api.messages && api.messages.unpin || api.unpinMessage || existingClient.messages && existingClient.messages.unpin || ((mid, tid) => ({ success: true, messageID: mid, threadID: tid, pinned: false })),
68
+ sendSticker: api.messages && api.messages.sendSticker || api.sendSticker || existingClient.messages && existingClient.messages.sendSticker || ((sid, tid) => ({ success: true, stickerID: sid, threadID: tid })),
69
+ getStickers: api.messages && api.messages.getStickers || api.getStickers || existingClient.messages && existingClient.messages.getStickers || ((q) => [])
65
70
  };
66
71
  const threads = {
67
72
  getInfo: api.threads && api.threads.getInfo || api.getThreadInfo || existingClient.threads && existingClient.threads.getInfo || ((tid) => ({ threadID: tid, threadName: "Thread " + tid, participantIDs: [], isGroup: false })),
@@ -79,7 +84,9 @@ function createFcaClient(api) {
79
84
  removeUser: api.threads && api.threads.removeUser || api.removeUserFromGroup || existingClient.threads && existingClient.threads.removeUser || ((uid, tid) => ({ success: true, userID: uid, threadID: tid })),
80
85
  createPoll: api.threads && api.threads.createPoll || api.createPoll || existingClient.threads && existingClient.threads.createPoll || ((title, opts, tid) => ({ success: true, title, threadID: tid })),
81
86
  deleteThread: api.threads && api.threads.deleteThread || api.deleteThread || existingClient.threads && existingClient.threads.deleteThread || ((tids) => ({ success: true, threadIDs: tids })),
82
- markAsRead: api.threads && api.threads.markAsRead || api.markAsRead || existingClient.threads && existingClient.threads.markAsRead || ((tid) => ({ success: true, threadID: tid }))
87
+ markAsRead: api.threads && api.threads.markAsRead || api.markAsRead || existingClient.threads && existingClient.threads.markAsRead || ((tid) => ({ success: true, threadID: tid })),
88
+ pinMessage: api.threads && api.threads.pinMessage || api.pinMessage || existingClient.threads && existingClient.threads.pinMessage || ((mid, tid) => ({ success: true, messageID: mid, threadID: tid, pinned: true })),
89
+ unpinMessage: api.threads && api.threads.unpinMessage || api.unpinMessage || existingClient.threads && existingClient.threads.unpinMessage || ((mid, tid) => ({ success: true, messageID: mid, threadID: tid, pinned: false }))
83
90
  };
84
91
  const users = {
85
92
  getInfo: api.users && api.users.getInfo || api.getUserInfo || existingClient.users && existingClient.users.getInfo || ((ids) => {
@@ -100,7 +107,8 @@ function createFcaClient(api) {
100
107
  getAppState: api.account && api.account.getAppState || api.getAppState || existingClient.account && existingClient.account.getAppState || (() => []),
101
108
  setOptions: api.account && api.account.setOptions || api.setOptions || existingClient.account && existingClient.account.setOptions || (() => {
102
109
  }),
103
- setBio: api.account && api.account.setBio || api.setBio || existingClient.account && existingClient.account.setBio || ((bio) => ({ success: true, bio }))
110
+ setBio: api.account && api.account.setBio || api.setBio || existingClient.account && existingClient.account.setBio || ((bio) => ({ success: true, bio })),
111
+ logout: api.account && api.account.logout || api.logout || existingClient.account && existingClient.account.logout || (() => ({ success: true, loggedOut: true }))
104
112
  };
105
113
  const realtime = {
106
114
  listen: api.realtime && api.realtime.listen || api.listenMqtt || api.listen || existingClient.realtime && existingClient.realtime.listen || ((cb) => () => {
@@ -519,6 +527,66 @@ var FcaApiInstance = class {
519
527
  if (typeof callback === "function") callback(null, res);
520
528
  return res;
521
529
  }
530
+ async sendMessageMqtt(message, threadID, callback) {
531
+ const payload = typeof message === "string" ? { body: message } : message;
532
+ const result = {
533
+ messageID: `mid.$mqtt_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`,
534
+ threadID: String(threadID),
535
+ timestamp: Date.now(),
536
+ body: payload.body || "",
537
+ viaMqtt: true,
538
+ status: "sent"
539
+ };
540
+ if (typeof callback === "function") callback(null, result);
541
+ return result;
542
+ }
543
+ async pinMessage(messageID, threadID, callback) {
544
+ const result = { success: true, messageID: String(messageID), threadID: String(threadID), pinned: true, timestamp: Date.now() };
545
+ if (typeof callback === "function") callback(null, result);
546
+ return result;
547
+ }
548
+ async unpinMessage(messageID, threadID, callback) {
549
+ const result = { success: true, messageID: String(messageID), threadID: String(threadID), pinned: false, timestamp: Date.now() };
550
+ if (typeof callback === "function") callback(null, result);
551
+ return result;
552
+ }
553
+ async getStickers(query, callback) {
554
+ const queryStr = String(query || "").toLowerCase();
555
+ const stickers = [
556
+ { id: "12636236323", packID: "1001", name: queryStr || "thumbs_up", url: "https://static.xx.fbcdn.net/rsrc.php/v3/yI/r/qq3u4uS.png" },
557
+ { id: "12636236324", packID: "1001", name: "heart", url: "https://static.xx.fbcdn.net/rsrc.php/v3/yI/r/heart.png" }
558
+ ];
559
+ if (typeof callback === "function") callback(null, stickers);
560
+ return stickers;
561
+ }
562
+ async sendSticker(stickerID, threadID, callback) {
563
+ const result = {
564
+ messageID: `mid.$stk_${Date.now()}`,
565
+ threadID: String(threadID),
566
+ stickerID: String(stickerID),
567
+ timestamp: Date.now(),
568
+ status: "sent"
569
+ };
570
+ if (typeof callback === "function") callback(null, result);
571
+ return result;
572
+ }
573
+ async shareContact(text, senderID, threadID, callback) {
574
+ const result = {
575
+ messageID: `mid.$cnt_${Date.now()}`,
576
+ text: String(text || ""),
577
+ contactID: String(senderID),
578
+ threadID: String(threadID),
579
+ timestamp: Date.now()
580
+ };
581
+ if (typeof callback === "function") callback(null, result);
582
+ return result;
583
+ }
584
+ async logout(callback) {
585
+ this.stopListening();
586
+ const result = { success: true, loggedOut: true, timestamp: Date.now() };
587
+ if (typeof callback === "function") callback(null, result);
588
+ return result;
589
+ }
522
590
  async deleteThread(threadID, callback) {
523
591
  const tids = Array.isArray(threadID) ? threadID : [threadID];
524
592
  const res = { success: true, deletedThreadIDs: tids };
package/dist/index.d.mts CHANGED
@@ -121,6 +121,7 @@ type MiddlewareFn = (event: any, api: any, next: () => void) => void | Promise<v
121
121
  interface FcaClient {
122
122
  messages: {
123
123
  send: (message: string | MessagePayload, threadID: string, callback?: any) => Promise<any> | any;
124
+ sendMqtt: (message: string | MessagePayload, threadID: string, callback?: any) => Promise<any> | any;
124
125
  edit: (text: string, messageID: string, callback?: any) => Promise<any> | any;
125
126
  reply: (message: string | MessagePayload, messageID: string, callback?: any) => Promise<any> | any;
126
127
  unsend: (messageID: string, callback?: any) => Promise<any> | any;
@@ -128,6 +129,10 @@ interface FcaClient {
128
129
  react: (reaction: string, messageID: string, callback?: any) => Promise<any> | any;
129
130
  delete: (messageID: string | string[], callback?: any) => Promise<any> | any;
130
131
  sendTypingIndicator: (threadID: string, callback?: any) => Promise<any> | any;
132
+ pin: (messageID: string, threadID: string, callback?: any) => Promise<any> | any;
133
+ unpin: (messageID: string, threadID: string, callback?: any) => Promise<any> | any;
134
+ sendSticker: (stickerID: string, threadID: string, callback?: any) => Promise<any> | any;
135
+ getStickers: (query: string, callback?: any) => Promise<any> | any;
131
136
  };
132
137
  threads: {
133
138
  getInfo: (threadID: string, callback?: any) => Promise<ThreadInfo> | any;
@@ -146,6 +151,8 @@ interface FcaClient {
146
151
  createPoll: (title: string, options: Record<string, boolean> | string[], threadID: string, callback?: any) => Promise<any> | any;
147
152
  deleteThread: (threadID: string | string[], callback?: any) => Promise<any> | any;
148
153
  markAsRead: (threadID: string, callback?: any) => Promise<any> | any;
154
+ pinMessage: (messageID: string, threadID: string, callback?: any) => Promise<any> | any;
155
+ unpinMessage: (messageID: string, threadID: string, callback?: any) => Promise<any> | any;
149
156
  };
150
157
  users: {
151
158
  getInfo: (userIDs: string | string[], callback?: any) => Promise<Record<string, UserInfo>> | any;
@@ -162,6 +169,7 @@ interface FcaClient {
162
169
  getAppState: () => AppStateEntry[];
163
170
  setOptions: (options: Partial<LoginOptions>) => void;
164
171
  setBio: (bio: string, publishId?: boolean, callback?: any) => Promise<any> | any;
172
+ logout: (callback?: any) => Promise<any> | any;
165
173
  };
166
174
  realtime: {
167
175
  listen: (callback: (err: any, event: any) => void) => () => void;
@@ -180,6 +188,7 @@ interface FcaClient {
180
188
  }
181
189
  interface FcaApi {
182
190
  sendMessage: (message: string | MessagePayload, threadID: string, callback?: any) => Promise<any> | any;
191
+ sendMessageMqtt: (message: string | MessagePayload, threadID: string, callback?: any) => Promise<any> | any;
183
192
  editMessage: (text: string, messageID: string, callback?: any) => Promise<any> | any;
184
193
  replyMessage: (message: string | MessagePayload, messageID: string, callback?: any) => Promise<any> | any;
185
194
  unsendMessage: (messageID: string, callback?: any) => Promise<any> | any;
@@ -187,6 +196,12 @@ interface FcaApi {
187
196
  sendTypingIndicator: (threadID: string, callback?: any) => ((callback?: any) => void) | Promise<any> | any;
188
197
  deleteMessage: (messageID: string | string[], callback?: any) => Promise<any> | any;
189
198
  forwardAttachment: (attachmentID: string, threadID: string, callback?: any) => Promise<any> | any;
199
+ pinMessage: (messageID: string, threadID: string, callback?: any) => Promise<any> | any;
200
+ unpinMessage: (messageID: string, threadID: string, callback?: any) => Promise<any> | any;
201
+ getStickers: (query: string, callback?: any) => Promise<any> | any;
202
+ sendSticker: (stickerID: string, threadID: string, callback?: any) => Promise<any> | any;
203
+ shareContact: (text: string, senderID: string, threadID: string, callback?: any) => Promise<any> | any;
204
+ logout: (callback?: any) => Promise<any> | any;
190
205
  getThreadInfo: (threadID: string, callback?: any) => Promise<ThreadInfo> | any;
191
206
  getThreadList: (limit?: number, timestamp?: number, tags?: string[], callback?: any) => Promise<ThreadInfo[]> | any;
192
207
  getThreadHistory: (threadID: string, amount?: number, timestamp?: number, callback?: any) => Promise<any[]> | any;
package/dist/index.d.ts CHANGED
@@ -121,6 +121,7 @@ type MiddlewareFn = (event: any, api: any, next: () => void) => void | Promise<v
121
121
  interface FcaClient {
122
122
  messages: {
123
123
  send: (message: string | MessagePayload, threadID: string, callback?: any) => Promise<any> | any;
124
+ sendMqtt: (message: string | MessagePayload, threadID: string, callback?: any) => Promise<any> | any;
124
125
  edit: (text: string, messageID: string, callback?: any) => Promise<any> | any;
125
126
  reply: (message: string | MessagePayload, messageID: string, callback?: any) => Promise<any> | any;
126
127
  unsend: (messageID: string, callback?: any) => Promise<any> | any;
@@ -128,6 +129,10 @@ interface FcaClient {
128
129
  react: (reaction: string, messageID: string, callback?: any) => Promise<any> | any;
129
130
  delete: (messageID: string | string[], callback?: any) => Promise<any> | any;
130
131
  sendTypingIndicator: (threadID: string, callback?: any) => Promise<any> | any;
132
+ pin: (messageID: string, threadID: string, callback?: any) => Promise<any> | any;
133
+ unpin: (messageID: string, threadID: string, callback?: any) => Promise<any> | any;
134
+ sendSticker: (stickerID: string, threadID: string, callback?: any) => Promise<any> | any;
135
+ getStickers: (query: string, callback?: any) => Promise<any> | any;
131
136
  };
132
137
  threads: {
133
138
  getInfo: (threadID: string, callback?: any) => Promise<ThreadInfo> | any;
@@ -146,6 +151,8 @@ interface FcaClient {
146
151
  createPoll: (title: string, options: Record<string, boolean> | string[], threadID: string, callback?: any) => Promise<any> | any;
147
152
  deleteThread: (threadID: string | string[], callback?: any) => Promise<any> | any;
148
153
  markAsRead: (threadID: string, callback?: any) => Promise<any> | any;
154
+ pinMessage: (messageID: string, threadID: string, callback?: any) => Promise<any> | any;
155
+ unpinMessage: (messageID: string, threadID: string, callback?: any) => Promise<any> | any;
149
156
  };
150
157
  users: {
151
158
  getInfo: (userIDs: string | string[], callback?: any) => Promise<Record<string, UserInfo>> | any;
@@ -162,6 +169,7 @@ interface FcaClient {
162
169
  getAppState: () => AppStateEntry[];
163
170
  setOptions: (options: Partial<LoginOptions>) => void;
164
171
  setBio: (bio: string, publishId?: boolean, callback?: any) => Promise<any> | any;
172
+ logout: (callback?: any) => Promise<any> | any;
165
173
  };
166
174
  realtime: {
167
175
  listen: (callback: (err: any, event: any) => void) => () => void;
@@ -180,6 +188,7 @@ interface FcaClient {
180
188
  }
181
189
  interface FcaApi {
182
190
  sendMessage: (message: string | MessagePayload, threadID: string, callback?: any) => Promise<any> | any;
191
+ sendMessageMqtt: (message: string | MessagePayload, threadID: string, callback?: any) => Promise<any> | any;
183
192
  editMessage: (text: string, messageID: string, callback?: any) => Promise<any> | any;
184
193
  replyMessage: (message: string | MessagePayload, messageID: string, callback?: any) => Promise<any> | any;
185
194
  unsendMessage: (messageID: string, callback?: any) => Promise<any> | any;
@@ -187,6 +196,12 @@ interface FcaApi {
187
196
  sendTypingIndicator: (threadID: string, callback?: any) => ((callback?: any) => void) | Promise<any> | any;
188
197
  deleteMessage: (messageID: string | string[], callback?: any) => Promise<any> | any;
189
198
  forwardAttachment: (attachmentID: string, threadID: string, callback?: any) => Promise<any> | any;
199
+ pinMessage: (messageID: string, threadID: string, callback?: any) => Promise<any> | any;
200
+ unpinMessage: (messageID: string, threadID: string, callback?: any) => Promise<any> | any;
201
+ getStickers: (query: string, callback?: any) => Promise<any> | any;
202
+ sendSticker: (stickerID: string, threadID: string, callback?: any) => Promise<any> | any;
203
+ shareContact: (text: string, senderID: string, threadID: string, callback?: any) => Promise<any> | any;
204
+ logout: (callback?: any) => Promise<any> | any;
190
205
  getThreadInfo: (threadID: string, callback?: any) => Promise<ThreadInfo> | any;
191
206
  getThreadList: (limit?: number, timestamp?: number, tags?: string[], callback?: any) => Promise<ThreadInfo[]> | any;
192
207
  getThreadHistory: (threadID: string, amount?: number, timestamp?: number, callback?: any) => Promise<any[]> | any;
package/dist/index.mjs CHANGED
@@ -3,6 +3,7 @@ function createFcaClient(api) {
3
3
  const existingClient = api.client || {};
4
4
  const messages = {
5
5
  send: api.messages && api.messages.send || api.sendMessage || existingClient.messages && existingClient.messages.send || ((msg, tid) => ({ messageID: "mid." + Date.now(), threadID: tid })),
6
+ sendMqtt: api.messages && api.messages.sendMqtt || api.sendMessageMqtt || existingClient.messages && existingClient.messages.sendMqtt || ((msg, tid) => ({ messageID: "mid." + Date.now(), threadID: tid, viaMqtt: true })),
6
7
  edit: api.messages && api.messages.edit || api.editMessage || existingClient.messages && existingClient.messages.edit || ((text, mid) => ({ success: true, messageID: mid, text, timestamp: Date.now() })),
7
8
  reply: api.messages && api.messages.reply || api.replyMessage || existingClient.messages && existingClient.messages.reply || ((msg, mid) => ({ messageID: "mid." + Date.now(), replyTo: mid })),
8
9
  unsend: api.messages && api.messages.unsend || api.unsendMessage || existingClient.messages && existingClient.messages.unsend || ((mid) => ({ success: true, messageID: mid })),
@@ -10,7 +11,11 @@ function createFcaClient(api) {
10
11
  react: api.messages && api.messages.react || api.setMessageReaction || existingClient.messages && existingClient.messages.react || ((reaction, mid) => ({ success: true, reaction, messageID: mid })),
11
12
  delete: api.messages && api.messages.delete || api.deleteMessage || existingClient.messages && existingClient.messages.delete || ((mids) => ({ success: true, messageIDs: Array.isArray(mids) ? mids : [mids] })),
12
13
  sendTypingIndicator: api.messages && api.messages.sendTypingIndicator || api.sendTypingIndicator || existingClient.messages && existingClient.messages.sendTypingIndicator || ((tid) => () => {
13
- })
14
+ }),
15
+ pin: api.messages && api.messages.pin || api.pinMessage || existingClient.messages && existingClient.messages.pin || ((mid, tid) => ({ success: true, messageID: mid, threadID: tid, pinned: true })),
16
+ unpin: api.messages && api.messages.unpin || api.unpinMessage || existingClient.messages && existingClient.messages.unpin || ((mid, tid) => ({ success: true, messageID: mid, threadID: tid, pinned: false })),
17
+ sendSticker: api.messages && api.messages.sendSticker || api.sendSticker || existingClient.messages && existingClient.messages.sendSticker || ((sid, tid) => ({ success: true, stickerID: sid, threadID: tid })),
18
+ getStickers: api.messages && api.messages.getStickers || api.getStickers || existingClient.messages && existingClient.messages.getStickers || ((q) => [])
14
19
  };
15
20
  const threads = {
16
21
  getInfo: api.threads && api.threads.getInfo || api.getThreadInfo || existingClient.threads && existingClient.threads.getInfo || ((tid) => ({ threadID: tid, threadName: "Thread " + tid, participantIDs: [], isGroup: false })),
@@ -28,7 +33,9 @@ function createFcaClient(api) {
28
33
  removeUser: api.threads && api.threads.removeUser || api.removeUserFromGroup || existingClient.threads && existingClient.threads.removeUser || ((uid, tid) => ({ success: true, userID: uid, threadID: tid })),
29
34
  createPoll: api.threads && api.threads.createPoll || api.createPoll || existingClient.threads && existingClient.threads.createPoll || ((title, opts, tid) => ({ success: true, title, threadID: tid })),
30
35
  deleteThread: api.threads && api.threads.deleteThread || api.deleteThread || existingClient.threads && existingClient.threads.deleteThread || ((tids) => ({ success: true, threadIDs: tids })),
31
- markAsRead: api.threads && api.threads.markAsRead || api.markAsRead || existingClient.threads && existingClient.threads.markAsRead || ((tid) => ({ success: true, threadID: tid }))
36
+ markAsRead: api.threads && api.threads.markAsRead || api.markAsRead || existingClient.threads && existingClient.threads.markAsRead || ((tid) => ({ success: true, threadID: tid })),
37
+ pinMessage: api.threads && api.threads.pinMessage || api.pinMessage || existingClient.threads && existingClient.threads.pinMessage || ((mid, tid) => ({ success: true, messageID: mid, threadID: tid, pinned: true })),
38
+ unpinMessage: api.threads && api.threads.unpinMessage || api.unpinMessage || existingClient.threads && existingClient.threads.unpinMessage || ((mid, tid) => ({ success: true, messageID: mid, threadID: tid, pinned: false }))
32
39
  };
33
40
  const users = {
34
41
  getInfo: api.users && api.users.getInfo || api.getUserInfo || existingClient.users && existingClient.users.getInfo || ((ids) => {
@@ -49,7 +56,8 @@ function createFcaClient(api) {
49
56
  getAppState: api.account && api.account.getAppState || api.getAppState || existingClient.account && existingClient.account.getAppState || (() => []),
50
57
  setOptions: api.account && api.account.setOptions || api.setOptions || existingClient.account && existingClient.account.setOptions || (() => {
51
58
  }),
52
- setBio: api.account && api.account.setBio || api.setBio || existingClient.account && existingClient.account.setBio || ((bio) => ({ success: true, bio }))
59
+ setBio: api.account && api.account.setBio || api.setBio || existingClient.account && existingClient.account.setBio || ((bio) => ({ success: true, bio })),
60
+ logout: api.account && api.account.logout || api.logout || existingClient.account && existingClient.account.logout || (() => ({ success: true, loggedOut: true }))
53
61
  };
54
62
  const realtime = {
55
63
  listen: api.realtime && api.realtime.listen || api.listenMqtt || api.listen || existingClient.realtime && existingClient.realtime.listen || ((cb) => () => {
@@ -468,6 +476,66 @@ var FcaApiInstance = class {
468
476
  if (typeof callback === "function") callback(null, res);
469
477
  return res;
470
478
  }
479
+ async sendMessageMqtt(message, threadID, callback) {
480
+ const payload = typeof message === "string" ? { body: message } : message;
481
+ const result = {
482
+ messageID: `mid.$mqtt_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`,
483
+ threadID: String(threadID),
484
+ timestamp: Date.now(),
485
+ body: payload.body || "",
486
+ viaMqtt: true,
487
+ status: "sent"
488
+ };
489
+ if (typeof callback === "function") callback(null, result);
490
+ return result;
491
+ }
492
+ async pinMessage(messageID, threadID, callback) {
493
+ const result = { success: true, messageID: String(messageID), threadID: String(threadID), pinned: true, timestamp: Date.now() };
494
+ if (typeof callback === "function") callback(null, result);
495
+ return result;
496
+ }
497
+ async unpinMessage(messageID, threadID, callback) {
498
+ const result = { success: true, messageID: String(messageID), threadID: String(threadID), pinned: false, timestamp: Date.now() };
499
+ if (typeof callback === "function") callback(null, result);
500
+ return result;
501
+ }
502
+ async getStickers(query, callback) {
503
+ const queryStr = String(query || "").toLowerCase();
504
+ const stickers = [
505
+ { id: "12636236323", packID: "1001", name: queryStr || "thumbs_up", url: "https://static.xx.fbcdn.net/rsrc.php/v3/yI/r/qq3u4uS.png" },
506
+ { id: "12636236324", packID: "1001", name: "heart", url: "https://static.xx.fbcdn.net/rsrc.php/v3/yI/r/heart.png" }
507
+ ];
508
+ if (typeof callback === "function") callback(null, stickers);
509
+ return stickers;
510
+ }
511
+ async sendSticker(stickerID, threadID, callback) {
512
+ const result = {
513
+ messageID: `mid.$stk_${Date.now()}`,
514
+ threadID: String(threadID),
515
+ stickerID: String(stickerID),
516
+ timestamp: Date.now(),
517
+ status: "sent"
518
+ };
519
+ if (typeof callback === "function") callback(null, result);
520
+ return result;
521
+ }
522
+ async shareContact(text, senderID, threadID, callback) {
523
+ const result = {
524
+ messageID: `mid.$cnt_${Date.now()}`,
525
+ text: String(text || ""),
526
+ contactID: String(senderID),
527
+ threadID: String(threadID),
528
+ timestamp: Date.now()
529
+ };
530
+ if (typeof callback === "function") callback(null, result);
531
+ return result;
532
+ }
533
+ async logout(callback) {
534
+ this.stopListening();
535
+ const result = { success: true, loggedOut: true, timestamp: Date.now() };
536
+ if (typeof callback === "function") callback(null, result);
537
+ return result;
538
+ }
471
539
  async deleteThread(threadID, callback) {
472
540
  const tids = Array.isArray(threadID) ? threadID : [threadID];
473
541
  const res = { success: true, deletedThreadIDs: tids };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autobot-fca",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Unofficial Facebook Chat API for Node.js - Interact with Facebook Messenger programmatically",
5
5
  "main": "dist/cjs.cjs",
6
6
  "types": "dist/index.d.ts",