diff --git a/README.md b/README.md
index 346cc5b1..2a0c4da2 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,8 @@
+
+
+
+
+
| Area | Status |
|------------------------------|----------------------------------------------------------------------------------------------------|
| Releases | [](https://www.npmjs.com/package/botserver/) [](https://www.npmjs.com/package/botlib/) [](https://github.com/semantic-release/semantic-release)|
@@ -111,6 +116,6 @@ trademark license. Therefore any rights, title and interest in
our trademarks remain entirely with us.
:speech_balloon: Ask a question :book: Read the Docs
-
+Team pictures made with [contrib.rocks](https://contrib.rocks).
General Bots Code Name is [Guaribas](https://en.wikipedia.org/wiki/Guaribas), the name of a city in Brazil, state of Piaui.
[Roberto Mangabeira Unger](http://www.robertounger.com/en/): "No one should have to do work that can be done by a machine".
diff --git a/packages/basic.gblib/services/DialogKeywords.ts b/packages/basic.gblib/services/DialogKeywords.ts
index 082ff404..ee1b224a 100644
--- a/packages/basic.gblib/services/DialogKeywords.ts
+++ b/packages/basic.gblib/services/DialogKeywords.ts
@@ -60,7 +60,7 @@ import QrScanner from 'qr-scanner';
import pkg from 'whatsapp-web.js';
import { ActivityTypes } from 'botbuilder';
const { List, Buttons } = pkg;
-import mime from 'mime';
+import mime from 'mime-types';
/**
* Default check interval for user replay
diff --git a/packages/hubspot.gblib/index.ts b/packages/hubspot.gblib/index.ts
index 62ef6c7c..7adfbf6d 100644
--- a/packages/hubspot.gblib/index.ts
+++ b/packages/hubspot.gblib/index.ts
@@ -45,26 +45,26 @@ import { Sequelize } from 'sequelize-typescript';
export class GBHubSpotPackage implements IGBPackage {
public sysPackages: IGBPackage[];
- public async loadBot (min: GBMinInstance): Promise {
+ public async loadBot(min: GBMinInstance): Promise {
GBLog.verbose(`loadBot called.`);
}
- public async getDialogs (min: GBMinInstance) {
+ public async getDialogs(min: GBMinInstance) {
GBLog.verbose(`getDialogs called.`);
}
- public async loadPackage (core: IGBCoreService, sequelize: Sequelize): Promise {
+ public async loadPackage(core: IGBCoreService, sequelize: Sequelize): Promise {
GBLog.verbose(`loadPackage called.`);
}
- public async unloadPackage (core: IGBCoreService): Promise {
+ public async unloadPackage(core: IGBCoreService): Promise {
GBLog.verbose(`unloadPackage called.`);
}
- public async unloadBot (min: GBMinInstance): Promise {
+ public async unloadBot(min: GBMinInstance): Promise {
GBLog.verbose(`unloadBot called.`);
}
- public async onNewSession (min: GBMinInstance, step: GBDialogStep): Promise {
+ public async onNewSession(min: GBMinInstance, step: GBDialogStep): Promise {
GBLog.verbose(`onNewSession called.`);
}
- public async onExchangeData (min: GBMinInstance, kind: string, data: any) {
+ public async onExchangeData(min: GBMinInstance, kind: string, data: any) {
GBLog.verbose(`onExchangeData called.`);
}
}
diff --git a/packages/hubspot.gblib/services/HubSpotServices.ts b/packages/hubspot.gblib/services/HubSpotServices.ts
index 17fa3a3c..41855b46 100644
--- a/packages/hubspot.gblib/services/HubSpotServices.ts
+++ b/packages/hubspot.gblib/services/HubSpotServices.ts
@@ -38,4 +38,4 @@ import * as hubspot from '@hubspot/api-client';
/**
* Support for Hub Spot XRM.
*/
-export class HubSpotServices extends GBService {}
+export class HubSpotServices extends GBService { }
diff --git a/packages/kb.gbapp/dialogs/AskDialog.ts b/packages/kb.gbapp/dialogs/AskDialog.ts
index 640588f5..7c2bb64c 100644
--- a/packages/kb.gbapp/dialogs/AskDialog.ts
+++ b/packages/kb.gbapp/dialogs/AskDialog.ts
@@ -106,11 +106,11 @@ export class AskDialog extends IGBDialog {
if (step.options && step.options.firstTime) {
text = Messages[locale].ask_first_time;
- }
- else if (step.options && step.options.isReturning && !step.context.activity.group) {
- text = Messages[locale].anything_else;
- }
- else if (step.context.activity.group || (step.options && step.options.emptyPrompt)) {
+ }
+ else if (step.options && step.options.isReturning && !step.context.activity.group) {
+ text = Messages[locale].anything_else;
+ }
+ else if (step.context.activity.group || (step.options && step.options.emptyPrompt)) {
text = '';
} else if (user.subjects.length > 0) {
text = Messages[locale].which_question;
@@ -391,14 +391,14 @@ export class AskDialog extends IGBDialog {
async step => {
if (GBServer.globals.chatGPT) {
let input = `Write a BASIC program that ${step.options.dialog.toLowerCase()}. And does not explain.`;
-
+
await min.conversationalService.sendText(min, step, 'Thank you. The dialog is being written right now...');
const CHATGPT_TIMEOUT = 3 * 60 * 1000;
GBLog.info(`ChatGPT Code: ${input}`);
let response = await GBServer.globals.chatGPT.sendMessage(input, {
timeoutMs: CHATGPT_TIMEOUT
- });
+ });
// Removes instructions, just code.
@@ -409,17 +409,17 @@ export class AskDialog extends IGBDialog {
// Gets dialog name and file handling
- let dialogName = step.result.replace('.', '');
+ let dialogName = step.result.replace('.', '');
const docx = urlJoin(`${min.botId}.gbdialog`, `${dialogName}.docx`);
const sys = new SystemKeywords();
const document = await sys.internalCreateDocument(min, docx, response);
- await service.addQA(min, dialogName, dialogName);
+ await service.addQA(min, dialogName, dialogName);
let message = `Waiting for publishing...`;
await min.conversationalService.sendText(min, step, message);
await step.replaceDialog('/publish', { confirm: true });
-
+
message = `Dialog is ready! Let's run:`;
await min.conversationalService.sendText(min, step, message);
@@ -439,7 +439,7 @@ export class AskDialog extends IGBDialog {
await step.endDialog();
await GBVMService.callVM(dialogName.toLowerCase(),
- min, step, user, this.deployer, false);
+ min, step, user, this.deployer, false);
}
}
];
diff --git a/packages/kb.gbapp/dialogs/FaqDialog.ts b/packages/kb.gbapp/dialogs/FaqDialog.ts
index 32ca2073..8a242481 100644
--- a/packages/kb.gbapp/dialogs/FaqDialog.ts
+++ b/packages/kb.gbapp/dialogs/FaqDialog.ts
@@ -53,7 +53,7 @@ export class FaqDialog extends IGBDialog {
* @param bot The bot adapter.
* @param min The minimal bot instance data.
*/
- public static setup (bot: BotAdapter, min: GBMinInstance) {
+ public static setup(bot: BotAdapter, min: GBMinInstance) {
const service = new KBService(min.core.sequelize);
min.dialogs.add(
diff --git a/packages/kb.gbapp/dialogs/MenuDialog.ts b/packages/kb.gbapp/dialogs/MenuDialog.ts
index ea5a1b5b..ebcb73dd 100644
--- a/packages/kb.gbapp/dialogs/MenuDialog.ts
+++ b/packages/kb.gbapp/dialogs/MenuDialog.ts
@@ -64,13 +64,13 @@ export class MenuDialog extends IGBDialog {
* @param bot The bot adapter.
* @param min The minimal bot instance data.
*/
- public static setup (bot: BotAdapter, min: GBMinInstance) {
+ public static setup(bot: BotAdapter, min: GBMinInstance) {
const service = new KBService(min.core.sequelize);
min.dialogs.add(new WaterfallDialog('/menu', MenuDialog.getMenuDialog(min, service)));
}
- private static getMenuDialog (min: GBMinInstance, service: KBService) {
+ private static getMenuDialog(min: GBMinInstance, service: KBService) {
return [
async step => {
if (step.context.activity.channelId !== 'msteams' && process.env.ENABLE_AUTH) {
diff --git a/packages/kb.gbapp/index.ts b/packages/kb.gbapp/index.ts
index 90e86562..375fa23d 100644
--- a/packages/kb.gbapp/index.ts
+++ b/packages/kb.gbapp/index.ts
@@ -48,26 +48,26 @@ import { GuaribasAnswer, GuaribasQuestion, GuaribasSubject } from './models/inde
*/
export class GBKBPackage implements IGBPackage {
public sysPackages: IGBPackage[];
- public async getDialogs (min: GBMinInstance) {
+ public async getDialogs(min: GBMinInstance) {
GBLog.verbose(`getDialogs called.`);
}
- public async unloadPackage (core: IGBCoreService): Promise {
+ public async unloadPackage(core: IGBCoreService): Promise {
GBLog.verbose(`unloadPackage called.`);
}
- public async unloadBot (min: GBMinInstance): Promise {
+ public async unloadBot(min: GBMinInstance): Promise {
GBLog.verbose(`unloadBot called.`);
}
- public async onNewSession (min: GBMinInstance, step: GBDialogStep): Promise {
+ public async onNewSession(min: GBMinInstance, step: GBDialogStep): Promise {
GBLog.verbose(`onNewSession called.`);
}
- public async onExchangeData (min: GBMinInstance, kind: string, data: any) {
+ public async onExchangeData(min: GBMinInstance, kind: string, data: any) {
GBLog.verbose(`onExchangeData called.`);
}
- public async loadPackage (core: IGBCoreService, sequelize: Sequelize): Promise {
+ public async loadPackage(core: IGBCoreService, sequelize: Sequelize): Promise {
core.sequelize.addModels([GuaribasAnswer, GuaribasQuestion, GuaribasSubject]);
}
- public async loadBot (min: GBMinInstance): Promise {
+ public async loadBot(min: GBMinInstance): Promise {
AskDialog.setup(min.bot, min);
FaqDialog.setup(min.bot, min);
MenuDialog.setup(min.bot, min);
diff --git a/packages/kb.gbapp/services/KBService.ts b/packages/kb.gbapp/services/KBService.ts
index 0219f40e..3065bd15 100644
--- a/packages/kb.gbapp/services/KBService.ts
+++ b/packages/kb.gbapp/services/KBService.ts
@@ -646,10 +646,10 @@ export class KBService implements IGBKBService {
packageId: pkg.packageId,
prevId: 0
};
- const a =await GuaribasAnswer.create(answer);
+ const a = await GuaribasAnswer.create(answer);
question['answerId'] = a.answerId;
const q = await GuaribasQuestion.create(question);
-
+
}
public async importKbPackage(
diff --git a/packages/security.gbapp/dialogs/OAuthDialog.ts b/packages/security.gbapp/dialogs/OAuthDialog.ts
index 140e68db..1538eaac 100644
--- a/packages/security.gbapp/dialogs/OAuthDialog.ts
+++ b/packages/security.gbapp/dialogs/OAuthDialog.ts
@@ -44,7 +44,7 @@ import { Messages } from '../strings.js';
* Dialogs for handling Menu control.
*/
export class OAuthDialog extends IGBDialog {
- public static getOAuthDialog (min: GBMinInstance) {
+ public static getOAuthDialog(min: GBMinInstance) {
return {
id: '/auth',
waterfall: [
diff --git a/packages/security.gbapp/dialogs/ProfileDialog.ts b/packages/security.gbapp/dialogs/ProfileDialog.ts
index ae0ba8ba..d6442ff4 100644
--- a/packages/security.gbapp/dialogs/ProfileDialog.ts
+++ b/packages/security.gbapp/dialogs/ProfileDialog.ts
@@ -39,13 +39,13 @@
import { GBLog, GBMinInstance, IGBDialog } from 'botlib';
import { GBAdminService } from '../../admin.gbapp/services/GBAdminService.js';
import { Messages } from '../strings.js';
-import * as phone from 'google-libphonenumber';
+import * as phone from 'google-libphonenumber';
/**
* Dialogs for handling Menu control.
*/
export class ProfileDialog extends IGBDialog {
- public static getNameDialog (min: GBMinInstance) {
+ public static getNameDialog(min: GBMinInstance) {
return {
id: '/profile_name',
waterfall: [
@@ -83,7 +83,7 @@ export class ProfileDialog extends IGBDialog {
};
}
- public static getMobileDialog (min: GBMinInstance) {
+ public static getMobileDialog(min: GBMinInstance) {
return {
id: '/profile_mobile',
waterfall: [
@@ -126,7 +126,7 @@ export class ProfileDialog extends IGBDialog {
};
}
- public static getMobileConfirmDialog (min: GBMinInstance) {
+ public static getMobileConfirmDialog(min: GBMinInstance) {
return {
id: '/profile_mobile_confirm',
waterfall: [
@@ -167,7 +167,7 @@ export class ProfileDialog extends IGBDialog {
};
}
- public static getEmailDialog (min: GBMinInstance) {
+ public static getEmailDialog(min: GBMinInstance) {
return {
id: '/profile_email',
waterfall: [
diff --git a/packages/security.gbapp/index.ts b/packages/security.gbapp/index.ts
index de4d2899..1027c8ee 100644
--- a/packages/security.gbapp/index.ts
+++ b/packages/security.gbapp/index.ts
@@ -47,7 +47,7 @@ import { GuaribasGroup, GuaribasUser, GuaribasUserGroup } from './models/index.j
*/
export class GBSecurityPackage implements IGBPackage {
public sysPackages: IGBPackage[];
- public async getDialogs (min: GBMinInstance) {
+ public async getDialogs(min: GBMinInstance) {
const out = [
ProfileDialog.getNameDialog(min),
ProfileDialog.getEmailDialog(min),
@@ -60,23 +60,23 @@ export class GBSecurityPackage implements IGBPackage {
}
return out;
}
- public async unloadPackage (core: IGBCoreService): Promise {
+ public async unloadPackage(core: IGBCoreService): Promise {
GBLog.verbose(`unloadPackage called.`);
}
- public async loadBot (min: GBMinInstance): Promise {
+ public async loadBot(min: GBMinInstance): Promise {
GBLog.verbose(`loadBot called.`);
}
- public async unloadBot (min: GBMinInstance): Promise {
+ public async unloadBot(min: GBMinInstance): Promise {
GBLog.verbose(`unloadBot called.`);
}
- public async onNewSession (min: GBMinInstance, step: GBDialogStep): Promise {
+ public async onNewSession(min: GBMinInstance, step: GBDialogStep): Promise {
GBLog.verbose(`onNewSession called.`);
}
- public async onExchangeData (min: GBMinInstance, kind: string, data: any) {
+ public async onExchangeData(min: GBMinInstance, kind: string, data: any) {
GBLog.verbose(`onExchangeData called.`);
}
- public async loadPackage (core: IGBCoreService, sequelize: Sequelize): Promise {
+ public async loadPackage(core: IGBCoreService, sequelize: Sequelize): Promise {
core.sequelize.addModels([GuaribasGroup, GuaribasUser, GuaribasUserGroup]);
}
}
diff --git a/packages/security.gbapp/models/index.ts b/packages/security.gbapp/models/index.ts
index 1c92a9f3..75e88b9f 100644
--- a/packages/security.gbapp/models/index.ts
+++ b/packages/security.gbapp/models/index.ts
@@ -66,7 +66,7 @@ export class GuaribasUser extends Model {
@Column(DataType.STRING(255))
declare userSystemId: string;
-
+
@Column(DataType.STRING(255))
declare userName: string;
diff --git a/packages/security.gbapp/services/SecService.ts b/packages/security.gbapp/services/SecService.ts
index 510b9c58..48663c7f 100644
--- a/packages/security.gbapp/services/SecService.ts
+++ b/packages/security.gbapp/services/SecService.ts
@@ -9,7 +9,7 @@ import { FindOptions } from 'sequelize';
* Security service layer.
*/
export class SecService extends GBService {
- public async ensureUser (
+ public async ensureUser(
instanceId: number,
userSystemId: string,
userName: string,
@@ -41,7 +41,7 @@ export class SecService extends GBService {
/**
* Retrives a conversation reference from contact phone.
*/
- public async getConversationReference (phone: string): Promise {
+ public async getConversationReference(phone: string): Promise {
const options = { rejectOnEmpty: true, where: { phone: phone } };
const user = await GuaribasUser.findOne(options);
@@ -51,7 +51,7 @@ export class SecService extends GBService {
/**
* Updates a conversation reference from contact phone.
*/
- public async updateConversationReference (phone: string, conversationReference: string) {
+ public async updateConversationReference(phone: string, conversationReference: string) {
const options = { where: { phone: phone } };
const user = await GuaribasUser.findOne(options);
@@ -59,7 +59,7 @@ export class SecService extends GBService {
await user.save();
}
- public async updateConversationReferenceById (userId: number, conversationReference: string) {
+ public async updateConversationReferenceById(userId: number, conversationReference: string) {
const options = { where: { userId: userId } };
const user = await GuaribasUser.findOne(options);
@@ -67,7 +67,7 @@ export class SecService extends GBService {
await user.save();
}
- public async updateUserLocale (userId: number, locale: any): Promise {
+ public async updateUserLocale(userId: number, locale: any): Promise {
const user = await GuaribasUser.findOne({
where: {
userId: userId
@@ -78,7 +78,7 @@ export class SecService extends GBService {
return await user.save();
}
- public async updateUserHearOnDialog (userId: number, dialogName: string): Promise {
+ public async updateUserHearOnDialog(userId: number, dialogName: string): Promise {
const user = await GuaribasUser.findOne({
where: {
userId: userId
@@ -89,7 +89,7 @@ export class SecService extends GBService {
return await user.save();
}
- public async updateUserInstance (userSystemId: string, instanceId: number): Promise {
+ public async updateUserInstance(userSystemId: string, instanceId: number): Promise {
const user = await GuaribasUser.findOne({
where: {
userSystemId: userSystemId
@@ -103,7 +103,7 @@ export class SecService extends GBService {
/**
* Finds and update user agent information to a next available person.
*/
- public async updateHumanAgent (
+ public async updateHumanAgent(
userSystemId: string,
instanceId: number,
agentSystemId: string
@@ -150,7 +150,7 @@ export class SecService extends GBService {
return user;
}
- public async isAgentSystemId (systemId: string): Promise {
+ public async isAgentSystemId(systemId: string): Promise {
const user = await GuaribasUser.findOne({
where: {
userSystemId: systemId
@@ -164,7 +164,7 @@ export class SecService extends GBService {
return user.agentMode === 'self';
}
- public async assignHumanAgent (
+ public async assignHumanAgent(
min: GBMinInstance,
userSystemId: string,
agentSystemId: string = null
@@ -194,7 +194,7 @@ export class SecService extends GBService {
return agentSystemId;
}
- public async getUserFromId (instanceId: number, userId: string): Promise {
+ public async getUserFromId(instanceId: number, userId: string): Promise {
return await GuaribasUser.findOne({
where: {
instanceId: instanceId,
@@ -203,7 +203,7 @@ export class SecService extends GBService {
});
}
- public async getUserFromSystemId (systemId: string): Promise {
+ public async getUserFromSystemId(systemId: string): Promise {
return await GuaribasUser.findOne({
where: {
userSystemId: systemId
@@ -211,7 +211,7 @@ export class SecService extends GBService {
});
}
- public async getUserFromAgentSystemId (systemId: string): Promise {
+ public async getUserFromAgentSystemId(systemId: string): Promise {
return await GuaribasUser.findOne({
where: {
agentSystemId: systemId
@@ -219,7 +219,7 @@ export class SecService extends GBService {
});
}
- public async getAllUsers (instanceId: number): Promise {
+ public async getAllUsers(instanceId: number): Promise {
return await GuaribasUser.findAll({
where: {
instanceId: instanceId
@@ -235,7 +235,7 @@ export class SecService extends GBService {
* @param name Name of param to get from instance.
* @param defaultValue Value returned when no param is defined.
*/
- public getParam (user: GuaribasUser, name: string, defaultValue?: T): any {
+ public getParam(user: GuaribasUser, name: string, defaultValue?: T): any {
let value = null;
if (user.params) {
const params = JSON.parse(user.params);
@@ -254,8 +254,7 @@ export class SecService extends GBService {
if (user['dataValues'] && !value) {
value = user['dataValues'][name];
if (value === null) {
- switch(name)
- {
+ switch (name) {
case 'language':
value = 'en';
break;
@@ -269,14 +268,13 @@ export class SecService extends GBService {
* Saves user instance object to the storage handling
* multi-column JSON based store 'params' field.
*/
- public async setParam (userId: number, name: string, value:any) {
+ public async setParam(userId: number, name: string, value: any) {
const options = { where: {} };
options.where = { userId: userId };
let user = await GuaribasUser.findOne(options);
// tslint:disable-next-line:prefer-object-spread
- let obj = JSON.parse(user.params);
- if (!obj)
- {
+ let obj = JSON.parse(user.params);
+ if (!obj) {
obj = {};
}
obj[name] = value;
diff --git a/packages/sharepoint.gblib/index.ts b/packages/sharepoint.gblib/index.ts
index 89d5dcaf..38c6ac94 100644
--- a/packages/sharepoint.gblib/index.ts
+++ b/packages/sharepoint.gblib/index.ts
@@ -44,25 +44,25 @@ import { Sequelize } from 'sequelize-typescript';
*/
export class GBSharePointPackage implements IGBPackage {
public sysPackages: IGBPackage[];
- public async getDialogs (min: GBMinInstance) {
+ public async getDialogs(min: GBMinInstance) {
GBLog.verbose(`getDialogs called.`);
}
- public async loadPackage (core: IGBCoreService, sequelize: Sequelize): Promise {
+ public async loadPackage(core: IGBCoreService, sequelize: Sequelize): Promise {
GBLog.verbose(`loadPackage called.`);
}
- public async unloadPackage (core: IGBCoreService): Promise {
+ public async unloadPackage(core: IGBCoreService): Promise {
GBLog.verbose(`unloadPackage called.`);
}
- public async loadBot (min: GBMinInstance): Promise {
+ public async loadBot(min: GBMinInstance): Promise {
GBLog.verbose(`loadBot called.`);
}
- public async unloadBot (min: GBMinInstance): Promise {
+ public async unloadBot(min: GBMinInstance): Promise {
GBLog.verbose(`unloadBot called.`);
}
- public async onNewSession (min: GBMinInstance, step: GBDialogStep): Promise {
+ public async onNewSession(min: GBMinInstance, step: GBDialogStep): Promise {
GBLog.verbose(`onNewSession called.`);
}
- public async onExchangeData (min: GBMinInstance, kind: string, data: any) {
+ public async onExchangeData(min: GBMinInstance, kind: string, data: any) {
GBLog.verbose(`onExchangeData called.`);
}
}
diff --git a/packages/sharepoint.gblib/services/SharePointService.ts b/packages/sharepoint.gblib/services/SharePointService.ts
index d3638fc7..47052485 100644
--- a/packages/sharepoint.gblib/services/SharePointService.ts
+++ b/packages/sharepoint.gblib/services/SharePointService.ts
@@ -39,4 +39,4 @@
/**
* Service facade for SharePoint Online.
*/
-export class GBSharePointService {}
+export class GBSharePointService { }
diff --git a/packages/teams.gblib/services/TeamsService.ts b/packages/teams.gblib/services/TeamsService.ts
index 338a4835..6c1001d7 100644
--- a/packages/teams.gblib/services/TeamsService.ts
+++ b/packages/teams.gblib/services/TeamsService.ts
@@ -38,7 +38,7 @@ import AdmZip from 'adm-zip';
* Support for Whatsapp.
*/
export class TeamsService extends GBService {
- public async getAppFile (manifest) {
+ public async getAppFile(manifest) {
var zip = new AdmZip();
zip.addFile('manifest.json', Buffer.from(manifest, 'utf8'), 'Built with General Bots™.');
zip.addLocalFile('teams-color.png', null, 'color.png');
@@ -46,7 +46,7 @@ export class TeamsService extends GBService {
return zip.toBuffer();
}
- public async getManifest (marketplaceId, botName, botDescription, id, packageName, yourName) {
+ public async getManifest(marketplaceId, botName, botDescription, id, packageName, yourName) {
let content = Fs.readFileSync('teams-manifest.json', 'utf8');
content = content.replace(/\@\@marketplaceId/gi, marketplaceId);
diff --git a/packages/whatsapp.gblib/index.ts b/packages/whatsapp.gblib/index.ts
index 1582fc88..1a3dcebe 100644
--- a/packages/whatsapp.gblib/index.ts
+++ b/packages/whatsapp.gblib/index.ts
@@ -46,26 +46,26 @@ import { WhatsappDirectLine } from './services/WhatsappDirectLine.js';
export class GBWhatsappPackage implements IGBPackage {
public sysPackages: IGBPackage[];
- public async loadBot (min: GBMinInstance): Promise {
+ public async loadBot(min: GBMinInstance): Promise {
GBLog.verbose(`loadBot called.`);
}
- public async getDialogs (min: GBMinInstance) {
+ public async getDialogs(min: GBMinInstance) {
GBLog.verbose(`getDialogs called.`);
}
- public async loadPackage (core: IGBCoreService, sequelize: Sequelize): Promise {
+ public async loadPackage(core: IGBCoreService, sequelize: Sequelize): Promise {
GBLog.verbose(`loadPackage called.`);
}
- public async unloadPackage (core: IGBCoreService): Promise {
+ public async unloadPackage(core: IGBCoreService): Promise {
GBLog.verbose(`unloadPackage called.`);
}
- public async unloadBot (min: GBMinInstance): Promise {
+ public async unloadBot(min: GBMinInstance): Promise {
GBLog.verbose(`unloadBot called.`);
}
- public async onNewSession (min: GBMinInstance, step: GBDialogStep): Promise {
+ public async onNewSession(min: GBMinInstance, step: GBDialogStep): Promise {
GBLog.verbose(`onNewSession called.`);
}
- public async onExchangeData (min: GBMinInstance, kind: string, data: any) {
+ public async onExchangeData(min: GBMinInstance, kind: string, data: any) {
GBLog.verbose(`onExchangeData called.`);
}
}
diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts
index 27f731a3..dc52fbcc 100644
--- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts
+++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts
@@ -192,11 +192,10 @@ export class WhatsappDirectLine extends GBService {
});
client.initialize();
};
- if (setUrl){
+ if (setUrl) {
createClient.bind(this)();
}
- else
- {
+ else {
this.customClient = minBoot.whatsAppDirectLine.customClient;
}
setUrl = false;
@@ -998,14 +997,14 @@ export class WhatsappDirectLine extends GBService {
let urlMin: any = GBServer.globals.minInstances.filter(p => p.instance.botId === botId)[0];
const botNumber = urlMin ? urlMin.core.getParam(urlMin.instance, 'Bot Number', null) : null;
- if (botNumber){
+ if (botNumber) {
user = await sec.updateUserInstance(user.userSystemId, urlMin.instance.instanceId);
}
let activeMin;
// Processes group behaviour.
- text = text.replace(/\@\d+ /gi, '');
+ text = text.replace(/\@\d+ /gi, '');
let group;
if (provider === 'chatapi') {
diff --git a/src/app.ts b/src/app.ts
index 6fd7e8a1..e1dac516 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -84,7 +84,7 @@ export class GBServer {
GBLog.error(`Running TEST_SHELL ERROR: ${error}...`);
}
}
-
+
const server = express();
GBServer.globals.server = server;
@@ -227,7 +227,7 @@ export class GBServer {
await GBServer.globals.chatGPT.init();
}
}
-
+
// let s = new GBVMService();
// await s.translateBASIC('work/gptA.vbs', GBServer.globals.minBoot );
// await s.translateBASIC('work/gptB.vbs', GBServer.globals.minBoot );
@@ -282,15 +282,62 @@ export class GBServer {
};
const httpsServer = https.createServer(options1, server).listen(port, mainCallback);
GBServer.globals.httpsServer = httpsServer;
- if (process.env.CERTIFICATE2_PFX) {
- const options2 = {
- passphrase: process.env.CERTIFICATE2_PASSPHRASE,
- pfx: Fs.readFileSync(process.env.CERTIFICATE2_PFX)
- };
- httpsServer.addContext(process.env.CERTIFICATE2_DOMAIN, options2);
+
+ for (let i = 2; ; i++) {
+ const certPfxEnv = `CERTIFICATE${i}_PFX`;
+ const certPassphraseEnv = `CERTIFICATE${i}_PASSPHRASE`;
+ const certDomainEnv = `CERTIFICATE${i}_DOMAIN`;
+
+ if (process.env[certPfxEnv] && process.env[certPassphraseEnv] && process.env[certDomainEnv]) {
+ const options = {
+ passphrase: process.env[certPassphraseEnv],
+ pfx: Fs.readFileSync(process.env[certPfxEnv])
+ };
+ httpsServer.addContext(process.env[certDomainEnv], options);
+ } else {
+ break;
+ }
}
- } else {
+ }
+ else {
server.listen(port, mainCallback);
}
}
}
+/*
+--------------------------------------------------------------------------------------------
+if (process.env.CERTIFICATE_PFX) {
+ const options1 = {
+ passphrase: process.env.CERTIFICATE_PASSPHRASE,
+ pfx: Fs.readFileSync(process.env.CERTIFICATE_PFX)
+ };
+ const httpsServer = https.createServer(options1, server).listen(port, mainCallback);
+ GBServer.globals.httpsServer = httpsServer;
+
+ if (process.env.CERTIFICATE2_PFX) {
+ const options2 = {
+ passphrase: process.env.CERTIFICATE2_PASSPHRASE,
+ pfx: Fs.readFileSync(process.env.CERTIFICATE2_PFX)
+ };
+ httpsServer.addContext(process.env.CERTIFICATE2_DOMAIN, options2);
+ }
+
+ if (process.env.CERTIFICATE3_PFX) {
+ const options3 = {
+ passphrase: process.env.CERTIFICATE3_PASSPHRASE,
+ pfx: Fs.readFileSync(process.env.CERTIFICATE3_PFX)
+ };
+ httpsServer.addContext(process.env.CERTIFICATE3_DOMAIN, options3);
+ }
+
+ if (process.env.CERTIFICATE4_PFX) {
+ const options4 = {
+ passphrase: process.env.CERTIFICATE4_PASSPHRASE,
+ pfx: Fs.readFileSync(process.env.CERTIFICATE4_PFX)
+ };
+ httpsServer.addContext(process.env.CERTIFICATE4_DOMAIN, options4);
+ }
+}
+------------------------------------------------------------------------------------------
+*/
+