Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// ------------------------------------------------------------------
// APP INITIALIZATION
// ------------------------------------------------------------------
const { App } = require('jovo-framework');
const { Alexa } = require('jovo-platform-alexa');
const { GoogleAssistant } = require('jovo-platform-googleassistant');
const { JovoDebugger } = require('jovo-plugin-debugger');
const { FileDb } = require('jovo-db-filedb');
const { SpeechMarkdown } = require('jovo-plugin-speechmarkdown');
const app = new App();
app.use(
new Alexa(),
new GoogleAssistant(),
new JovoDebugger(),
new FileDb(),
new SpeechMarkdown()
);
// ------------------------------------------------------------------
// APP LOGIC
// ------------------------------------------------------------------
app.setHandler({
LAUNCH() {
return this.toIntent('HelloWorldIntent');
},
'use strict';
// ------------------------------------------------------------------
// APP INITIALIZATION
// ------------------------------------------------------------------
const {App} = require('jovo-framework');
const {Alexa} = require('jovo-platform-alexa');
const {GoogleAssistant} = require('jovo-platform-googleassistant');
const {JovoDebugger} = require('jovo-plugin-debugger');
const {FileDb} = require('jovo-db-filedb');
const app = new App();
app.use(
new Alexa(),
new GoogleAssistant(),
new JovoDebugger(),
new FileDb()
);
// ------------------------------------------------------------------
// APP LOGIC
// ------------------------------------------------------------------
app.setHandler({
LAUNCH() {
this.toIntent('HelloWorldIntent');
},
HelloWorldIntent() {
const { App, Util } = require('jovo-framework');
const { GoogleAssistant } = require('jovo-platform-googleassistant');
const { Alexa } = require('jovo-platform-alexa');
const { JovoDebugger } = require('jovo-plugin-debugger');
const { FileDb } = require('jovo-db-filedb');
const { DynamoDb } = require('jovo-db-dynamodb');
const { DatastoreDb } = require('jovo-db-datastore');
const { MySQL } = require('jovo-db-mysql');
const app = new App();
Util.consoleLog();
app.use(
new GoogleAssistant(),
new Alexa(),
new JovoDebugger(),
new FileDb(),
new MySQL({
tableName: 'users',
connection: {
host : 'localhost',
user : 'root',
password : '',
database : 'test'
}
})
);
app.setHandler({
async LAUNCH() {
console.log(this.$user.$data.lastVisit);
LAUNCH () {
this.toIntent('HelloWorldIntent')
},
HelloWorldIntent () {
this.jargon.ask(ri('hwi.ask'), ri('hwi.reprompt'))
},
MyNameIsIntent () {
this.jargon.tell(ri('mnii', { name: this.$inputs.name.value }))
}
})
return app
}
const alexa = new Alexa()
const ts = alexa.makeTestSuite()
it('Returns one of the expected resources for the hello world intent', function (done: Done) {
this.timeout(1000)
const app = makeApp()
app.middleware('after.response')!.use((handleRequest: HandleRequest) => {
const jovo = handleRequest.jovo!
const resp = jovo.$response!
assert.ok(resp.isAsk(
[
"Hello from Jargon! What's your name?",
'Thanks for using Jargon! Could you tell me your name?',
'Who are you?',
"What's your name?"
],
function makeApp () {
const app = new App({ logging: false })
app.use(
new Alexa(),
new JargonPlugin()
)
app.setHandler({
LAUNCH () {
this.toIntent('HelloWorldIntent')
},
HelloWorldIntent () {
this.jargon.ask(ri('hwi.ask'), ri('hwi.reprompt'))
},
MyNameIsIntent () {
this.jargon.tell(ri('mnii', { name: this.$inputs.name.value }))
}
})
const {App} = require('jovo-framework');
const { GoogleAssistant } = require('jovo-platform-googleassistant');
const { Alexa } = require('jovo-platform-alexa');
const app = new App();
app.use(
new GoogleAssistant(),
new Alexa()
);
app.setHandler({
async LAUNCH() {
let foo = false;
let bar = true;
this.$speech
.addText('HelloWorld')
.addBreak('100ms', false)
.addAudio('http://www.any.url/test.mp3', 'Text')
.addText('Foo', foo)
.addText('Bar', bar)
.addText(['Text1', 'Text2', 'Text3'])
.addBreak(['500ms', '1s'])