Skip to content

Commit

Permalink
update v3.0.1 fix logout issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mimamch committed Jun 11, 2023
1 parent a574d98 commit be1b6fc
Show file tree
Hide file tree
Showing 8 changed files with 211 additions and 442 deletions.
625 changes: 197 additions & 428 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wa-multi-session",
"version": "2.1.0",
"version": "3.0.1",
"description": "Multi Session Whatsapp Library",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -15,8 +15,9 @@
"author": "mimamch",
"license": "ISC",
"dependencies": {
"@adiwajshing/baileys": "^4.3.0",
"@adiwajshing/keyed-db": "^0.2.4",
"@hapi/boom": "^10.0.1",
"@whiskeysockets/baileys": "^6.2.1",
"pino": "^8.11.0",
"qrcode-terminal": "^0.12.0"
},
Expand Down
7 changes: 4 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Connecting Your app with Whatsapp Messaging

Lightweight library for whatsapp. Not require Selenium or any other browser.

Stand above [Baileys](https://github.com/adiwajshing/Baileys) Library.
Stand above [Baileys](https://github.com/WhiskeySockets/Baileys) Library.

## Installation

Expand Down Expand Up @@ -195,9 +195,10 @@ whatsapp.setCredentialsDir("my_custom_dir");
// or : credentials/mycreds
```

## Change Log v2.0.0
## Change Log v3.0.0 June 2023

- Disable auto load session from storage
- Fix Logout Issue
- Switching into [@whiskeysockets/baileys](https://github.com/WhiskeySockets/Baileys)

## Authors

Expand Down
2 changes: 1 addition & 1 deletion src/Messaging/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { proto, WASocket } from "@adiwajshing/baileys";
import { proto, WASocket } from "@whiskeysockets/baileys";
import { Messages } from "../Defaults";
import { getSession } from "../Socket";
import {
Expand Down
8 changes: 3 additions & 5 deletions src/Socket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import makeWASocket, {
fetchLatestBaileysVersion,
useMultiFileAuthState,
WASocket,
} from "@adiwajshing/baileys";
} from "@whiskeysockets/baileys";
import pino from "pino";
import path from "path";
import { Boom } from "@hapi/boom";
Expand All @@ -17,7 +17,6 @@ import {
saveVideoHandler,
} from "../Utils/save-media";

const msgRetryCounterMap = {};
const sessions: Map<string, WASocket> = new Map();

const callback: Map<string, Function> = new Map();
Expand All @@ -27,7 +26,7 @@ const retryCount: Map<string, number> = new Map();
export const startSession = async (
sessionId = "mysession",
options: StartSessionParams = { printQR: false }
) => {
): Promise<WASocket> => {
if (isSessionExistAndRunning(sessionId))
throw new Error(Messages.sessionAlreadyExist(sessionId));
const logger = pino({ level: "silent" });
Expand All @@ -42,7 +41,6 @@ export const startSession = async (
printQRInTerminal: options.printQR,
auth: state,
logger,
msgRetryCounterMap,
markOnlineOnConnect: false,
browser: Browsers.ubuntu("Chrome"),
});
Expand Down Expand Up @@ -90,7 +88,7 @@ export const startSession = async (
}
if (events["messages.upsert"]) {
const msg = events["messages.upsert"]
.messages?.[0] as MessageReceived;
.messages?.[0] as unknown as MessageReceived;
msg.sessionId = sessionId;
msg.saveImage = (path) => saveImageHandler(msg, path);
msg.saveVideo = (path) => saveVideoHandler(msg, path);
Expand Down
2 changes: 1 addition & 1 deletion src/Types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { proto } from "@adiwajshing/baileys";
import { proto } from "@whiskeysockets/baileys";

export interface SendMessageTypes {
to: string | number;
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/save-media.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { downloadMediaMessage } from "@adiwajshing/baileys";
import { downloadMediaMessage } from "@whiskeysockets/baileys";
import { MessageReceived } from "../Types";
import ValidationError from "./error";
import fs from "fs/promises";
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

/* Emit */
"declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
"declarationMap": true /* Create sourcemaps for d.ts files. */,
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
Expand Down

0 comments on commit be1b6fc

Please # to comment.