← back to browse
goat command

album

Displays album options for selection.

0
views
0
likes
0
installs
raw source
const axios = require("axios");
const path = require("path");
const fs = require("fs");

const baseApiUrl = async () => {
  const base = await axios.get(
    "https://raw.githubusercontent.com/Mostakim0978/D1PT0/refs/heads/main/baseApiUrl.json"
  );
  return base.data.api;
};

module.exports = {
  config: {
    name: "album",
    version: "1.0.0",
    role: 0, // Goat-Bot-V2 uses "role" instead of "hasPermssion" (0 = everyone, 1 = group admin, 2 = bot admin)
    author: "Dipto Modified By SAHU",
    countDown: 5, // Goat-Bot-V2 uses "countDown" instead of "cooldowns"
    description: "Displays album options for selection.",
    category: "media", // Goat-Bot-V2 categories are conventionally lowercase
    guide: {
      en:
        "{pn} to see the list\n" +
        "{pn} add [cartoon/photo/lofi/sad/islamic/funny/horny/anime/aesthetic/cat/lyrics/love/sigma] (reply to a media)",
    },
  },

  onStart: async function ({ api, event, args, message }) {
    if (!args[0]) {
      api.setMessageReaction("๐Ÿ˜˜", event.messageID, () => {}, true);

      const albumOptions = [
        "๐—™๐˜‚๐—ป๐—ป๐˜† ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ", "๐—œ๐˜€๐—น๐—ฎ๐—บ๐—ถ๐—ฐ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ", "๐—ฆ๐—ฎ๐—ฑ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ", "๐—”๐—ป๐—ถ๐—บ๐—ฒ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ",
        "๐—–๐—ฎ๐—ฟ๐˜๐—ผ๐—ผ๐—ป ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ", "๐—Ÿ๐—ผ๐—™๐—ถ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ", "๐—›๐—ผ๐—ฟ๐—ป๐˜† ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ", "๐—–๐—ผ๐˜‚๐—ฝ๐—น๐—ฒ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ",
        "๐—™๐—น๐—ผ๐˜„๐—ฒ๐—ฟ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ", "๐—ฅ๐—ฎ๐—ป๐—ฑ๐—ผ๐—บ ๐—ฃ๐—ต๐—ผ๐˜๐—ผ", "๐—”๐—ฒ๐˜€๐˜๐—ต๐—ฒ๐˜๐—ถ๐—ฐ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ", "๐—ฆ๐—ถ๐—ด๐—บ๐—ฎ ๐—ฅ๐˜‚๐—น๐—ฒ",
        "๐—Ÿ๐˜†๐—ฟ๐—ถ๐—ฐ๐˜€ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ", "๐—–๐—ฎ๐˜ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ", "18+ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ", "๐—™๐—ฟ๐—ฒ๐—ฒ ๐—™๐—ถ๐—ฟ๐—ฒ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ",
        "๐—™๐—ผ๐—ผ๐˜๐—•๐—ฎ๐—น๐—น ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ", "๐—š๐—ถ๐—ฟ๐—น ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ", "๐—™๐—ฟ๐—ถ๐—ฒ๐—ป๐—ฑ๐˜€ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ", "๐—–๐—ฟ๐—ถ๐—ฐ๐—ธ๐—ฒ๐˜ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ",
      ];

      const msg =
        "โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—\n" +
        "โ•‘ ๐ŸŽต ๐—”๐—น๐—ฏ๐˜‚๐—บ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐—Ÿ๐—ถ๐˜€๐˜ ๐ŸŽถ\n" +
        "โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ\n" +
        "โ•‘ ๐ŸŽฌ ๐Ÿฌ๐Ÿญ. ๐—™๐˜‚๐—ป๐—ป๐˜† ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐Ÿค\n" +
        "โ•‘ ๐ŸŒ™๐Ÿฌ ๐Ÿฎ. ๐—œ๐˜€๐—น๐—ฎ๐—บ๐—ถ๐—ฐ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐Ÿค\n" +
        "โ•‘ ๐Ÿ’”๐Ÿฌ ๐Ÿฏ. ๐—ฆ๐—ฎ๐—ฑ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐Ÿค\n" +
        "โ•‘ ๐ŸŽŽ ๐Ÿฌ๐Ÿฐ. ๐—”๐—ป๐—ถ๐—บ๐—ฒ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐Ÿค\n" +
        "โ•‘ ๐Ÿพ๐Ÿฌ ๐Ÿฑ. ๐—–๐—ฎ๐—ฟ๐˜๐—ผ๐—ผ๐—ป ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐Ÿค\n" +
        "โ•‘ ๐ŸŽง ๐Ÿฌ๐Ÿฒ. ๐—Ÿ๐—ผ๐—™๐—ถ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐Ÿค\n" +
        "โ•‘ ๐Ÿ”ฅ ๐Ÿฌ๐Ÿณ. ๐—›๐—ผ๐—ฟ๐—ป๐˜† ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐Ÿค\n" +
        "โ•‘ ๐Ÿ’‘ ๐Ÿฌ๐Ÿด. ๐—–๐—ผ๐˜‚๐—ฝ๐—น๐—ฒ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐Ÿค\n" +
        "โ•‘ ๐ŸŒน ๐Ÿฌ๐Ÿต. ๐—™๐—น๐—ผ๐˜„๐—ฒ๐—ฟ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐Ÿค\n" +
        "โ•‘ ๐Ÿ–ผ๏ธ ๐Ÿญ๐Ÿฌ. ๐—ฅ๐—ฎ๐—ป๐—ฑ๐—ผ๐—บ ๐—ฃ๐—ต๐—ผ๐˜๐—ผ ๐Ÿค\n" +
        "โ•‘ ๐ŸŒŒ ๐Ÿญ๐Ÿญ. ๐—”๐—ฒ๐˜€๐˜๐—ต๐—ฒ๐˜๐—ถ๐—ฐ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐Ÿค\n" +
        "โ•‘ ๐Ÿฆ ๐Ÿญ๐Ÿฎ. ๐—ฆ๐—ถ๐—ด๐—บ๐—ฎ ๐—ฅ๐˜‚๐—น๐—ฒ ๐Ÿค\n" +
        "โ•‘ ๐ŸŽถ ๐Ÿญ๐Ÿฏ. ๐—Ÿ๐˜†๐—ฟ๐—ถ๐—ฐ๐˜€ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐Ÿค\n" +
        "โ•‘ ๐Ÿฑ ๐Ÿญ๐Ÿฐ. ๐—–๐—ฎ๐˜ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐Ÿค\n" +
        "โ•‘ ๐Ÿšซ ๐Ÿญ๐Ÿฑ. 18+ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐Ÿค\n" +
        "โ•‘ ๐ŸŽฎ ๐Ÿญ๐Ÿฒ. ๐—™๐—ฟ๐—ฒ๐—ฒ ๐—™๐—ถ๐—ฟ๐—ฒ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐Ÿค\n" +
        "โ•‘ โšฝ ๐Ÿญ๐Ÿณ. ๐—™๐—ผ๐—ผ๐˜๐—ฏ๐—ฎ๐—น๐—น ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐Ÿค\n" +
        "โ•‘ ๐Ÿ‘ง ๐Ÿญ๐Ÿด. ๐—š๐—ถ๐—ฟ๐—น ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐Ÿค\n" +
        "โ•‘ ๐Ÿค ๐Ÿญ๐Ÿต. ๐—™๐—ฟ๐—ถ๐—ฒ๐—ป๐—ฑ๐˜€ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐Ÿค\n" +
        "โ•‘ ๐Ÿ ๐Ÿฎ๐Ÿฌ. ๐—–๐—ฟ๐—ถ๐—ฐ๐—ธ๐—ฒ๐˜ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐Ÿค\n" +
        "โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ\n" +
        "โ•‘ ๐Ÿ”ฐเฆ†เฆชเฆจเฆฟ เฆฏเง‡ เฆ•เงเฆฏเฆพเฆŸเฆพเฆ—เฆฐเฆฟเฆฐ เฆญเฆฟเฆกเฆฟเฆ“\n" +
        "โ•‘ เฆฆเง‡เฆ–เฆคเง‡ เฆšเฆพเฆจ เฆธเง‡เฆŸเฆฟเฆฐ เฆจเฆพเฆฎเงเฆฌเฆพเฆฐ เฆฒเฆฟเฆ–เงเฆจ!\n" +
        "โ•‘ โ—€๏ธ เฆ‰เฆฆเฆพเฆนเฆฐเฆฃเฆธเงเฆฌเฆฐเง‚เฆช: 11\n" +
        "โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•";

      // message.reply returns the sent message's info (contains messageID)
      const info = await message.reply(msg);

      // Goat-Bot-V2 registers reply-listeners on global.GoatBot.onReply (a Map),
      // keyed by the sent message's messageID
      global.GoatBot.onReply.set(info.messageID, {
        commandName: this.config.name,
        messageID: info.messageID,
        author: event.senderID,
        link: albumOptions,
      });
      return;
    }

    // ------------ Video Add via URL ------------
    const d1 = args[1] ? args[1].toLowerCase() : (args[0] ? args[0].toLowerCase() : "");
    const validCommands = [
      "cartoon", "photo", "lofi", "sad", "islamic", "funny", "horny",
      "anime", "love", "baby", "lyrics", "sigma", "aesthetic",
      "cat", "flower", "ff", "sex", "football", "girl", "friend", "cricket",
    ];
    if (!d1 || !validCommands.includes(d1)) return;
    if (!event.messageReply || !event.messageReply.attachments) return;

    const attachment = event.messageReply.attachments[0].url;
    const URL = attachment;
    let queryMap = {
      cartoon: "addVideo",
      photo: "addPhoto",
      lofi: "addLofi",
      sad: "addSad",
      funny: "addFunny",
      islamic: "addIslamic",
      horny: "addHorny",
      anime: "addAnime",
      love: "addLove",
      lyrics: "addLyrics",
      flower: "addFlower",
      sigma: "addSigma",
      aesthetic: "addAesthetic",
      cat: "addCat",
      ff: "addFf",
      sex: "addSex",
      football: "addFootball",
      girl: "addGirl",
      friend: "addFriend",
      cricket: "addCricket",
    };
    const query = queryMap[d1];

    try {
      const response = await axios.get(
        `${await baseApiUrl()}/drive?url=${encodeURIComponent(URL)}`
      );
      const fileUrl = response.data.fileUrl;
      const fileExt = path.extname(fileUrl) || ".mp4";

      let queryType = [".jpg", ".jpeg", ".png"].includes(fileExt) ? "addPhoto" : query;

      const saveRes = await axios.get(
        `${await baseApiUrl()}/album?add=${queryType}&url=${fileUrl}`
      );

      message.reply(
        `โœ… | ${saveRes.data.data}\n๐Ÿ”ฐ | ${saveRes.data.data2}\n๐Ÿ”ฅ | URL: ${fileUrl}`
      );
    } catch (error) {
      console.error(error);
      message.reply(`Failed to upload media.\nError: ${error.message || error}`);
    }
  },

  onReply: async function ({ api, event, Reply, message }) {
    // Only the original requester's reply should be processed
    if (event.senderID !== Reply.author) return;
    if (event.type !== "message_reply") return;

    // remove the original prompt message (equivalent to api.unsendMessage(handleReply.messageID))
    api.unsendMessage(Reply.messageID);

    const admin = "100001039692046";

    const reply = parseInt(event.body);
    if (isNaN(reply) || reply < 1 || reply > 20) {
      return message.reply("Please reply with a number between 1 and 20");
    }

    let queryMap = {
      1: ["funny", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—™๐˜‚๐—ป๐—ป๐˜† ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿคฃ"],
      2: ["islamic", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—œ๐˜€๐—น๐—ฎ๐—บ๐—ถ๐—ฐ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜‡"],
      3: ["sad", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—ฆ๐—ฎ๐—ฑ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿฅบ"],
      4: ["anime", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—ฎ๐—ป๐—ถ๐—บ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜˜"],
      5: ["cartoon", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—–๐—ฎ๐—ฟ๐˜๐—ผ๐—ผ๐—ป ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜‡"],
      6: ["lofi", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—Ÿ๐—ผ๐—ณ๐—ถ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜‡"],
      7: ["horny", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—›๐—ผ๐—ฟ๐—ป๐˜† ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿฅต"],
      8: ["love", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—Ÿ๐—ผ๐˜ƒ๐—ฒ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜"],
      9: ["flower", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—™๐—น๐—ผ๐˜„๐—ฒ๐—ฟ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐ŸŒท๐ŸŒธ"],
      10: ["photo", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—ฅ๐—ฎ๐—ป๐—ฑ๐—ผ๐—บ ๐—ฃ๐—ต๐—ผ๐˜๐—ผ <๐Ÿ˜™"],
      11: ["aesthetic", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—”๐—ฒ๐˜€๐˜๐—ต๐—ฒ๐˜๐—ถ๐—ฐ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜™"],
      12: ["sigma", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—ฆ๐—ถ๐—ด๐—บ๐—ฎ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿค"],
      13: ["lyrics", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—Ÿ๐˜†๐—ฟ๐—ถ๐—ฐ๐˜€ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿฅฐ"],
      14: ["cat", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—–๐—ฎ๐˜ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜™"],
      15: ["sex", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—ฆ๐—ฒ๐˜… ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜™"],
      16: ["ff", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—™๐—ฟ๐—ฒ๐—ฒ ๐—™๐—ถ๐—ฟ๐—ฒ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜™"],
      17: ["football", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—™๐—ผ๐—ผ๐˜๐—ฏ๐—ฎ๐—น๐—น ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜™"],
      18: ["girl", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—š๐—ถ๐—ฟ๐—น ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜™"],
      19: ["friend", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—™๐—ฟ๐—ถ๐—ฒ๐—ป๐—ฑ๐˜€ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜™"],
      20: ["cricket", "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—–๐—ฟ๐—ถ๐—ฐ๐—ธ๐—ฒ๐˜ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜™"],
    };

    let [query, cp] = queryMap[reply];

    if ((reply === 7 || reply === 15) && event.senderID !== admin) {
      return message.reply("Only admin can use it!");
    }

    try {
      const res = await axios.get(`${await baseApiUrl()}/album?type=${query}`);
      const imgUrl = res.data.data;

      const imgRes = await axios.get(imgUrl, {
        responseType: "arraybuffer",
        headers: { "User-Agent": "Mozilla/5.0" },
      });
      const filename = path.join(__dirname, `cache/dipto_${Date.now()}.mp4`);
      fs.writeFileSync(filename, Buffer.from(imgRes.data, "binary"));

      await message.reply({
        body: cp,
        attachment: fs.createReadStream(filename),
      });
      fs.unlinkSync(filename);

      // done handling this reply chain, remove it from the onReply map
      global.GoatBot.onReply.delete(Reply.messageID);
    } catch (error) {
      console.error(error);
      message.reply(`An error occurred while fetching the media.\n${error.message || error}`);
    }
  },
};

View raw file