@dongdev/fca-unofficial 3.0.23 → 3.0.27
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 +6 -0
- package/DOCS.md +3 -3
- package/Fca_Database/database.sqlite +0 -0
- package/LICENSE-MIT +1 -1
- package/README.md +1 -1
- package/index.d.ts +1 -1
- package/module/config.js +3 -7
- package/module/login.js +2 -4
- package/module/loginHelper.js +479 -287
- package/package.json +6 -7
- package/src/api/messaging/changeAdminStatus.js +56 -52
- package/src/api/messaging/changeGroupImage.js +2 -1
- package/src/api/messaging/changeThreadEmoji.js +47 -42
- package/src/api/messaging/createPoll.js +46 -43
- package/src/api/messaging/deleteMessage.js +110 -30
- package/src/api/messaging/forwardAttachment.js +28 -22
- package/src/api/messaging/removeUserFromGroup.js +11 -55
- package/src/api/messaging/sendMessage.js +15 -17
- package/src/api/messaging/sendTypingIndicator.js +23 -16
- package/src/api/messaging/setMessageReaction.js +91 -76
- package/src/api/messaging/setTitle.js +47 -42
- package/src/api/messaging/shareContact.js +1 -1
- package/src/api/messaging/uploadAttachment.js +471 -73
- package/src/api/socket/core/connectMqtt.js +0 -5
- package/src/api/socket/core/emitAuth.js +1 -8
- package/src/api/socket/core/getSeqID.js +292 -10
- package/src/api/socket/listenMqtt.js +15 -7
- package/src/utils/client.js +2 -312
- package/src/utils/cookies.js +68 -0
- package/src/utils/format.js +117 -90
- package/src/utils/loginParser.js +347 -0
- package/src/utils/messageFormat.js +1173 -0
package/CHANGELOG.md
CHANGED
package/DOCS.md
CHANGED
|
@@ -1568,7 +1568,7 @@ Add reaction (like, love, haha, wow, sad, angry) to message.
|
|
|
1568
1568
|
|
|
1569
1569
|
#### Syntax:
|
|
1570
1570
|
```javascript
|
|
1571
|
-
api.setMessageReaction(reaction, messageID, callback);
|
|
1571
|
+
api.setMessageReaction(reaction, messageID, threadID, callback, forceCustomReaction);
|
|
1572
1572
|
```
|
|
1573
1573
|
|
|
1574
1574
|
#### Example:
|
|
@@ -1587,7 +1587,7 @@ api.listenMqtt((err, event) => {
|
|
|
1587
1587
|
if (err) return console.error(err);
|
|
1588
1588
|
|
|
1589
1589
|
if (event.type === "message" && event.body === "React me") {
|
|
1590
|
-
api.setMessageReaction("❤️", event.messageID, (err) => {
|
|
1590
|
+
api.setMessageReaction("❤️", event.messageID, event.threadID, (err) => {
|
|
1591
1591
|
if (err) {
|
|
1592
1592
|
console.error("React error:", err);
|
|
1593
1593
|
return;
|
|
@@ -1598,7 +1598,7 @@ api.listenMqtt((err, event) => {
|
|
|
1598
1598
|
});
|
|
1599
1599
|
|
|
1600
1600
|
// Remove reaction
|
|
1601
|
-
api.setMessageReaction("", "mid.xxx", (err) => {
|
|
1601
|
+
api.setMessageReaction("", "mid.xxx", "1234567890", (err) => {
|
|
1602
1602
|
if (err) return console.error(err);
|
|
1603
1603
|
console.log("Reaction removed!");
|
|
1604
1604
|
});
|
|
Binary file
|
package/LICENSE-MIT
CHANGED
package/README.md
CHANGED
|
@@ -343,7 +343,7 @@ api.deleteMessage(messageID, callback);
|
|
|
343
343
|
api.unsendMessage(messageID, callback);
|
|
344
344
|
|
|
345
345
|
// Set message reaction
|
|
346
|
-
api.setMessageReaction(reaction, messageID, callback);
|
|
346
|
+
api.setMessageReaction(reaction, messageID, threadID, callback, forceCustomReaction);
|
|
347
347
|
|
|
348
348
|
// Forward attachment
|
|
349
349
|
api.forwardAttachment(attachmentID, threadID, callback);
|
package/index.d.ts
CHANGED
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
pinMessage: (pinMode: boolean, messageID: string, threadID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
144
144
|
|
|
145
145
|
// Reactions & Interactions
|
|
146
|
-
setMessageReaction: (reaction: string, messageID: string, callback?: (err?: Error) => void, forceCustomReaction?: boolean) => Promise<void>;
|
|
146
|
+
setMessageReaction: (reaction: string, messageID: string, threadID: string, callback?: (err?: Error) => void, forceCustomReaction?: boolean) => Promise<void>;
|
|
147
147
|
setMessageReactionMqtt: (reaction: string, messageID: string, threadID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
148
148
|
sendTypingIndicator: (threadID: string, callback?: (err?: Error) => void) => Promise<void>;
|
|
149
149
|
sendTypingIndicatorMqtt: (isTyping: boolean, threadID: string, callback?: (err?: Error) => void) => Promise<void>;
|
package/module/config.js
CHANGED
|
@@ -5,6 +5,8 @@ const defaultConfig = {
|
|
|
5
5
|
autoUpdate: true,
|
|
6
6
|
mqtt: { enabled: true, reconnectInterval: 3600 },
|
|
7
7
|
autoLogin: true,
|
|
8
|
+
apiServer: "https://minhdong.site",
|
|
9
|
+
apiKey: "",
|
|
8
10
|
credentials: { email: "", password: "", twofactor: "" }
|
|
9
11
|
};
|
|
10
12
|
|
|
@@ -12,13 +14,7 @@ function loadConfig() {
|
|
|
12
14
|
const configPath = path.join(process.cwd(), "fca-config.json");
|
|
13
15
|
let config;
|
|
14
16
|
if (!fs.existsSync(configPath)) {
|
|
15
|
-
|
|
16
|
-
fs.writeFileSync(configPath, JSON.stringify(defaultConfig, null, 2));
|
|
17
|
-
config = defaultConfig;
|
|
18
|
-
} catch (err) {
|
|
19
|
-
logger(`Error writing config file: ${err.message}`, "error");
|
|
20
|
-
config = defaultConfig;
|
|
21
|
-
}
|
|
17
|
+
config = defaultConfig;
|
|
22
18
|
} else {
|
|
23
19
|
try {
|
|
24
20
|
const fileContent = fs.readFileSync(configPath, "utf8");
|
package/module/login.js
CHANGED
|
@@ -48,8 +48,7 @@ if (!global.fca._errorHandlersInstalled) {
|
|
|
48
48
|
// For other unhandled rejections, log but don't crash
|
|
49
49
|
logger(`Unhandled promise rejection (non-fatal): ${reason && reason.message ? reason.message : String(reason)}`, "error");
|
|
50
50
|
} catch (e) {
|
|
51
|
-
// Fallback if logger fails
|
|
52
|
-
console.error("[FCA-ERROR] Unhandled promise rejection:", reason);
|
|
51
|
+
// Fallback if logger fails - silent
|
|
53
52
|
}
|
|
54
53
|
});
|
|
55
54
|
|
|
@@ -78,8 +77,7 @@ if (!global.fca._errorHandlersInstalled) {
|
|
|
78
77
|
// Note: We don't exit here to allow bot to continue running
|
|
79
78
|
// In production, you might want to restart the process instead
|
|
80
79
|
} catch (e) {
|
|
81
|
-
// Fallback if logger fails
|
|
82
|
-
console.error("[FCA-ERROR] Uncaught exception:", error);
|
|
80
|
+
// Fallback if logger fails - silent
|
|
83
81
|
}
|
|
84
82
|
});
|
|
85
83
|
}
|