fix(core.gbapp): SEND SMS TO keyword added.
This commit is contained in:
parent
10b878c43f
commit
719f063070
3 changed files with 11 additions and 2 deletions
|
@ -102,6 +102,10 @@ class SysClass {
|
|||
await this.min.conversationalService.sendMarkdownToMobile(this.min, null, mobile, message);
|
||||
}
|
||||
|
||||
public async sendSmsTo(mobile, message) {
|
||||
await this.min.conversationalService.sendSms(this.min, mobile, message);
|
||||
}
|
||||
|
||||
public async set(file: string, address: string, value: any): Promise<any> {
|
||||
GBLog.info(`BASIC: Defining '${address}' in '${file}' to '${value}' (SET). `);
|
||||
try {
|
||||
|
|
|
@ -145,8 +145,9 @@ export class GBConversationalService {
|
|||
});
|
||||
// tslint:disable-next-line:no-unsafe-any
|
||||
nexmo.message.sendSms(min.instance.smsServiceNumber, mobile, text, (err, data) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
if (data.messages[0]['error-text']) {
|
||||
GBLog.error(`BASIC: error sending SMS to ${mobile}: ${data.messages[0]['error-text']}`);
|
||||
reject(data.messages[0]['error-text']);
|
||||
} else {
|
||||
resolve(data);
|
||||
}
|
||||
|
|
|
@ -216,6 +216,10 @@ export class GBVMService extends GBService {
|
|||
return `talk (step, ${$3})\n`;
|
||||
});
|
||||
|
||||
code = code.replace(/(send sms to)(\s*)(.*)/gi, ($0, $1, $2, $3) => {
|
||||
return `sys().sendSmsTo (${$3})\n`;
|
||||
});
|
||||
|
||||
code = code.replace(/(send file to)(\s*)(.*)/gi, ($0, $1, $2, $3) => {
|
||||
return `sendFileTo (step, ${$3})\n`;
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue