Bottr-js / Bottr

🤖 The world's simplest framework for creating Bots
http://bottr.co
MIT License
938 stars 86 forks source link

Getting Started : Creating Your First Bot sample does not work #87

Open sarvex opened 6 years ago

sarvex commented 6 years ago
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

ummahusla commented 6 years ago

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

sarvex commented 6 years ago

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

lisawilliams commented 6 years ago

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.

StefH commented 6 years ago

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()