Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const a = require("axios"),
- t = require("tinyurl");
- global.api = {
- s: "https://samirxpikachu.onrender.com"
- };
- const fm = {
- ' ': ' ',
- 'a': '๐', 'b': '๐', 'c': '๐', 'd': '๐', 'e': '๐', 'f': '๐', 'g': '๐ ', 'h': '๐ก',
- 'i': '๐ข', 'j': '๐ฃ', 'k': '๐ค', 'l': '๐ฅ', 'm': '๐ฆ', 'n': '๐ง', 'o': '๐จ', 'p': '๐ฉ', 'q': '๐ช',
- 'r': '๐ซ', 's': '๐ฌ', 't': '๐ญ', 'u': '๐ฎ', 'v': '๐ฏ', 'w': '๐ฐ', 'x': '๐ฑ', 'y': '๐ฒ', 'z': '๐ณ',
- 'A': '๐', 'B': '๐', 'C': '๐', 'D': '๐', 'E': '๐', 'F': '๐ ', 'G': '๐', 'H': '๐',
- 'I': '๐', 'J': '๐', 'K': '๐', 'L': '๐', 'M': '๐', 'N': '๐', 'O': '๐', 'P': '๐', 'Q': '๐',
- 'R': '๐', 'S': '๐', 'T': '๐', 'U': '๐', 'V': '๐', 'W': '๐', 'X': '๐', 'Y': '๐', 'Z': '๐',
- };
- function ctf(t) {
- let ct = '';
- for (let c of t) {
- ct += fm[c] || c;
- }
- return ct;
- }
- function cba(t) {
- return t.replace(/\*(.*?)\*/g, (m, p1) => ctf(p1));
- }
- module.exports = {
- config: {
- name: "gemini",
- aliases: ["bard"],
- version: "1.0",
- author: "Samir OE",
- countDown: 5,
- role: 0,
- category: "๐๐"
- },
- onStart: async function({
- message: m,
- event: e,
- args: r,
- commandName: n
- }) {
- try {
- let s;
- const i = e.senderID;
- if ("message_reply" === e.type && ["photo", "sticker"].includes(e.messageReply.attachments?.[0]?.type)) {
- s = await t.shorten(e.messageReply.attachments[0].url);
- } else {
- const o = r.join(" "),
- c = await a.get(`${global.api.s}/Gemini?text=${encodeURIComponent(o)}&uid=${i}`);
- if (c.data && c.data.candidates && c.data.candidates.length > 0) {
- const t = c.data.candidates[0].content.parts[0].text,
- e = `${cba(t)}`;
- m.reply({
- body: e
- }, (r, o) => {
- global.GoatBot.onReply.set(o.messageID, {
- commandName: n,
- messageID: o.messageID,
- author: i
- })
- })
- }
- }
- if (!s) return void console.error("Error: Invalid message or attachment type");
- const d = `${global.api.s}/telegraph?url=${encodeURIComponent(s)}&senderId=${i}`,
- p = await a.get(d),
- u = p.data.result.link,
- o = r.join(" "),
- f = `${global.api.s}/gemini-pro?text=${encodeURIComponent(o)}&url=${encodeURIComponent(u)}`;
- m.reply({
- body: (await a.get(f)).data
- })
- } catch (t) {
- console.error("Error:", t.message)
- }
- },
- onReply: async function({
- message: m,
- event: e,
- Reply: r,
- args: n
- }) {
- try {
- let {
- author: o,
- commandName: c
- } = r;
- if (e.senderID !== o) return;
- const i = n.join(" "),
- d = await a.get(`${global.api.s}/Gemini?text=${encodeURIComponent(i)}&uid=${e.senderID}`);
- if (d.data && d.data.candidates && d.data.candidates.length > 0) {
- const t = d.data.candidates[0].content.parts[0].text,
- r = `${cba(t)}`;
- m.reply({
- body: r
- }, (t, n) => {
- global.GoatBot.onReply.set(n.messageID, {
- commandName: c,
- messageID: n.messageID,
- author: e.senderID
- })
- })
- }
- } catch (t) {
- console.error("Error:", t.message)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement