Merge branch 'main' of https://github.com/GeneralBots/BotServer
This commit is contained in:
commit
39f1907291
4 changed files with 32 additions and 15 deletions
|
@ -11,7 +11,8 @@
|
||||||
"João Ferreira <joao.parana@gmail.com>",
|
"João Ferreira <joao.parana@gmail.com>",
|
||||||
"Jorge Ramos <jramos@pobox.com>",
|
"Jorge Ramos <jramos@pobox.com>",
|
||||||
"PH <ph.an@outlook.com>",
|
"PH <ph.an@outlook.com>",
|
||||||
"Dário Vieira <dario.junior3@gmail.com>"
|
"Dário Vieira <dario.junior3@gmail.com>",
|
||||||
|
"Alan Perdomo <alanperdomo@hotmail.com>"
|
||||||
],
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "=19.7.0"
|
"node": "=19.7.0"
|
||||||
|
@ -143,6 +144,7 @@
|
||||||
"puppeteer-extra": "3.3.4",
|
"puppeteer-extra": "3.3.4",
|
||||||
"puppeteer-extra-plugin-stealth": "2.11.1",
|
"puppeteer-extra-plugin-stealth": "2.11.1",
|
||||||
"qrcode": "1.5.1",
|
"qrcode": "1.5.1",
|
||||||
|
"qr-scanner": "^1.4.2",
|
||||||
"qrcode-terminal": "0.12.0",
|
"qrcode-terminal": "0.12.0",
|
||||||
"readline": "1.3.0",
|
"readline": "1.3.0",
|
||||||
"reflect-metadata": "0.1.13",
|
"reflect-metadata": "0.1.13",
|
||||||
|
|
|
@ -59,6 +59,7 @@ import qrcode from 'qrcode';
|
||||||
import { json } from 'body-parser';
|
import { json } from 'body-parser';
|
||||||
import { WebAutomationServices } from './WebAutomationServices.js';
|
import { WebAutomationServices } from './WebAutomationServices.js';
|
||||||
import urljoin from 'url-join';
|
import urljoin from 'url-join';
|
||||||
|
import QrScanner from 'qr-scanner';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default check interval for user replay
|
* Default check interval for user replay
|
||||||
|
@ -809,8 +810,7 @@ export class DialogKeywords {
|
||||||
if (results.text[index][0] !== '') {
|
if (results.text[index][0] !== '') {
|
||||||
list.push(results.text[index][0]);
|
list.push(results.text[index][0]);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -945,6 +945,13 @@ export class DialogKeywords {
|
||||||
}
|
}
|
||||||
|
|
||||||
result = phoneNumber;
|
result = phoneNumber;
|
||||||
|
} else if (kind === 'qr-scanner'){
|
||||||
|
//https://github.com/GeneralBots/BotServer/issues/171
|
||||||
|
GBLog.info(`BASIC (${min.botId}): Upload done for ${answer.filename}.`);
|
||||||
|
const handle = WebAutomationServices.cyrb53(this.min.botId + answer.filename);
|
||||||
|
GBServer.globals.files[handle] = answer;
|
||||||
|
QrScanner.scanImage(GBServer.globals.files[handle]).then(result => console.log(result)).catch(error => console.log(error || 'no QR code found.'));
|
||||||
|
|
||||||
} else if (kind === 'zipcode') {
|
} else if (kind === 'zipcode') {
|
||||||
const extractEntity = (text: string) => {
|
const extractEntity = (text: string) => {
|
||||||
text = text.replace(/\-/gi, '');
|
text = text.replace(/\-/gi, '');
|
||||||
|
@ -1074,6 +1081,7 @@ export class DialogKeywords {
|
||||||
|
|
||||||
await min.conversationalService['sendOnConversation'](min, user, text);
|
await min.conversationalService['sendOnConversation'](min, user, text);
|
||||||
}
|
}
|
||||||
|
return { status: 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
private static getChannel(): string {
|
private static getChannel(): string {
|
||||||
|
|
|
@ -139,7 +139,7 @@ export class KeywordsExpressions {
|
||||||
/^\s*open\s*(.*)/gim,
|
/^\s*open\s*(.*)/gim,
|
||||||
($0, $1, $2) => {
|
($0, $1, $2) => {
|
||||||
let sessionName;
|
let sessionName;
|
||||||
let kind = '';
|
let kind = null;
|
||||||
let pos;
|
let pos;
|
||||||
|
|
||||||
if (pos = $1.match(/\s*AS\s*\#/)) {
|
if (pos = $1.match(/\s*AS\s*\#/)) {
|
||||||
|
@ -247,6 +247,13 @@ export class KeywordsExpressions {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
keywords[i++] = [
|
||||||
|
/^\s*hear (\w+) as\s*qrcode/gim,
|
||||||
|
($0, $1) => {
|
||||||
|
return `${$1} = await dk.getHear({pid: pid, kind:"qrcode")}`;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
keywords[i++] = [
|
keywords[i++] = [
|
||||||
/^\s*hear (\w+) as\s*language/gim,
|
/^\s*hear (\w+) as\s*language/gim,
|
||||||
($0, $1) => {
|
($0, $1) => {
|
||||||
|
@ -655,7 +662,7 @@ export class KeywordsExpressions {
|
||||||
// page is not string.
|
// page is not string.
|
||||||
// https://github.com/GeneralBots/BotServer/issues/310
|
// https://github.com/GeneralBots/BotServer/issues/310
|
||||||
const params = this.getParams('page,' + $3, ['handle', 'frameOrSelector', 'selector']);
|
const params = this.getParams('page,' + $3, ['handle', 'frameOrSelector', 'selector']);
|
||||||
return `await wa.click ({pid: pid, ${params}})`;
|
return `await wa.getClick ({pid: pid, ${params}})`;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -764,7 +771,7 @@ export class KeywordsExpressions {
|
||||||
/^\s*set\s*(.*)/gim,
|
/^\s*set\s*(.*)/gim,
|
||||||
($0, $1, $2) => {
|
($0, $1, $2) => {
|
||||||
const params = this.getParams($1, ['file', 'address', 'value']);
|
const params = this.getParams($1, ['file', 'address', 'value']);
|
||||||
return `await sys.set ({pid: pid, ${params}})`;
|
return `await sys.getSet ({pid: pid, handle:page, ${params}})`;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
keywords[i++] = [
|
keywords[i++] = [
|
||||||
|
|
|
@ -245,7 +245,7 @@ export class WebAutomationServices {
|
||||||
*
|
*
|
||||||
* @example CLICK page,"#idElement"
|
* @example CLICK page,"#idElement"
|
||||||
*/
|
*/
|
||||||
public async click({ pid, handle, frameOrSelector, selector }) {
|
public async getClick({ pid, handle, frameOrSelector, selector }) {
|
||||||
const page = this.getPageByHandle(handle);
|
const page = this.getPageByHandle(handle);
|
||||||
GBLog.info(`BASIC: Web Automation CLICK element: ${frameOrSelector}.`);
|
GBLog.info(`BASIC: Web Automation CLICK element: ${frameOrSelector}.`);
|
||||||
if (selector) {
|
if (selector) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue