Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This is written for use with a command handler and is intended to be used whenever the bot is tagged as opposed to a normal command.
- //It should respond as a chatbot unless unrecognised text is entered, this is so that people know how to use the bot.
- var RiveScript = require('rivescript');
- exports.run(client, message, args) => {
- var chatBot = new RiveScript();
- let username = "local-user";
- chatBot.loadDirectory("conversation").then(complete).catch(error);
- function complete() {
- chatBot.sortReplies();
- chatBot.reply(username, message.content.join(" ").toLowerCase()).then(reply => handler(reply));
- }
- function error() {
- console.log("RiveScript has encountered an error.. Apologies...")
- }
- function handler(reply) {
- if(reply == "♣•♣○⌂") {
- //Send message with prefix and how to use the bot
- } else {
- message.channel.send(reply);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement