김연준

Slight fixes of mongo.js file

......@@ -36,31 +36,31 @@ bot.on('message', (data) => {
function handleMessage(message){
if(message.includes('chucknorris')){
route.chuckJoke()
.then((err, res)=>{
.then((err, data)=>{
if(err)throw err;
res("ChuckJoke function activated");
console.log("ChuckJoke function activated");
});
}
else if(message.includes(' yomama')){
route.yoMamaJoke()
.then((err, res)=>{
.then((err, data)=>{
if(err)throw err;
res("yoMamaJoke function activated");
console.log("yoMamaJoke function activated");
});
}
else if(message.includes(' random')){
route.randomJoke()
.then((err, res)=>{
if(err)throw err
res("randomJoke function activated");
.then((err, data)=>{
if(err)throw err;
console.log("randomJoke function activated");
});
}
else if(message.includes(' help')){
route.runHelp()
.then((err, res)=>{
if(err)throw err
res(" function activated");
.then((err, data)=>{
if(err)throw err;
console.log(" function activated");
});
}
}
\ No newline at end of file
......
......@@ -26,9 +26,12 @@ var url = "mongodb://localhost:27017/jokeapi";
// });
// });
//
MongoClient.connect(url).then((client) => {
console.log('Connected correctly to server');
}).catch((err)=> console.log(err));
/*
const db = client.db(dbname);
dboperation.insertDocument(db, jokedoc, collec)
......@@ -40,4 +43,4 @@ MongoClient.connect(url).then((client) => {
.catch((err) => console.log(err));
})
.catch((err) => console.log(err));
\ No newline at end of file
*/
\ No newline at end of file
......