Advertisement
Guest User

main.js

a guest
Mar 23rd, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement