daily pastebin goal
29%
SHARE
TWEET

main.js

a guest Mar 23rd, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //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.
  2. //It should respond as a chatbot unless unrecognised text is entered, this is so that people know how to use the bot.
  3. var RiveScript = require('rivescript');
  4. exports.run(client, message, args) => {
  5.     var chatBot = new RiveScript();
  6.     let username = "local-user";
  7.     chatBot.loadDirectory("conversation").then(complete).catch(error);
  8.  
  9.     function complete() {
  10.         chatBot.sortReplies();
  11.         chatBot.reply(username, message.content.join(" ").toLowerCase()).then(reply => handler(reply));
  12.     }
  13.  
  14.     function error() {
  15.         console.log("RiveScript has encountered an error.. Apologies...")
  16.     }
  17.  
  18.     function handler(reply) {
  19.         if(reply == "♣•♣○⌂") {
  20.             //Send message with prefix and how to use the bot
  21.         } else {
  22.             message.channel.send(reply);
  23.         }
  24.     }
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top