Advertisement
samiroexpikachu

Character ai

Apr 10th, 2024
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const axios = require("axios");
  2.  
  3. let defaultCharacter = "";
  4.  
  5. module.exports = {
  6.   config: {
  7.     name: "cai",
  8.     version: "1.0",
  9.     author: "Samir Œ",
  10.     aliases: ["roleplay", "pretend"],
  11.     countDown: 5,
  12.     role: 0,
  13.     category: "Character Ai"
  14.   },
  15.   onStart: async function ({ message, event, args, commandName }) {
  16.     const [question, character] = args.join(' ').split('|').map(item => item.trim());
  17.     const selectedCharacter = character || defaultCharacter;
  18.  
  19.     try {
  20.       const response = await axios.get(`https://apis-samir.onrender.com/characterAi?message=${encodeURIComponent(question)}&name=${encodeURIComponent(selectedCharacter)}`);
  21.  
  22.       if (response.data && response.data) {
  23.         const answer = response.data.text;
  24.         const characterName = `${answer}`;
  25.         message.reply({ body: characterName }, (err, info) => {
  26.           global.GoatBot.onReply.set(info.messageID, {
  27.             commandName,
  28.             messageID: info.messageID,
  29.             author: event.senderID,
  30.             character: selectedCharacter
  31.           });
  32.         });
  33.       }
  34.  
  35.     } catch (error) {
  36.       console.error("Error:", error.message);
  37.     }
  38.   },
  39.  
  40.   onReply: async function ({ message, event, Reply, args }) {
  41.     let { author, commandName, character } = Reply;
  42.     if (event.senderID != author) return;
  43.     const [question] = args.join(' ').split('|').map(item => item.trim());
  44.  
  45.     try {
  46.       const response = await axios.get(`https://apis-samir.onrender.com/characterAi?message=${encodeURIComponent(question)}&name=${encodeURIComponent(character)}`);
  47.  
  48.       if (response.data && response.data) {
  49.         const answer = response.data.text;
  50.         const characterName = `${answer}`;
  51.         message.reply({ body: characterName }, (err, info) => {
  52.           global.GoatBot.onReply.set(info.messageID, {
  53.             commandName,
  54.             messageID: info.messageID,
  55.             author: event.senderID,
  56.             character: character
  57.           });
  58.         });
  59.       }
  60.  
  61.     } catch (error) {
  62.       console.error("Error:", error.message);
  63.     }
  64.   }
  65. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement