Bottr icon indicating copy to clipboard operation
Bottr copied to clipboard

Getting Started : Creating Your First Bot sample does not work

Open sarvex opened this issue 6 years ago • 4 comments

const Bottr = require('bottr');
const bot = new Bottr.Bot();

bot.on('message_received', function(message, session) {
  session.send('Hello World')
})

bot.listen();

The code when run gives error Cannot GET /

However if I include the BottrApp back it gives the expected result

const Bottr = require('bottr');
const BottrApp = require('bottr-app');

const bot = new Bottr.Bot();

bot.use(new BottrApp());
bot.on('message_received', (message, session) => {
  session.send('Hello, World');
});

bot.listen();

The guide should be updated with running code

sarvex avatar Oct 24 '17 07:10 sarvex

@sarvex Do you want to make a PR and update outdated information?

ummahusla avatar Oct 26 '17 07:10 ummahusla

I would love to do that, unfortunately I cannot find the repository which hosts the samples

sarvex avatar Oct 26 '17 14:10 sarvex

I also had this problem, but when I restarted, it worked. I killed my terminal window, went back into the directory with my bottr bot, and typed bottr start and went to localhost:3000. Then the bot worked.

lisawilliams avatar Dec 11 '17 01:12 lisawilliams

Most recent text on page (https://bottr.co/docs/creating-your-first-bot.html) looks correct:

const Bottr = require('bottr')
const BottrApp = require('bottr-app')
const bot = new Bottr.Bot()

bot.use(new BottrApp())
bot.listen()

StefH avatar Jan 16 '18 15:01 StefH