Skip to content

Instantly share code, notes, and snippets.

@dipto-008
Last active March 6, 2024 06:13
Show Gist options
  • Save dipto-008/9429880a3262f12d2b267d1241d7c8ba to your computer and use it in GitHub Desktop.
Save dipto-008/9429880a3262f12d2b267d1241d7c8ba to your computer and use it in GitHub Desktop.
Hey noob ๐Ÿ‘‹๐Ÿ‘‹
const axios = require('axios');
const path = require('path');
const fs = require('fs');
module.exports.config = {
name: "album",
version: "1.0.0",
hasPermssion: 0,
credits: "Dipto",
description: "Displays album options for selection.",
usePrefix: true,
commandCategory: "Media",
usages: "Only or add [cartoon/photo/lofi/sad/islamic/funny/horny/anime/aesthetic/cat/lyrics/love/sigma]",
cooldowns: 5
};
module.exports.run = async function ({ api, event, args}) {
if (!args[0]){
{ api.setMessageReaction("๐Ÿ˜˜", event.messageID, (err) => {}, true);
}
const albumOptions = [
"๐—™๐˜‚๐—ป๐—ป๐˜† ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ",
"๐—œ๐˜€๐—น๐—ฎ๐—บ๐—ถ๐—ฐ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ",
"๐—ฆ๐—ฎ๐—ฑ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ",
"๐—”๐—ป๐—ถ๐—บ๐—ฒ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ",
"๐—–๐—ฎ๐—ฟ๐˜๐—ผ๐—ผ๐—ป ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ",
"๐—Ÿ๐—ผ๐—™๐—ถ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ",
"๐—›๐—ผ๐—ฟ๐—ป๐˜† ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ",
"๐—–๐—ผ๐˜‚๐—ฝ๐—น๐—ฒ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ",
"๐—™๐—น๐—ผ๐˜„๐—ฒ๐—ฟ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ",
"๐—ฅ๐—ฎ๐—ป๐—ฑ๐—ผ๐—บ ๐—ฃ๐—ต๐—ผ๐˜๐—ผ"
];
const message = "โค๏ธโ€๐Ÿฉน ๐—–๐—ต๐—ผ๐—ผ๐˜€๐—ฒ ๐—ฎ๐—ป ๐—ผ๐—ฝ๐˜๐—ถ๐—ผ๐—ป๐˜€ ๐—•๐—ฎ๐—ฏ๐˜† <๐Ÿ’\n"+"โœฟโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โœฟ\n"+ albumOptions.map((option, index) => `๐ŸŽ€ | ${index + 1}. ${option} ๐Ÿค`).join("\n")+`\nโœฟโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โœฟ\n๐Ÿ”ฐ | ๐๐š๐ ๐ž [ ๐Ÿ/๐Ÿ ]\nโ„น | ๐“๐ฒ๐ฉ๐ž ${global.config.PREFIX}album 2 - ๐ญ๐จ ๐ฌ๐ž๐ž ๐ง๐ž๐ฑ๐ญ ๐ฉ๐š๐ ๐ž.\nโœฟโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โœฟ`;
await api.sendMessage({body: message,},event.threadID,(error, info) => {
global.client.handleReply.push({
name: this.config.name,
type: 'reply',
messageID: info.messageID,
author: event.senderID,
link: albumOptions
})},event.messageID);
}else if (args[0] === "2"){
{ api.setMessageReaction("๐Ÿ˜˜", event.messageID, (err) => {}, true);
}
const albumOptions = [
"๐—”๐—ฒ๐˜€๐˜๐—ต๐—ฒ๐˜๐—ถ๐—ฐ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ",
"๐—ฆ๐—ถ๐—ด๐—บ๐—ฎ ๐—ฅ๐˜‚๐—น๐—ฒ",
"๐—Ÿ๐˜†๐—ฟ๐—ถ๐—ฐ๐˜€ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ",
"๐—–๐—ฎ๐˜ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ",
"18+ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ",
"๐—™๐—ฟ๐—ฒ๐—ฒ ๐—™๐—ถ๐—ฟ๐—ฒ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ",
"๐—™๐—ผ๐—ผ๐˜๐—•๐—ฎ๐—น๐—น ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ",
"๐—š๐—ถ๐—ฟ๐—น ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ",
"๐—™๐—ฟ๐—ถ๐—ฒ๐—ป๐—ฑ๐˜€ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ"
];
const message = "โค๏ธโ€๐Ÿฉน ๐—–๐—ต๐—ผ๐—ผ๐˜€๐—ฒ ๐—ฎ๐—ป ๐—ผ๐—ฝ๐˜๐—ถ๐—ผ๐—ป๐˜€ ๐—•๐—ฎ๐—ฏ๐˜† <๐Ÿ’\n"+"โœฟโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โœฟ\n"+ albumOptions.map((option, index) => `๐ŸŽ€ | ${index + 11}. ${option} ๐Ÿค`).join("\n")+"\nโœฟโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โœฟ\n๐Ÿ”ฐ | ๐๐š๐ ๐ž [ ๐Ÿ/๐Ÿ ]\nโœฟโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โœฟ";
await api.sendMessage({body: message,},event.threadID,(error, info) => {
global.client.handleReply.push({
name: this.config.name,
type: 'reply',
messageID: info.messageID,
author: event.senderID,
link: albumOptions
})},event.messageID);
}
//------------Video Add--------------//
const validCommands = ['cartoon', 'photo', 'lofi', 'sad', 'islamic','funny','horny','anime','love','baby','lyrics','sigma','photo','aesthetic','cat','flower','ff','sex','girl','football','friend'];
{ api.setMessageReaction("๐Ÿ‘€", event.messageID, (err) => {}, true);
}
if (args[0] === 'list'){
try {
const lRes = await axios.get(`https://all-image-genator-d1p.onrender.com/dipto/album?list=dipto`);
const data = lRes.data;
api.sendMessage(`๐Ÿ–ค ๐—ง๐—ผ๐˜๐—ฎ๐—น ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐—ฎ๐˜ƒ๐—ฎ๐—ถ๐—น๐—ฎ๐—ฏ๐—น๐—ฒ ๐—ถ๐—ป ๐—ฎ๐—น๐—ฏ๐˜‚๐—บ ๐Ÿฉต\n\n${data.data}`, event.threadID, event.messageID);
} catch (error) {
api.sendMessage(`${error}`,event.threadID,event.messageID)
}
}
const d1 = args[1]?args[1].toLowerCase() : '' ;
if (!d1 || !validCommands.includes(d1))return;
if (!event.messageReply || !event.messageReply.attachments) return;
const attachment = event.messageReply.attachments[0].url;
const URL = attachment;
let query;
switch (d1) {
case 'cartoon':
query = 'addVideo';
break;
case 'photo':
query = 'addPhoto';
break;
case 'lofi':
query = 'addLofi';
break;
case 'sad':
query = 'addSad';
break;
case 'funny':
query = 'addFunny';
break;
case 'islamic':
query = 'addIslamic';
break;
case 'horny':
query = 'addHorny';
break;
case 'anime':
query = 'addAnime';
break;
case 'love':
query = 'addLove';
break;
case 'lyrics':
query = 'addLyrics';
break;
case 'flower':
query = 'addBaby';
break;
case 'photo':
query = 'addPhoto';
break;
case 'sigma':
query = 'addSigma';
break;
case 'aesthetic':
query = 'addAesthetic';
break;
case 'cat':
query = 'addCat';
break;
case 'ff':
query = 'addFf';
break;
case 'sex':
query = 'addSex';
break;
case 'football':
query = 'addFootball';
break;
case 'girl':
query = 'addGirl';
break;
case 'friend':
query = 'addFriend';
break;
default:
break;
}
try {
const response = await axios.get(`https://all-image-genator-d1p.onrender.com/dipto/imgur?url=${encodeURIComponent(URL)}`);
const imgurLink = response.data.data;
const fileExtension = path.extname(imgurLink);
let query2;
if (fileExtension === '.jpg' || fileExtension === '.jpeg' || fileExtension === '.png') {query2 = 'addPhoto';}
else if (fileExtension === '.mp4') {
query2 = query;} else {
api.sendMessage('Invalid file format.', event.threadID, event.messageID);
return;
}
const svRes = await axios.get(`https://all-image-genator-d1p.onrender.com/dipto/album?add=${query2}&url=${imgurLink}`);
const data = svRes.data;
// console.log(data);
api.sendMessage(`โœ… | ${data.data}\n\n๐Ÿ”ฐ | ${data.data2}`, event.threadID, event.messageID);
} catch (error) {console.error('Error:', error);api.sendMessage(`Failed to convert image.\n${error}`, event.threadID, event.messageID);
}
};
module.exports.handleReply = async function ({ api, event, handleReply }) {
api.unsendMessage(handleReply.messageID);
const admin = "100044327656712";
if (event.type == "message_reply") {
const reply = parseInt(event.body);
if (isNaN(reply)) {
return api.sendMessage("Please reply with either 1 - 13", event.threadID, event.messageID);
}
let query;
let cp;
if (reply === 1) {
query = "funny";
cp = "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—™๐˜‚๐—ป๐—ป๐˜† ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿคฃ";
} else if (reply === 2) {
query = "islamic";
cp = "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—œ๐˜€๐—น๐—ฎ๐—บ๐—ถ๐—ฐ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜‡";
}else if (reply === 3) {
query = "sad";
cp = "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—ฆ๐—ฎ๐—ฑ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿฅบ";
}else if (reply === 4) {
query = "anime";
cp = "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—ฎ๐—ป๐—ถ๐—บ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜˜";
}else if (reply === 5) {
query = "video";
cp = "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—–๐—ฎ๐—ฟ๐˜๐—ผ๐—ผ๐—ป ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜‡";
}else if (reply === 6) {
query = "lofi";
cp = "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—Ÿ๐—ผ๐—ณ๐—ถ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜‡";
}
else if (reply === 7 && event.senderID == admin) {
query = "horny";
cp = "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—›๐—ผ๐—ฟ๐—ป๐˜† ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿฅต";
}
else if (reply === 7 && event.senderID !== admin) {
return api.sendMessage("Hop beda luccha ",event.threadID, event.messageID);
}
else if (reply === 8) {
query = "love";
cp = "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—Ÿ๐—ผ๐˜ƒ๐—ฒ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜";
}
else if (reply === 9) {
query = "flower";
cp = "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—™๐—น๐—ผ๐˜„๐—ฒ๐—ฟ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ < ๐ŸŒท๐ŸŒธ";
}
else if (reply === 10) {
query = "photo";
cp = "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—ฅ๐—ฎ๐—ป๐—ฑ๐—ผ๐—บ ๐—ฃ๐—ต๐—ผ๐˜๐—ผ <๐Ÿ˜™";
}
else if (reply === 11) {
query = "aesthetic";
cp = "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—”๐—ฒ๐˜€๐˜๐—ต๐—ฒ๐˜๐—ถ๐—ฐ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜™";
}
else if (reply === 12) {
query = "sigma";
cp = "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—ฆ๐—ถ๐—ด๐—บ๐—ฎ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿค";
}
else if (reply === 13) {
query = "lyrics";
cp = "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—Ÿ๐˜†๐—ฟ๐—ถ๐—ฐ๐˜€ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿฅฐ";
}
else if (reply === 14) {
query = "cat";
cp = "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—–๐—ฎ๐˜ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜™";
}
else if (reply === 15 && event.senderID === admin) {
query = "sex";
cp = "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—ฆ๐—ฒ๐˜… ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜™";
}
else if (reply === 16) {
query = "ff";
cp = "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—™๐—ฟ๐—ฒ๐—ฒ ๐—™๐—ถ๐—ฟ๐—ฒ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ <๐Ÿ˜™";
}
else if (reply === 17) {
query = "football";
cp = "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—™๐—ผ๐—ผ๐˜๐—ฏ๐—ฎ๐—น๐—น ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ<๐Ÿ˜™";
}
else if (reply === 18) {
query = "girl";
cp = "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—š๐—ถ๐—ฟ๐—น ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ<๐Ÿ˜™";
}else if (reply === 19) {
query = "friend";
cp = "๐—ก๐—ฎ๐˜„ ๐—•๐—ฎ๐—ฏ๐˜† ๐—™๐—ฟ๐—ถ๐—ฒ๐—ป๐—ฑ๐˜€ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ<๐Ÿ˜™";
}
try {
const res = await axios.get(`https://all-image-genator-d1p.onrender.com/dipto/album?type=${query}`);
const imgUrl = res.data.data;
const imgRes = await axios.get(imgUrl, { responseType: 'arraybuffer' });
const ex = path.extname(imgUrl);
const filename = __dirname + `/cache/d1p${ex}`;
fs.writeFileSync(filename, Buffer.from(imgRes.data, 'binary'));
api.sendMessage({
body: cp,
attachment: fs.createReadStream(filename),
},
event.threadID,
() => fs.unlinkSync(filename), event.messageID);
} catch (error) {
api.sendMessage('An error occurred while fetching the media.', event.threadID, event.messageID);
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment