Skip to content

Instantly share code, notes, and snippets.

@fhenri42
fhenri42 / Riddle.js
Created December 15, 2016 16:56
Riddle.js
class Riddle {
static resRiddle() {
return [{
type: 'text',
content: 'Having a sharp mind is not enough to be a jedi, you also need to prove your strength and bravery!',
}, {
type: 'text',
content: 'Master Yoda gets an old dusty map from his sleeve, with a location marking the nest of a terrible monster.',
}, {
@fhenri42
fhenri42 / Combat.js
Last active July 8, 2022 10:48
Combat.js
/*you will use the class Combat to send the right message during the fight on Dagobah*/
class Combat {
static winCombat() {
return [{
type: 'text',
content: 'That last attack was a fatal blow... You can hear the scream of the monster',
}, {
type: 'text',
content: 'You just defeated one of the greatest creatures of all time! Well done Padawan',
@fhenri42
fhenri42 / handleBattle.js
Last active December 14, 2016 15:22
handleBattle.js
const Combat = require('../formatServices/Combat.js')
const Conversation = require('recastai').Conversation
const config = require('../../config')
/*this code will make all the rand to creat a dynamique fight and will call the memory of the bot to see if the battle is over*/
function handleBattle(entities, myHp, monsterHp, senderID) {
return new Promise(resolve => {
const random = Math.round(Math.random() * (3 - 1) + 1)
let damage = 0
@fhenri42
fhenri42 / handeleSpaceBattle.js
Last active December 14, 2016 15:22
handeleSpaceBattle()
const Space = require('../formatServices/Space.js')
const Conversation = require('recastai').Conversation
const config = require('../../config')
/* this code will make all the rand to creat a dynamique fight and will call the memory of the bot to see if the battle is over */
function handeleSpaceBattle(entities, myHp, monsterHp, senderID, planet) {
return new Promise(resolve => {
const randome = Math.round(Math.random() * (3 - 1) + 1)
let damage = 0
@fhenri42
fhenri42 / Space.js
Last active December 14, 2016 15:26
spaceFight.js
/*you will use the class Space to send the right message during the space fight*/
class Space {
static initCombat() {
return [{
type: 'text',
content: 'You just disobeyed your master, one step closer to the dark side you get...',
}, {
type: 'text',
content: 'On your way out of Coruscant, a head hunter starts taking you down 💥💥',
@fhenri42
fhenri42 / trainingMessage.js
Last active December 14, 2016 15:27
trainingMessage()
/* send back text and quick reply*/
function trainingMessage() {
return [{
type: 'text',
content: 'After a two hours trip, you land on Dagobah, the swamp-covered planet, to meet one of the oldest jedi of the galaxy: master Yoda.',
}, {
type: 'picture',
content: 'http://www.phoenixisrisen.co.uk/wp-content/uploads/2015/04/dagobah.jpg',
}, {
type: 'text',
@fhenri42
fhenri42 / choseTraing.js
Last active December 14, 2016 12:53
choseTraing()
/* send back the quick reply to make the good choose*/
function choseTraing() {
return [{
type: 'text',
content: 'Great choice! I just received a message from an old jedi living as a hermit on the planet Dagobah, looking for a new padawan!',
}, {
type: 'quickReplies',
content: {
title: 'Do you want to go on Dagobah to meet him? Or use your new ship to explore space?',
buttons: [
@fhenri42
fhenri42 / carouselSpaceShip.js
Last active December 14, 2016 12:51
carouselSpaceShip()
/*Send back a carouselle of sapce ship*/
function carouselSpaceShip() {
return [{
type: 'text',
content: 'Nice!',
}, {
type: 'text',
content: 'To continue this space adventure, you need a spaceship! Which one would you like?',
}, {
type: 'carouselle',
@fhenri42
fhenri42 / initConversation.js
Last active December 15, 2016 08:40
initConversation
/*this function will return a array of message to send to bot-connector*/
function initConversation() {
return [{
type: 'text',
content: 'Welcome to Coruscant!',
}, {
type: 'text',
content: 'In this interactive adventure, each one of your answers will greatly impact your adventure.\nI will be your guide, so follow my instructions and everything will be fine',
}, {
type: 'audio',