Skip to content

Instantly share code, notes, and snippets.

@RSamaium
RSamaium / main.converse
Last active August 14, 2019 16:49
Main conversational script
$name = ''
@Event('start')
start() {
> Hi, I'm PizzaBot. I can order you pizzas :)
> What is your name?
Prompt()
$name = :text
import formats from 'newbot-formats'
import code from './main.converse'
import orderSkill from './skills/order/order'
export default {
code,
skills: {
formats,
orderSkill
}
@Intent('order', [
'order a pizza',
'get pizza',
'buy pizza'
])
order() {
date = :intent.date.value
callApi(date)
> I have noted an order for { date }
}
import formats from 'newbot-formats'
import code from './order.converse'
export default {
code,
skills: {
formats
},
functions: {
callApi(date) {
{
"interactionModel": {
"languageModel": {
"invocationName": "my chatbot",
"intents": [
{
"name": "NewBotIntent",
"slots": [
{
"name": "any",
$name = ''
@Event('start')
start() {
> Hey ! My name is ChatBot, and you ?
Prompt()
$name = :text
> Hello { $name }
}
import code from './main.converse'
export default {
code
}
module.exports = {
platforms: {
alexa: {}
}
}
import { ConverseTesting, user, bot } from 'newbot/testing'
import mainSkill from './main'
describe('Sample Test', () => {
let converse, userConverse
beforeEach(() => {
converse = new ConverseTesting(mainSkill, {
model: __dirname + '/model/model.nlp'
})
@Intent('apod', [
'View picture of the day',
'Show image'
])
apod() {
apod = getApod()
if (apod.media_type == 'video') {
@Format('buttons', [
{