Advertisement
samiroexpikachu

Gemini/bard

Oct 20th, 2024 (edited)
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const axios = require("axios");
  2.  
  3. module.exports = {
  4.   config: {
  5.     name: "bard",
  6.     version: "1.0",
  7.     author: "Samir",
  8.     countDown: 5,
  9.     role: 0,
  10.     category: "Bard"
  11.   },
  12.   onStart: async function({ message, event, args, commandName }) {
  13.     const prompt = args.join(' ');
  14.  
  15.     try {
  16.       const response = await axios.get(`https://www.samirxpikachu.run.place/gemini-apu?text=${encodeURIComponent(prompt)}&cookies=g.a000pAjfCSxaGzWv57f6MDmckX4G9uorq_w-yPJ7iwkjTny0OOEpIETxiko5lq98kJitCCXfFgACgYKASoSARISFQHGX2MiPcW2WPZnEbh96mXRSS-OFxoVAUF8yKrj7DuqZwFE13Jg0UI_eRtm0076`);
  17.  
  18.       if (response.data) {
  19.         const answer = response.data.text;
  20.         const attachments = [];
  21.  
  22.         if (response.data.images && response.data.images.length > 0) {
  23.           for (const imageUrl of response.data.images) {
  24.             const attachment = await global.utils.getStreamFromURL(imageUrl);
  25.             attachments.push(attachment);
  26.           }
  27.         }
  28.  
  29.         const messageOptions = {
  30.           body: answer,
  31.           ...(attachments.length > 0 && { attachment: attachments })
  32.         };
  33.  
  34.         message.reply(messageOptions, (err, info) => {
  35.           global.GoatBot.onReply.set(info.messageID, {
  36.             commandName,
  37.             messageID: info.messageID,
  38.             author: event.senderID
  39.           });
  40.         });
  41.       }
  42.  
  43.     } catch (error) {
  44.       console.error("Error:", error.message);
  45.     }
  46.   },
  47.  
  48.   onReply: async function({ message, event, Reply, args }) {
  49.     let { author, commandName } = Reply;
  50.     if (event.senderID != author) return;
  51.     const prompt = args.join(' ');
  52.    
  53.     try {
  54.       const response = await axios.get(`https://www.samirxpikachu.run.place/gemini-apu?text=${encodeURIComponent(prompt)}&cookies=g.a000pAjfCSxaGzWv57f6MDmckX4G9uorq_w-yPJ7iwkjTny0OOEpIETxiko5lq98kJitCCXfFgACgYKASoSARISFQHGX2MiPcW2WPZnEbh96mXRSS-OFxoVAUF8yKrj7DuqZwFE13Jg0UI_eRtm0076`);
  55.  
  56.       if (response.data) {
  57.         const answer = response.data.text;
  58.         const attachments = [];
  59.  
  60.         if (response.data.images && response.data.images.length > 0) {
  61.           for (const imageUrl of response.data.images) {
  62.             const attachment = await global.utils.getStreamFromURL(imageUrl);
  63.             attachments.push(attachment);
  64.           }
  65.         }
  66.  
  67.         const messageOptions = {
  68.           body: answer,
  69.           ...(attachments.length > 0 && { attachment: attachments })
  70.         };
  71.  
  72.         message.reply(messageOptions, (err, info) => {
  73.           global.GoatBot.onReply.set(info.messageID, {
  74.             commandName,
  75.             messageID: info.messageID,
  76.             author: event.senderID
  77.           });
  78.         });
  79.       }
  80.  
  81.     } catch (error) {
  82.       console.error("Error:", error.message);
  83.     }
  84.   }
  85. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement