luffy-bot
Version:
The Luffy Chatbot npm package offers a streamlined way to integrate conversational AI into Node.js applications. With Luffy, developers can effortlessly send messages to the chatbot and receive responses programmatically, enabling the creation of engaging
19 lines (15 loc) • 456 B
JavaScript
const axios = require('axios');
class Luffy {
constructor() {
this.endpoint = 'https://luffy-chatbot-backend-1.onrender.com';
}
async reply(message) {
try {
const response = await axios.get(`${this.endpoint}/reply?message=${encodeURIComponent(message)}`);
return response.data.reply;
} catch (error) {
throw new Error('Failed to get reply from Fluffy chat bot');
}
}
}
module.exports = Luffy;