-
Notifications
You must be signed in to change notification settings - Fork 1
/
start-compiled.js.map
1 lines (1 loc) · 2.87 KB
/
start-compiled.js.map
1
{"version":3,"sources":["start.js"],"names":[],"mappings":";;AAAA;;AACA;;IAAY,c;;;;AAEZ,QAAQ,sBAAR;AACA,QAAQ,wBAAR;AACA,QAAQ,mBAAR;AACA,IAAM,WAAW,QAAQ,2BAAR,CAAjB;AACA,IAAM,SAAS,QAAQ,wBAAR,CAAf;;AAEA,IAAM,aAAa,QAAQ,SAAR,CAAnB;;AAEA,IAAM,MAAM,IAAI,UAAJ,CAAe,cAAf,CAAZ;AACA,IAAM,WAAW,EAAjB;;AAGA,SAAS,YAAT,CAAsB,aAAtB,EAAqC;AACnC,SAAO,mBAAP,CAA2B,aAA3B,EAA0C,MAA1C;AAMD;;AAGD,SAAS,eAAT,CAAyB,aAAzB,EAAwC;AACtC,WAAS,aAAT,IAA0B,EAA1B;AACA,WAAS,aAAT,EAAwB,iBAAxB,GAA4C,cAAc,WAAd,EAA5C;AACD;;AAGD,SAAS,EAAT,CAAY,QAAZ,EAAsB,UAAC,aAAD,EAAmB;AACvC,MAAI,CAAC,SAAS,aAAT,CAAL,EAA8B;AAC5B,iBAAa,aAAb;AACA,oBAAgB,aAAhB;AACD;AACF,CALD;;AAQA,SAAS,EAAT,CAAY,MAAZ,EAAoB,UAAC,aAAD,EAAgB,IAAhB,EAAyB;AAC3C,MAAI,CAAC,SAAS,aAAT,CAAL,EAA8B;AAC5B,oBAAgB,aAAhB;AACD;;AAED,MAAM,aAAa;AACjB,iBAAa,SAAS,aAAT,EAAwB,iBADpB;AAEjB,WAAO,IAFU,EAAnB;AAGF;AACA;AACA;;AAEE,MAAI,IAAJ,CAAS,UAAT,EAAqB,UAAC,GAAD,EAAM,GAAN,EAAc;AACjC,QAAI,CAAC,GAAL,EAAU;AACR,UAAI;AACF;AACA,eAAO,mBAAP,CAA2B,aAA3B,EAA0C,MAA1C,EAAkD,IAAI,SAAJ,CAAc,CAAd,CAAlD;AACD,OAHD,CAGE,OAAO,CAAP,EAAU;AACV,gBAAQ,GAAR,QAAiB,CAAjB;AACD;AACF,KAPD,MAOO;AACL,cAAQ,GAAR,QAAiB,GAAjB;AACD;AACF,GAXD;AAYD,CAxBD","file":"start-compiled.js","sourcesContent":["import { version } from './package.json';\nimport * as chatbotOptions from './chatbot.json';\n\nrequire('byteballcore/conf.js');\nrequire('byteballcore/wallet.js');\nrequire('headless-byteball');\nconst eventBus = require('byteballcore/event_bus.js');\nconst device = require('byteballcore/device.js');\n\nconst Pandorabot = require('pb-node');\n\nconst bot = new Pandorabot(chatbotOptions);\nconst Sessions = {};\n\n\nfunction sendGreeting(deviceAddress) {\n device.sendMessageToDevice(deviceAddress, 'text',\n `Created by @la from byteball.slack.com\nOpen source: https://github.com/Laurentiu-Andronache/byteball-chatbot-Rosie\nVersion: ${version}\nDonate: 7N6RHAKVPHXZR6OXQNGHQKWMM7RSGWAQ\n-------------------------------------------------------------`);\n}\n\n\nfunction initiateSession(deviceAddress) {\n Sessions[deviceAddress] = {};\n Sessions[deviceAddress].PandorabotsDevice = deviceAddress.toLowerCase();\n}\n\n\neventBus.on('paired', (deviceAddress) => {\n if (!Sessions[deviceAddress]) {\n sendGreeting(deviceAddress);\n initiateSession(deviceAddress);\n }\n});\n\n\neventBus.on('text', (deviceAddress, text) => {\n if (!Sessions[deviceAddress]) {\n initiateSession(deviceAddress);\n }\n\n const talkParams = {\n client_name: Sessions[deviceAddress].PandorabotsDevice,\n input: text };\n// console.log(`\n// talkParams.client_name: ${talkParams.client_name}\n// talkParams.input: ${talkParams.input}`);\n\n bot.talk(talkParams, (err, res) => {\n if (!err) {\n try {\n // console.log(`\\n${res}`);\n device.sendMessageToDevice(deviceAddress, 'text', res.responses[0]);\n } catch (e) {\n console.log(`\\n${e}`);\n }\n } else {\n console.log(`\\n${err}`);\n }\n });\n});\n"]}