|
|
|
@ -48,6 +48,26 @@ const createWhatsApp = async phone => {
|
|
|
|
const { version, isLatest, } = { version: [2, 3000, 1025091846], isLatest: false };
|
|
|
|
const { version, isLatest, } = { version: [2, 3000, 1025091846], isLatest: false };
|
|
|
|
const waVersion = version.join('.') + ', ' + (isLatest ? 'latest' : 'out');
|
|
|
|
const waVersion = version.join('.') + ', ' + (isLatest ? 'latest' : 'out');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const stop = () => {
|
|
|
|
|
|
|
|
waSocket.logout(() => '实例已停止');
|
|
|
|
|
|
|
|
waEmitter.off('request.' + whatsAppNo + '.send.message', sendMessageHandler);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fs.rm(authStateFolder, { recursive: true, force: true }, (err) => {
|
|
|
|
|
|
|
|
if (err) {
|
|
|
|
|
|
|
|
console.error(`Error deleting authStateFolder directory: ${err.message}`);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
console.log('Successfully deleted authStateFolder directory: ', authStateFolder);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fs.unlink(storeFilename, (err) => {
|
|
|
|
|
|
|
|
if (err && err.code !== 'ENOENT') {
|
|
|
|
|
|
|
|
console.error(`Error deleting storeFilename file: ${err.message}`);
|
|
|
|
|
|
|
|
} else if (!err) {
|
|
|
|
|
|
|
|
console.log('Successfully deleted storeFilename file: ', storeFilename);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const start = () => {
|
|
|
|
const start = () => {
|
|
|
|
|
|
|
|
|
|
|
|
@ -350,6 +370,7 @@ const createWhatsApp = async phone => {
|
|
|
|
channelId: channelId,
|
|
|
|
channelId: channelId,
|
|
|
|
phone: phone,
|
|
|
|
phone: phone,
|
|
|
|
start,
|
|
|
|
start,
|
|
|
|
|
|
|
|
stop,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|