alexa-bot-api-v4 v4.1.4
Consider Donating To Me: https://www.buymeacoffee.com/nithishpravin
Join My Discord Server:
https://discord.gg/m2G7YB3ttf
Developers:
Whats new in v3.0.6
Whats to be expected in the future?
We have spent lots of time working on this patch, and have encountered lots of issues, but we're proud to say that we're going to be adding personality fields on top of better multi-lingual support
Our RoadMap | Versions: | Patches? | Additions | Status | |:---------:|---------------|--------------------------|------------| | 3.0.5 | Multi-Lingual | A jaro winkler check to enhance the consitency in messages | OK ✔ | | 3.1.0 | N/A | Additional Personalities | Pending... | | 3.2.0 | N/A | ❌ | Unknown... |
const alexa = require("alexa-bot-api-v3");
const ai = new alexa();
// [] represents context, since it's an array
ai.getReply("Hello", [], "english", "O_o").then((reply) => {
console.log(reply);
//Do your stuffs with the reply
});
getReply(<message>, <context>, <language>, <replacer>)
//context: string | array
//string: a specific channel ID for context
//array: an array of previous messages
const Discord = require("discord.js");
const bot = new Discord.Client();
const alexa = require("alexa-bot-api-v3");
const ai = new alexa();
bot.on("message", function (msg) {
if (msg.author.bot || !msg.content.startsWith(prefix)) return;
// it's better to store the context in a local databse
let context = [];
if (msg.content.startsWith(`${prefix}chat`)) {
let input = msg.content.replace(`${prefix}chat`);
ai.getReply(input, context, "english", "OwO").then(reply => {
msg.reply(reply); // send the message
context.push(reply); // add the response to the context
});
}
});
bot.login("Your.super-secret.Token");
const alexa = require("alexa-bot-api-v3");
const ai = new alexa();
const context = [];
async function main() {
const reply = await ai.getReply("How are you mate?", context, "english", "UwU");
console.log(reply);
//Do your stuffs with reply
}
main();