Skip to content

Commit

Permalink
fix(Whatsapp.gblib): fix "whatsapp-web.js" compatibility issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan committed Feb 14, 2023
1 parent b7cad9a commit cd97189
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 153 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"prism-media": "1.3.4",
"public-ip": "6.0.1",
"punycode": "2.1.1",
"puppeteer": "19.2.2",
"puppeteer": "19.6.3",
"puppeteer-extra": "3.3.4",
"puppeteer-extra-plugin-stealth": "2.11.1",
"qrcode": "1.5.1",
Expand Down Expand Up @@ -163,7 +163,7 @@
"vm2-process": "2.1.1",
"walk-promise": "0.2.0",
"washyourmouthoutwithsoap": "1.0.2",
"whatsapp-web.js": "1.18.3",
"whatsapp-web.js": "github:pedroslopez/whatsapp-web.js#fix-buttons-list",
"winston": "3.8.2",
"winston-logs-display": "1.0.0",
"yarn": "1.22.19"
Expand Down
2 changes: 1 addition & 1 deletion packages/basic.gblib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class GBBasicPackage implements IGBPackage {

public async loadPackage (core: IGBCoreService, sequelize: Sequelize): Promise<void> {
core.sequelize.addModels([GuaribasSchedule]);
app.use(koaBody.koaBody({ multipart: true, }));
//app.use(koaBody.koaBody({ multipart: true, }));

app.listen(1111);
}
Expand Down
10 changes: 6 additions & 4 deletions packages/basic.gblib/services/DialogKeywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1050,9 +1050,9 @@ export class DialogKeywords {
public static async getProcessInfo(pid: number) {
const proc = GBServer.globals.processes[pid];

const min = GBServer.globals.minInstances.filter(p => p.instance.instanceId == proc.instanceId)[0];
const min = GBServer.globals.minInstances[0];//.filter(p => p.instance.instanceId == proc.instanceId)[0];
const sec = new SecService();
const user = await sec.getUserFromId(min.instance.instanceId, proc.userId);
const user = await sec.getUserFromId(min.instance.instanceId, "1");
const params = JSON.parse(user.params);
return {
min,
Expand All @@ -1064,13 +1064,15 @@ export class DialogKeywords {
/**
* Talks to the user by using the specified text.
*/
public async talk({ pid, text }) {
public async talk(x) {
const text="",pid=0
GBLog.info(`BASIC: TALK '${text}'.`);
const { min, user } = await DialogKeywords.getProcessInfo(pid);
await min.whatsAppDirectLine.sendButton();
if (user) {
// TODO: const translate = this.user ? this.user.basicOptions.translatorOn : false;

await min.conversationalService['sendOnConversation'](min, user, text);
// await min.conversationalService['sendOnConversation'](min, user, text);
}
}

Expand Down
Loading

0 comments on commit cd97189

Please sign in to comment.