[core] get engine info
This commit is contained in:
1 parent
9d489bdb69
commit
4719cded95
4 files changed
+17
No files matched your search
@@ -425,6 +425,10 @@ export abstract class WhatsappSession {
|
||||
throw new NotImplementedByEngineError();
|
||||
}
|
||||
|
||||
public async getEngineInfo(): Promise<any> {
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
* END - Methods for API
|
||||
*/
|
||||
|
||||
@@ -622,6 +622,13 @@ export class WhatsappSessionWebJSCore extends WhatsappSession {
|
||||
});
|
||||
}
|
||||
|
||||
public async getEngineInfo() {
|
||||
return {
|
||||
WWebVersion: await this.whatsapp?.getWWebVersion(),
|
||||
state: await this.whatsapp?.getState(),
|
||||
};
|
||||
}
|
||||
|
||||
protected toWAContact(contact: Contact) {
|
||||
// @ts-ignore
|
||||
contact.id = contact.id._serialized;
|
||||
|
||||
@@ -213,12 +213,17 @@ export class SessionManagerCore extends SessionManager {
|
||||
];
|
||||
}
|
||||
const me = await this.session.getSessionMeInfo().catch((err) => null);
|
||||
const engine = {
|
||||
engine: this.session?.engine,
|
||||
...(await this.session?.getEngineInfo().catch((err) => ({}))),
|
||||
};
|
||||
return [
|
||||
{
|
||||
name: this.session.name,
|
||||
status: this.session.status,
|
||||
config: this.session.sessionConfig,
|
||||
me: me,
|
||||
engine: engine,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -79,4 +79,5 @@ export class MeInfo {
|
||||
|
||||
export class SessionInfo extends SessionDTO {
|
||||
me?: MeInfo;
|
||||
engine?: any;
|
||||
}
|
||||
Reference in new issue
Block a user