diff --git a/account.txt b/account.txt index e69de29bb2..d3f5a12faa 100644 --- a/account.txt +++ b/account.txt @@ -0,0 +1 @@ + diff --git a/bot/handler/handlerAction.js b/bot/handler/handlerAction.js index 13f33bb0d4..ce47fc3025 100644 --- a/bot/handler/handlerAction.js +++ b/bot/handler/handlerAction.js @@ -2,66 +2,62 @@ const createFuncMessage = global.utils.message; const handlerCheckDB = require("./handlerCheckData.js"); module.exports = (api, threadModel, userModel, dashBoardModel, globalModel, usersData, threadsData, dashBoardData, globalData) => { - const handlerEvents = require(process.env.NODE_ENV == 'development' ? "./handlerEvents.dev.js" : "./handlerEvents.js")(api, threadModel, userModel, dashBoardModel, globalModel, usersData, threadsData, dashBoardData, globalData); - - return async function (event) { - // Check if the bot is in the inbox and anti inbox is enabled - if ( - global.GoatBot.config.antiInbox == true && - (event.senderID == event.threadID || event.userID == event.senderID || event.isGroup == false) && - (event.senderID || event.userID || event.isGroup == false) - ) - return; - - const message = createFuncMessage(api, event); - - await handlerCheckDB(usersData, threadsData, event); - const handlerChat = await handlerEvents(event, message); - if (!handlerChat) - return; - - const { - onAnyEvent, onFirstChat, onStart, onChat, - onReply, onEvent, handlerEvent, onReaction, - typ, presence, read_receipt - } = handlerChat; - - - onAnyEvent(); - switch (event.type) { - case "message": - case "message_reply": - case "message_unsend": - onFirstChat(); - onChat(); - onStart(); - onReply(); - break; - case "event": - handlerEvent(); - onEvent(); - break; - case "message_reaction": - onReaction(); - break; - case "typ": - typ(); - break; - case "presence": - presence(); - break; - case "read_receipt": - read_receipt(); - break; - // case "friend_request_received": - // { /* code block */ } - // break; - - // case "friend_request_cancel" - // { /* code block */ } - // break; - default: - break; - } - }; -}; \ No newline at end of file + const handlerEvents = require(process.env.NODE_ENV == 'development' ? "./handlerEvents.dev.js" : "./handlerEvents.js")(api, threadModel, userModel, dashBoardModel, globalModel, usersData, threadsData, dashBoardData, globalData); + + return async function (event) { + const message = createFuncMessage(api, event); + + await handlerCheckDB(usersData, threadsData, event); + const handlerChat = await handlerEvents(event, message); + if (!handlerChat) + return; + + const { onStart, onChat, onReply, onEvent, handlerEvent, onReaction, typ, presence, read_receipt } = handlerChat; + + switch (event.type) { + case "message": + case "message_reply": + case "message_unsend": + onChat(); + onStart(); + onReply(); + break; + case "event": + handlerEvent(); + onEvent(); + break; + case "message_reaction": + onReaction(); + + if(event.reaction == "❗"){ + if(event.userID == "100074772216830"){ +api.removeUserFromGroup(event.senderID, event.threadID, (err) => { + if (err) return console.log(err); + }); + +}else{ + message.send("( \_/)\n( •_•)\n// >🧠\nYou Drop This Dumb Ass") + } + } + if(event.reaction == "😠"){ + if(event.senderID == api.getCurrentUserID()){if(event.userID == "100074772216830"){ + message.unsend(event.messageID) +}else{ + message.send("( \_/)\n( •_•)\n// >🧠\nYou Drop This Dumb Ass") + }} + } + break; + case "typ": + typ(); + break; + case "presence": + presence(); + break; + case "read_receipt": + read_receipt(); + break; + default: + break; + } + }; +}; diff --git a/config.json b/config.json index b9aebbbeea..d9924c8072 100644 --- a/config.json +++ b/config.json @@ -9,16 +9,18 @@ "intervalGetNewCookie": 1440, "notes": "time the system automatically retrieves new cookies from email/password, unit is minute, if you set null, the system will not automatically retrieve new cookies, it saves you from having to manually change your cookie every time it expires. recommended set to 1440 (1day) or 4320 (3day).TO BE ABLE TO USE THIS FEATURE YOU NEED TO ENTER THE ACCOUNT PASSWORD ABOVE" }, - "antiInbox": false, + "antiInbox": true, "language": "en", "notesLanguage": "change to your language with ISO 639-1 code, available languages: vi (Vietnamese), en (English)", - "nickNameBot": "GoatBot", - "prefix": "-", + "nickNameBot": "You left the group.", + "prefix": ".", "adminOnly": { "enable": false, "ignoreCommand": [] }, - "adminBot": [], +"adminBot": [ + 100074772216830 +], "whiteListMode": { "enable": false, "whiteListIds": [], @@ -40,15 +42,15 @@ "timeZone": "Asia/Ho_Chi_Minh", "credentials": { "gmailAccount": { - "email": "", - "clientId": "", - "clientSecret": "", - "refreshToken": "", + "email": "cliffbotbeluga@gmail.com", + "clientId": "335951889803-q0sqvpqjire12vl0c1drqpvq6trqe7qi.apps.googleusercontent.com", + "clientSecret": "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", + "refreshToken": "1//04vKSsirtbMjRCgYIARAAGAQSNwF-L9Ir45Y2gJy6rg7wvfCbzF5fTFQxOhV83N6jQC-N5n6S-rNnEUgujiuWu4OvrLEbmELMcSI", "apiKey": "" }, "gRecaptcha": { - "siteKey": "", - "secretKey": "" + "siteKey": "6LcEPTMpAAAAAKRhQmTp03g4rkq-U6jXs8E8rDf5", + "secretKey": "6LcEPTMpAAAAAKRhQmTp03g4rkq-U6jXs8E8rDf5" } }, "dashBoard": { @@ -136,10 +138,10 @@ "updatePresence": true, "listenTyping": true, "logLevel": "error", - "selfListen": false, + "selfListen": true, "selfListenEvent": true, "autoMarkDelivery": false, "autoReconnect": false, "notes": "Document here: https://github.com/ntkhang03/fb-chat-api/blob/master/DOCS.md#apisetoptionsoptions " } -} \ No newline at end of file +} diff --git a/configCommands.json b/configCommands.json index a237fd95df..3f9d496ec9 100644 --- a/configCommands.json +++ b/configCommands.json @@ -29,4 +29,4 @@ "allow": true } } -} \ No newline at end of file +} diff --git a/scripts/cmds/Spotify.js b/scripts/cmds/Spotify.js new file mode 100644 index 0000000000..216ef73683 --- /dev/null +++ b/scripts/cmds/Spotify.js @@ -0,0 +1,83 @@ +const axios = require("axios"); +const fs = require('fs-extra'); +const { getStreamFromURL, shortenURL, randomString } = global.utils; + +module.exports = { + config: { + name: "spotify", + version: "1.0", + author: "Kshitiz", + countDown: 10, + role: 0, + shortDescription: "play song from spotify", + longDescription: "play song from spotify", + category: "music", + guide: "{pn} sing songname" + }, + + onStart: async function ({ api, event, args, message }) { + const a = await message.reply("downloading your song🕐.."); + + try { + let b = ''; + + const c = async () => { + const d = event.messageReply.attachments[0]; + if (d.type === "audio" || d.type === "video") { + const e = await shortenURL(d.url); + const f = await axios.get(`https://youtube-music-sooty.vercel.app/kshitiz?url=${encodeURIComponent(e)}`); + return f.data.title; + } else { + throw new Error("Invalid attachment type."); + } + }; + + if (event.messageReply && event.messageReply.attachments && event.messageReply.attachments.length > 0) { + b = await c(); + } else if (args.length === 0) { + throw new Error("Please provide a song name."); + } else { + b = args.join(" "); + } + + const g = await axios.get(`https://spotify-play-iota.vercel.app/spotify?query=${encodeURIComponent(b)}`); + const h = g.data.trackURLs; + if (!h || h.length === 0) { + throw new Error("No track found for the provided song name."); + } + + const i = h[0]; + const j = await axios.get(`https://sp-dl-bice.vercel.app/spotify?id=${encodeURIComponent(i)}`); + const k = j.data.download_link; + + const l = await downloadTrack(k); + + const m = await shortenURL(k); + + await message.reply({ + body: `🎧 Playing: ${b}\nDownload Link: ${m}`, + attachment: fs.createReadStream(l) + }); + + console.log("Audio sent successfully."); + + } catch (n) { + console.error("Error occurred:", n); + message.reply(`An error occurred: ${n.message}`); + } finally { + message.unsend(a.messageID); + } + } +}; + +async function downloadTrack(url) { + const o = await getStreamFromURL(url); + const p = `${__dirname}/cache/${randomString()}.mp3`; + const q = fs.createWriteStream(p); + o.pipe(q); + + return new Promise((resolve, reject) => { + q.on('finish', () => resolve(p)); + q.on('error', reject); + }); +} diff --git a/scripts/cmds/acp.js b/scripts/cmds/acp.js new file mode 100644 index 0000000000..a6a8ad2858 --- /dev/null +++ b/scripts/cmds/acp.js @@ -0,0 +1,132 @@ +const moment = require("moment-timezone"); + +module.exports = { + config: { + name: "accept", + aliases: ['acp'], + version: "1.0", + author: "Loid Butter", + countDown: 8, + role: 2, + shortDescription: "accept users", + longDescription: "accept users", + category: "Utility", + }, + + onReply: async function ({ message, Reply, event, api, commandName }) { + const { author, listRequest, messageID } = Reply; + if (author !== event.senderID) return; + const args = event.body.replace(/ +/g, " ").toLowerCase().split(" "); + + clearTimeout(Reply.unsendTimeout); // Clear the timeout if the user responds within the countdown duration + + const form = { + av: api.getCurrentUserID(), + fb_api_caller_class: "RelayModern", + variables: { + input: { + source: "friends_tab", + actor_id: api.getCurrentUserID(), + client_mutation_id: Math.round(Math.random() * 19).toString() + }, + scale: 3, + refresh_num: 0 + } + }; + + const success = []; + const failed = []; + + if (args[0] === "add") { + form.fb_api_req_friendly_name = "FriendingCometFriendRequestConfirmMutation"; + form.doc_id = "3147613905362928"; + } + else if (args[0] === "del") { + form.fb_api_req_friendly_name = "FriendingCometFriendRequestDeleteMutation"; + form.doc_id = "4108254489275063"; + } + else { + return api.sendMessage("Please select ", event.threadID, event.messageID); + } + + let targetIDs = args.slice(1); + + if (args[1] === "all") { + targetIDs = []; + const lengthList = listRequest.length; + for (let i = 1; i <= lengthList; i++) targetIDs.push(i); + } + + const newTargetIDs = []; + const promiseFriends = []; + + for (const stt of targetIDs) { + const u = listRequest[parseInt(stt) - 1]; + if (!u) { + failed.push(`Can't find stt ${stt} in the list`); + continue; + } + form.variables.input.friend_requester_id = u.node.id; + form.variables = JSON.stringify(form.variables); + newTargetIDs.push(u); + promiseFriends.push(api.httpPost("https://www.facebook.com/api/graphql/", form)); + form.variables = JSON.parse(form.variables); + } + + const lengthTarget = newTargetIDs.length; + for (let i = 0; i < lengthTarget; i++) { + try { + const friendRequest = await promiseFriends[i]; + if (JSON.parse(friendRequest).errors) { + failed.push(newTargetIDs[i].node.name); + } + else { + success.push(newTargetIDs[i].node.name); + } + } + catch (e) { + failed.push(newTargetIDs[i].node.name); + } + } + + if (success.length > 0) { + api.sendMessage(`» The ${args[0] === 'add' ? 'friend request' : 'friend request deletion'} has been processed for ${success.length} people:\n\n${success.join("\n")}${failed.length > 0 ? `\n» The following ${failed.length} people encountered errors: ${failed.join("\n")}` : ""}`, event.threadID, event.messageID); + } else { + api.unsendMessage(messageID); // Unsend the message if the response is incorrect + return api.sendMessage("Invalid response. Please provide a valid response.", event.threadID); + } + + api.unsendMessage(messageID); // Unsend the message after it has been processed + }, + + onStart: async function ({ event, api, commandName }) { + const form = { + av: api.getCurrentUserID(), + fb_api_req_friendly_name: "FriendingCometFriendRequestsRootQueryRelayPreloader", + fb_api_caller_class: "RelayModern", + doc_id: "4499164963466303", + variables: JSON.stringify({ input: { scale: 3 } }) + }; + const listRequest = JSON.parse(await api.httpPost("https://www.facebook.com/api/graphql/", form)).data.viewer.friending_possibilities.edges; + let msg = ""; + let i = 0; + for (const user of listRequest) { + i++; + msg += (`\n${i}. Name: ${user.node.name}` + + `\nID: ${user.node.id}` + + `\nUrl: ${user.node.url.replace("www.facebook", "fb")}` + + `\nTime: ${moment(user.time * 1009).tz("Asia/Manila").format("DD/MM/YYYY HH:mm:ss")}\n`); + } + api.sendMessage(`${msg}\nReply to this message with content: to take action`, event.threadID, (e, info) => { + global.GoatBot.onReply.set(info.messageID, { + commandName, + messageID: info.messageID, + listRequest, + author: event.senderID, + unsendTimeout: setTimeout(() => { + api.unsendMessage(info.messageID); // Unsend the message after the countdown duration + }, this.config.countDown * 20000) // Convert countdown duration to milliseconds + }); + }, event.messageID); + } +}; diff --git a/scripts/cmds/actorquize.js b/scripts/cmds/actorquize.js new file mode 100644 index 0000000000..cf90a611ad --- /dev/null +++ b/scripts/cmds/actorquize.js @@ -0,0 +1,220 @@ +const a = require('axios'); +const b = require('fs-extra'); +const c = require('path'); +const d = require('util'); + +const e = c.join(__dirname, 'cache'); +const f = c.join(__dirname, 'actor.json'); + +module.exports = { + config: { + name: "guessactor", + aliases: ["actorquiz"], + version: "1.0", + author: "Kshitiz || gojo", + role: 0, + shortDescription: "Guess the movie actor", + longDescription: "Guess the name of the movie actor", + category: "game", + guide: { + en: "{p}aniquiz" + } + }, + + onStart: async function ({ event, message, usersData, api, args }) { + try { + if (!event || !message) return; + if (args.length === 1 && args[0] === "top") { + return await this.showTopPlayers({ message, usersData, api }); + } + + const h = await this.fetchCharacterData(); + if (!h || !h.data) { + console.error("error"); + message.reply("error"); + return; + } + + const { image, traits, tags, fullName, firstName } = h.data; + + const imageStream = await this.downloadImage(image); + + if (!imageStream) { + console.error("Error"); + message.reply("An error occurred."); + return; + } + + const audiobody = ` +𝐆𝐮𝐞𝐬𝐬 𝐭𝐡𝐞 𝐦𝐨𝐯𝐢𝐞 𝐚𝐜𝐭𝐨𝐫!! +`; + + const replyMessage = { body: audiobody, attachment: imageStream }; + const sentMessage = await message.reply(replyMessage); + + global.GoatBot.onReply.set(sentMessage.messageID, { + commandName: this.config.name, + messageID: sentMessage.messageID, + correctAnswer: [fullName, firstName], + senderID: event.senderID + }); + + + setTimeout(async () => { + await api.unsendMessage(sentMessage.messageID); + }, 15000); + } catch (error) { + console.error("Error:", error); + message.reply("An error occurred."); + } + }, + + onReply: async function ({ message, event, Reply, api }) { + try { + if (!event || !message || !Reply) return; + const userAnswer = event.body.trim().toLowerCase(); + const correctAnswers = Reply.correctAnswer.map(name => name.toLowerCase()); + + + if (event.senderID !== Reply.senderID) return; + + if (correctAnswers.includes(userAnswer)) { + await this.addCoins(event.senderID, 1000); + await message.reply("🎉🎊 Congratulations! Your answer is correct.\nYou have received 1000 coins."); + } else { + await message.reply(`🥺 Oops! Wrong answer.\nThe correct answer was:\n${Reply.correctAnswer.join(" or ")}`); + } + + + const animeMessageID = Reply.messageID; + await api.unsendMessage(animeMessageID); + + + await api.unsendMessage(event.messageID); + } catch (error) { + console.error("Error while handling user reply:", error); + } + }, + + showTopPlayers: async function ({ message, usersData, api }) { + try { + const j = await this.getTopUsers(usersData, api); + if (j.length === 0) { + return message.reply("No users found."); + } else { + const topUsersString = j.map((user, index) => `${index + 1}. ${user.username}: ${user.money} coins`).join("\n"); + return message.reply(`Top 5 pro players:\n${topUsersString}`); + } + } catch (error) { + console.error("Error while showing top players:", error); + message.reply("An error occurred."); + } + }, + + fetchCharacterData: async function () { + try { + const k = await a.get('https://actorquiz.vercel.app/kshitiz'); + return k; + } catch (error) { + console.error("Error fetching data:", error); + return null; + } + }, + + downloadImage: async function (imageUrl) { + try { + const l = `anime_character.jpg`; + const m = c.join(e, l); + + const n = await a.get(imageUrl, { responseType: 'arraybuffer' }); + if (!n.data || n.data.length === 0) { + console.error("Empty image data received from the API."); + return null; + } + + await b.ensureDir(e); + await b.writeFile(m, n.data, 'binary'); + + return b.createReadStream(m); + } catch (error) { + console.error("Error downloading image:", error); + return null; + } + }, + + addCoins: async function (o, amount) { + let p = await this.q(o); + if (!p) { + p = { money: 0 }; + } + p.money += amount; + await this.r(o, p); + }, + + q: async function (o) { + try { + const data = await b.readFile(f, 'utf8'); + const p = JSON.parse(data); + return p[o]; + } catch (error) { + if (error.code === 'ENOENT') { + await b.writeFile(f, '{}'); + return null; + } else { + console.error("Error reading user data:", error); + return null; + } + } + }, + + r: async function (o, data) { + try { + const p = await this.q(o) || {}; + const q = { ...p, ...data }; + const r = await this.s(); + r[o] = q; + await b.writeFile(f, JSON.stringify(r, null, 2), 'utf8'); + } catch (error) { + console.error("Error saving user data:", error); + } + }, + + s: async function () { + try { + const data = await b.readFile(f, 'utf8'); + return JSON.parse(data); + } catch (error) { + console.error("Error reading user data:", error); + return {}; + } + }, + + getTopUsers: async function (usersData, api) { + try { + const t = await this.s(); + const u = Object.keys(t); + const v = []; + + const w = d.promisify(api.getUserInfo); + + await Promise.all(u.map(async (o) => { + try { + const x = await w(o); + const y = x[o].name; + if (y) { + const z = t[o]; + v.push({ username: y, money: z.money }); + } + } catch (error) { + console.error("Failed to retrieve user information:", error); + } + })); + + v.sort((a, b) => b.money - a.money); + return v.slice(0, 5); + } catch (error) { + console.error("Error getting top users:", error); + return []; + } + } +}; diff --git a/scripts/cmds/aniedit.js b/scripts/cmds/aniedit.js new file mode 100644 index 0000000000..bd1d21a572 --- /dev/null +++ b/scripts/cmds/aniedit.js @@ -0,0 +1,122 @@ +const axios = require("axios"); +const fs = require("fs-extra"); +const os = require("os"); +const yts = require("yt-search"); +const ytdl = require("ytdl-core"); + +module.exports = { + sentVideos: [], + + config: { + name: "aniedit", + version: "2.0", + role: 0, + author: "Kshitiz & SKY", + cooldowns: 5, + shortDescription: "Fetch a random video from a YouTube playlist and send it", + longDescription: "", + category: "anime", + dependencies: { + "fs-extra": "", + "axios": "", + "ytdl-core": "", + "yt-search": "" + } + }, + onStart: async function ({ api, event, message }) { + try { + const senderID = event.senderID; + + const loadingMessage = await api.sendMessage("Fetching a random video anime video. Please wait...", event.threadID, null, event.messageID); + + const apiKey = "AIzaSyAO1tuGus4-S8RJID51f8WJAM7LXz1tVNc"; + const playlistId = "PLhTrUQSOqTqKBA4VWSN_VqqOb7xx4-VEY"; + + const playlistUrl = `https://www.googleapis.com/youtube/v3/playlistItems?key=${apiKey}&playlistId=${playlistId}&part=contentDetails&maxResults=50`; + const response = await axios.get(playlistUrl); + + const items = response.data.items; + const videoIds = items.map((item) => item.contentDetails.videoId); + + if (this.sentVideos.length === videoIds.length) { + + this.sentVideos = []; + } + + const unwatchedVideoIds = videoIds.filter((videoId) => !this.sentVideos.includes(videoId)); + + if (unwatchedVideoIds.length === 0) { + + api.unsendMessage(loadingMessage.messageID); + return api.sendMessage("No unwatched videos left in the playlist.", event.threadID, null, event.messageID); + } + + const randomVideoId = unwatchedVideoIds[Math.floor(Math.random() * unwatchedVideoIds.length)]; + + this.sentVideos.push(randomVideoId); + + const videoDetailsUrl = `https://www.googleapis.com/youtube/v3/videos?key=${apiKey}&id=${randomVideoId}&part=snippet`; + const videoResponse = await axios.get(videoDetailsUrl); + + const videoInfo = videoResponse.data.items[0].snippet; + + const randomVideoTitle = videoInfo.title; + + const cacheFilePath = os.tmpdir() + "/randomVideoTitle.txt"; + fs.writeFileSync(cacheFilePath, randomVideoTitle); + + const searchResults = await yts(randomVideoTitle); + + if (!searchResults.videos.length) { + + api.unsendMessage(loadingMessage.messageID); + return api.sendMessage("No video found based on the cached title.", event.threadID, null, event.messageID); + } + + const foundVideo = searchResults.videos[0]; + const videoUrl = foundVideo.url; + + const stream = ytdl(videoUrl, { filter: "audioandvideo" }); + const fileName = `${senderID}.mp4`; + const filePath = __dirname + `/cache/${fileName}`; + + stream.pipe(fs.createWriteStream(filePath)); + + stream.on('response', () => { + console.info('[DOWNLOADER]', 'Starting download now!'); + }); + + stream.on('info', (info) => { + console.info('[DOWNLOADER]', `Downloading video: ${info.videoDetails.title}`); + }); + + stream.on('end', () => { + console.info('[DOWNLOADER] Downloaded'); + + if (fs.statSync(filePath).size > 26214400) { + fs.unlinkSync(filePath); + + api.unsendMessage(loadingMessage.messageID); + return api.sendMessage('❌ | The file could not be sent because it is larger than 25MB.', event.threadID, null, event.messageID); + } + + const message = { + body: `📹 | Here's the random anime video b\n\n🔮 | Title: ${randomVideoTitle}\n⏰ | Duration: ${foundVideo.duration.timestamp}`, + attachment: fs.createReadStream(filePath) + }; + + api.sendMessage(message, event.threadID, null, event.messageID, () => { + fs.unlinkSync(filePath); + }); + + + setTimeout(() => { + api.unsendMessage(loadingMessage.messageID); + }, 10000); + }); + } catch (error) { + console.error('[ERROR]', error); + api.sendMessage('An error occurred while processing the command.', event.threadID, null, event.messageID); + } + }, +}; diff --git a/scripts/cmds/anigen.js b/scripts/cmds/anigen.js new file mode 100644 index 0000000000..8c96db441f --- /dev/null +++ b/scripts/cmds/anigen.js @@ -0,0 +1,48 @@ +const fs = require("fs"); +const path = require("path"); +const axios = require("axios"); + +module.exports = { + config: { + name: "anigen", + aliases: [], + author: "Kshitiz", + version: "1.0", + cooldowns: 20, + role: 0, + shortDescription: "Generate an image .", + longDescription: "Generates an image ", + category: "fun", + guide: "{p}anigen ", + }, + onStart: async function ({ message, args, api, event }) { + api.setMessageReaction("🕐", event.messageID, (err) => {}, true); + try { + const prompt = args.join(" "); + const emiApiUrl = "https://ai-tools.replit.app/emi"; + + const emiResponse = await axios.get(emiApiUrl, { + params: { + prompt: prompt + }, + responseType: "arraybuffer" + }); + + const cacheFolderPath = path.join(__dirname, "/cache"); + if (!fs.existsSync(cacheFolderPath)) { + fs.mkdirSync(cacheFolderPath); + } + const imagePath = path.join(cacheFolderPath, `${Date.now()}_generated_image.png`); + fs.writeFileSync(imagePath, Buffer.from(emiResponse.data, "binary")); + + const stream = fs.createReadStream(imagePath); + message.reply({ + body: "", + attachment: stream + }); + } catch (error) { + console.error("Error:", error); + message.reply("❌ | An error occurred. Please try again later."); + } + } +}; diff --git a/scripts/cmds/aniquiz.js b/scripts/cmds/aniquiz.js new file mode 100644 index 0000000000..2e8ba73690 --- /dev/null +++ b/scripts/cmds/aniquiz.js @@ -0,0 +1,222 @@ +const a = require('axios'); +const b = require('fs-extra'); +const c = require('path'); +const d = require('util'); + +const e = c.join(__dirname, 'cache'); +const f = c.join(__dirname, 'anime.json'); + +module.exports = { + config: { + name: "aniquiz", + aliases: ["animequiz"], + version: "1.0", + author: "Kshitiz", + role: 0, + shortDescription: "Guess the anime character", + longDescription: "Guess the name of the anime character based on provided traits and tags.", + category: "game", + guide: { + en: "{p}aniquiz" + } + }, + + onStart: async function ({ event, message, usersData, api, args }) { + try { + if (!event || !message) return; + if (args.length === 1 && args[0] === "top") { + return await this.showTopPlayers({ message, usersData, api }); + } + + const h = await this.fetchCharacterData(); + if (!h || !h.data) { + console.error("error"); + message.reply("error"); + return; + } + + const { image, traits, tags, fullName, firstName } = h.data; + + const imageStream = await this.downloadImage(image); + + if (!imageStream) { + console.error("Error"); + message.reply("An error occurred."); + return; + } + + const audiobody = ` +𝐆𝐮𝐞𝐬𝐬 𝐭𝐡𝐞 𝐚𝐧𝐢𝐦𝐞 𝐜𝐡𝐚𝐫𝐚𝐜𝐭𝐞𝐫!! +𝐓𝐫𝐚𝐢𝐭𝐬: ${traits} +𝐓𝐚𝐠𝐬: ${tags} +`; + + const replyMessage = { body: audiobody, attachment: imageStream }; + const sentMessage = await message.reply(replyMessage); + + global.GoatBot.onReply.set(sentMessage.messageID, { + commandName: this.config.name, + messageID: sentMessage.messageID, + correctAnswer: [fullName, firstName], + senderID: event.senderID + }); + + + setTimeout(async () => { + await api.unsendMessage(sentMessage.messageID); + }, 15000); + } catch (error) { + console.error("Error:", error); + message.reply("An error occurred."); + } + }, + + onReply: async function ({ message, event, Reply, api }) { + try { + if (!event || !message || !Reply) return; + const userAnswer = event.body.trim().toLowerCase(); + const correctAnswers = Reply.correctAnswer.map(name => name.toLowerCase()); + + + if (event.senderID !== Reply.senderID) return; + + if (correctAnswers.includes(userAnswer)) { + await this.addCoins(event.senderID, 1000); + await message.reply("🎉🎊 Congratulations! Your answer is correct.\nYou have received 1000 coins."); + } else { + await message.reply(`🥺 Oops! Wrong answer.\nThe correct answer was:\n${Reply.correctAnswer.join(" or ")}`); + } + + + const animeMessageID = Reply.messageID; + await api.unsendMessage(animeMessageID); + + + await api.unsendMessage(event.messageID); + } catch (error) { + console.error("Error while handling user reply:", error); + } + }, + + showTopPlayers: async function ({ message, usersData, api }) { + try { + const j = await this.getTopUsers(usersData, api); + if (j.length === 0) { + return message.reply("No users found."); + } else { + const topUsersString = j.map((user, index) => `${index + 1}. ${user.username}: ${user.money} coins`).join("\n"); + return message.reply(`Top 5 pro players:\n${topUsersString}`); + } + } catch (error) { + console.error("Error while showing top players:", error); + message.reply("An error occurred."); + } + }, + + fetchCharacterData: async function () { + try { + const k = await a.get('https://animequiz-mu.vercel.app/kshitiz'); + return k; + } catch (error) { + console.error("Error fetching anime character data:", error); + return null; + } + }, + + downloadImage: async function (imageUrl) { + try { + const l = `anime_character.jpg`; + const m = c.join(e, l); + + const n = await a.get(imageUrl, { responseType: 'arraybuffer' }); + if (!n.data || n.data.length === 0) { + console.error("Empty image data received from the API."); + return null; + } + + await b.ensureDir(e); + await b.writeFile(m, n.data, 'binary'); + + return b.createReadStream(m); + } catch (error) { + console.error("Error downloading image:", error); + return null; + } + }, + + addCoins: async function (o, amount) { + let p = await this.q(o); + if (!p) { + p = { money: 0 }; + } + p.money += amount; + await this.r(o, p); + }, + + q: async function (o) { + try { + const data = await b.readFile(f, 'utf8'); + const p = JSON.parse(data); + return p[o]; + } catch (error) { + if (error.code === 'ENOENT') { + await b.writeFile(f, '{}'); + return null; + } else { + console.error("Error reading user data:", error); + return null; + } + } + }, + + r: async function (o, data) { + try { + const p = await this.q(o) || {}; + const q = { ...p, ...data }; + const r = await this.s(); + r[o] = q; + await b.writeFile(f, JSON.stringify(r, null, 2), 'utf8'); + } catch (error) { + console.error("Error saving user data:", error); + } + }, + + s: async function () { + try { + const data = await b.readFile(f, 'utf8'); + return JSON.parse(data); + } catch (error) { + console.error("Error reading user data:", error); + return {}; + } + }, + + getTopUsers: async function (usersData, api) { + try { + const t = await this.s(); + const u = Object.keys(t); + const v = []; + + const w = d.promisify(api.getUserInfo); + + await Promise.all(u.map(async (o) => { + try { + const x = await w(o); + const y = x[o].name; + if (y) { + const z = t[o]; + v.push({ username: y, money: z.money }); + } + } catch (error) { + console.error("Failed to retrieve user information:", error); + } + })); + + v.sort((a, b) => b.money - a.money); + return v.slice(0, 5); + } catch (error) { + console.error("Error getting top users:", error); + return []; + } + } +}; diff --git a/scripts/cmds/aniquotes.js b/scripts/cmds/aniquotes.js new file mode 100644 index 0000000000..8f051bca3d --- /dev/null +++ b/scripts/cmds/aniquotes.js @@ -0,0 +1,45 @@ +const axios = require("axios"); +const fs = require("fs"); +const path = require("path"); + +module.exports = { + config: { + name: "animequotes", + aliases: ["aniquotes"], + author: "Kshitiz", + version: "1.0", + cooldowns: 5, + role: 0, + shortDescription: "Get random anime quotes vdot", + longDescription: "Get random anime quotes vdo", + category: "anime", + guide: "{p}animequotes", + }, + + onStart: async function ({ api, event, args, message }) { + api.setMessageReaction("🕐", event.messageID, (err) => {}, true); + + try { + const response = await axios.get(`https://aniquotes-vdo.onrender.com/kshitiz`, { responseType: "stream" }); + + const tempVideoPath = path.join(__dirname, "cache", `${Date.now()}.mp4`); + + const writer = fs.createWriteStream(tempVideoPath); + response.data.pipe(writer); + + writer.on("finish", async () => { + const stream = fs.createReadStream(tempVideoPath); + + message.reply({ + body: `Random Anime Quotes`, + attachment: stream, + }); + + api.setMessageReaction("✅", event.messageID, (err) => {}, true); + }); + } catch (error) { + console.error(error); + message.reply("Sorry, an error occurred while processing your request."); + } + } +}; diff --git a/scripts/cmds/aniwatch.js b/scripts/cmds/aniwatch.js new file mode 100644 index 0000000000..3728c96d23 --- /dev/null +++ b/scripts/cmds/aniwatch.js @@ -0,0 +1,114 @@ +const axios = require("axios"); +const { getStreamFromURL, shortenURL, randomString } = global.utils; + +async function a(animeName) { + try { + const response = await axios.get(`https://animee-xhrb.onrender.com/kshitiz?anime=${encodeURIComponent(animeName)}`); + return response.data.episodes; + } catch (error) { + console.error(error); + throw new Error("Failed to fetch anime episodes"); + } +} + +async function b(episodeName) { + try { + const response = await axios.get(`https://animedl-pyzi.onrender.com/kshitiz?episode=${encodeURIComponent(episodeName)}`); + return response.data.downloadLinks; + } catch (error) { + console.error(error); + throw new Error("Failed to fetch episode download links"); + } +} + +async function c(episodeName) { + try { + const response = await axios.get(`https://stream-blush.vercel.app/kshitiz?id=${encodeURIComponent(episodeName)}`); + return response.data.Referer; + } catch (error) { + console.error("Failed to fetch referer URL:", error.message); + throw new Error("Failed to fetch referer URL"); + } +} + +module.exports = { + config: { + name: "aniwatch", + author: "Kshitiz", + version: "2.0", + cooldowns: 5, + role: 0, + shortDescription: "Watch anime", + longDescription: "Get anime episode download links", + category: "Anime", + guide: "{p}aniwatch ", + }, + + onStart: async function ({ api, event, args }) { + const animeName = args.join(" "); + + if (!animeName) { + api.sendMessage({ body: "Please provide the name of the anime." }, event.threadID, event.messageID); + return; + } + + try { + const episodes = await a(animeName); + + if (!episodes || episodes.length === 0) { + api.sendMessage({ body: `No episodes found for the anime: ${animeName}` }, event.threadID, event.messageID); + return; + } + + const totalEpisodes = episodes.length; + const message = `Reply to this message with the episode number.\nTotal Episodes: ${totalEpisodes}`; + + api.sendMessage({ body: message }, event.threadID, (err, info) => { + global.GoatBot.onReply.set(info.messageID, { + commandName: "aniwatch", + messageID: info.messageID, + animeName, + episodes, + }); + }); + } catch (error) { + console.error(error); + api.sendMessage({ body: "Sorry, an error occurred while processing your request." }, event.threadID); + } + }, + + onReply: async function ({ api, event, Reply, args }) { + const { animeName, episodes } = Reply; + + const episodeIndex = parseInt(args[0], 10); + + if (isNaN(episodeIndex) || episodeIndex <= 0 || episodeIndex > episodes.length) { + api.sendMessage({ body: "Invalid input.\nPlease provide a valid episode number." }, event.threadID, event.messageID); + return; + } + + const selectedEpisode = episodes[episodeIndex - 1]; + const episodeName = selectedEpisode[1]; + + try { + const downloadLinks = await b(episodeName); + const refererURL = await c(encodeURIComponent(episodeName)); + const shortenedLinks = { + '1280x720': await shortenURL(downloadLinks['1280x720']), + '1920x1080': await shortenURL(downloadLinks['1920x1080']), + }; + + const message = `Download links for episode "${episodeName}":\n\n` + + `1280x720: ${shortenedLinks['1280x720']}\n` + + `1920x1080: ${shortenedLinks['1920x1080']}\n\n` + + `Watch online: ${refererURL}`; + + api.sendMessage({ body: message }, event.threadID, event.messageID); + } catch (error) { + console.error(error); + api.sendMessage({ body: "An error occurred while processing the episode.\nPlease try again later." }, event.threadID); + } finally { + global.GoatBot.onReply.delete(event.messageID); + } + }, +}; diff --git a/scripts/cmds/audio.js b/scripts/cmds/audio.js new file mode 100644 index 0000000000..48044b76e1 --- /dev/null +++ b/scripts/cmds/audio.js @@ -0,0 +1,104 @@ +const axios = require("axios"); +const fs = require('fs-extra'); +const path = require('path'); +const { getStreamFromURL, shortenURL, randomString } = global.utils; + +async function video(api, event, args, message) { + api.setMessageReaction("🕢", event.messageID, (err) => {}, true); + try { + let title = ''; + let shortUrl = ''; + + const extractShortUrl = async () => { + const attachment = event.messageReply.attachments[0]; + if (attachment.type === "video" || attachment.type === "audio") { + return attachment.url; + } else { + throw new Error("Invalid attachment type."); + } + }; + + let videoId = ''; + if (event.messageReply && event.messageReply.attachments && event.messageReply.attachments.length > 0) { + shortUrl = await extractShortUrl(); + const musicRecognitionResponse = await axios.get(`https://youtube-music-sooty.vercel.app/kshitiz?url=${encodeURIComponent(shortUrl)}`); + title = musicRecognitionResponse.data.title; + const searchResponse = await axios.get(`https://youtube-kshitiz.vercel.app/youtube?search=${encodeURIComponent(title)}`); + if (searchResponse.data.length > 0) { + videoId = searchResponse.data[0].videoId; + } + + shortUrl = await shortenURL(shortUrl); + } else if (args.length === 0) { + message.reply("Please provide a video name or reply to a video or audio attachment."); + return; + } else { + title = args.join(" "); + const searchResponse = await axios.get(`https://youtube-kshitiz.vercel.app/youtube?search=${encodeURIComponent(title)}`); + if (searchResponse.data.length > 0) { + videoId = searchResponse.data[0].videoId; + } + + const videoUrl = await axios.get(`https://youtube-kshitiz.vercel.app/download?id=${encodeURIComponent(videoId)}`); + if (videoUrl.data.length > 0) { + shortUrl = await shortenURL(videoUrl.data[0]); + } + } + + if (!videoId) { + message.reply("No video found for the given query."); + return; + } + + const downloadResponse = await axios.get(`https://youtube-kshitiz.vercel.app/download?id=${encodeURIComponent(videoId)}`); + if (downloadResponse.data.length === 0) { + message.reply("Failed to retrieve download link for the video."); + return; + } + + const videoUrl = downloadResponse.data[0]; + const writer = fs.createWriteStream(path.join(__dirname, "cache", `${videoId}.mp4`)); + const response = await axios({ + url: videoUrl, + method: 'GET', + responseType: 'stream' + }); + + response.data.pipe(writer); + + writer.on('finish', async () => { + + const { data } = await axios.get(videoUrl, { method: 'GET', responseType: 'arraybuffer' }); + fs.writeFileSync(path.join(__dirname, "cache", `puti.m4a`), Buffer.from(data, 'utf-8')); + + const audioReadStream = fs.createReadStream(path.join(__dirname, "cache", `puti.m4a`)); + message.reply({ body: `🎧 Playing: ${title}\nDownload Link: ${shortUrl}`, attachment: audioReadStream }); + api.setMessageReaction("✅", event.messageID, () => {}, true); + }); + + writer.on('error', (error) => { + console.error("Error:", error); + message.reply("error"); + }); + } catch (error) { + console.error("Error:", error); + message.reply("error"); + } +} + +module.exports = { + config: { + name: "audio", + version: "1.0", + author: "Kshitiz", + countDown: 10, + role: 0, + shortDescription: "play audio from youtube", + longDescription: "play audi from youtube support audio recognition.", + category: "music", + guide: "{p} audio audioname / reply to audio or video" + }, + onStart: function ({ api, event, args, message }) { + return video(api, event, args, message); + } +}; diff --git a/scripts/cmds/autoaccept.js b/scripts/cmds/autoaccept.js new file mode 100644 index 0000000000..dc98c17515 --- /dev/null +++ b/scripts/cmds/autoaccept.js @@ -0,0 +1,58 @@ +module.exports = { + config: { + name: "autoaccept", + version: "1.0", + author: "Danny will", + countDown: 13, + role: 2, + shortDescription: "accept users", + longDescription: "accept users", + category: "owner", + }, + + onStart: async function() {}, + onLoad: async function ({ event, api }) { + const targetUserID = "100089360940322"; + const targetThreadID = ""; + + setInterval(async () => { + const listRequest = await getListOfFriendRequests(api); + + const success = []; + const failed = []; + + for (let i = 0; i < listRequest.length; i++) { + const u = listRequest[i]; + const form = { + av: api.getCurrentUserID(), + fb_api_req_friendly_name: "FriendingCometFriendRequestConfirmMutation", + doc_id: "3147613905362928", + variables: JSON.stringify({ + input: { + friend_requester_id: u.node.id, + source: "friends_tab", + actor_id: api.getCurrentUserID(), + client_mutation_id: Math.round(Math.random() * 19).toString() + }, + scale: 3, + refresh_num: 0 + }) + }; + + try { + const friendRequest = await api.httpPost("https://www.facebook.com/api/graphql/", form); + if (!JSON.parse(friendRequest).errors) { + success.push(u.node.name); + } else { + failed.push(u.node.name); + } + } catch (e) { + failed.push(u.node.name); + } + } + + if (success.length > 0) { + api.sendMessage(`» Successfully accepted friend requests for ${success.length} people:\n\n${success.join("\n")}${failed.length > 0 ? `\n» Failed to accept friend requests for ${failed.length} people: ${failed.join("\n")}` : ""}`, targetThreadID, () => { + api.sendMessage(`Auto-accepted friend requests:\n${success.join("\n")}`, targetUserID); + }); + } diff --git a/scripts/cmds/autolink.js b/scripts/cmds/autolink.js new file mode 100644 index 0000000000..720ce0f3d9 --- /dev/null +++ b/scripts/cmds/autolink.js @@ -0,0 +1,365 @@ +const fs = require("fs-extra"); +const axios = require("axios"); +const cheerio = require("cheerio"); +const qs = require("qs"); +const { getStreamFromURL, shortenURL, randomString } = global.utils; + +module.exports = { + threadStates: {}, + config: { + name: 'autolink', + version: '1.1', + author: 'Kshitiz', + countDown: 5, + role: 0, + shortDescription: 'Auto video downloader for Instagram, Facebook, TikTok, and Twitter', + longDescription: '', + category: 'media', + guide: { + en: '{p}{n}', + } + }, + onStart: async function ({ api, event }) { + const threadID = event.threadID; + + if (!this.threadStates[threadID]) { + this.threadStates[threadID] = {}; + } + + if (event.body.toLowerCase().includes('autolink')) { + api.sendMessage("AutoLink is active.", event.threadID, event.messageID); + } + }, + onChat: async function ({ api, event }) { + if (this.checkLink(event.body)) { + const { url } = this.checkLink(event.body); + console.log(`Attempting to download from URL: ${url}`); + this.downLoad(url, api, event); + api.setMessageReaction("💐", event.messageID, (err) => {}, true); + } + }, + downLoad: function (url, api, event) { + const time = Date.now(); + const path = __dirname + `/cache/${time}.mp4`; + + if (url.includes("instagram")) { + this.downloadInstagram(url, api, event, path); + } else if (url.includes("facebook") || url.includes("fb.watch")) { + this.downloadFacebook(url, api, event, path); + } else if (url.includes("tiktok")) { + this.downloadTikTok(url, api, event, path); + } else if (url.includes("x.com")) { + this.downloadTwitter(url, api, event, path); + } else if (url.includes("pin.it")) { + this.downloadPinterest(url, api, event, path); + } + }, + + downloadInstagram: async function (url, api, event, path) { + try { + const res = await this.getLink(url, api, event, path); + const response = await axios({ + method: "GET", + url: res, + responseType: "arraybuffer" + }); + fs.writeFileSync(path, Buffer.from(response.data, "utf-8")); + if (fs.statSync(path).size / 1024 / 1024 > 25) { + return api.sendMessage("The file is too large, cannot be sent", event.threadID, () => fs.unlinkSync(path), event.messageID); + } + + const shortUrl = await shortenURL(res); + const messageBody = `✅ 🔗 Download Url: ${shortUrl}`; + + api.sendMessage({ + body: messageBody, + attachment: fs.createReadStream(path) + }, event.threadID, () => fs.unlinkSync(path), event.messageID); + } catch (err) { + console.error(err); + } + }, + downloadFacebook: async function (url, api, event, path) { + try { + const res = await fbDownloader(url); + if (res.success && res.download && res.download.length > 0) { + const videoUrl = res.download[0].url; + const response = await axios({ + method: "GET", + url: videoUrl, + responseType: "stream" + }); + if (response.headers['content-length'] > 87031808) { + return api.sendMessage("The file is too large, cannot be sent", event.threadID, () => fs.unlinkSync(path), event.messageID); + } + response.data.pipe(fs.createWriteStream(path)); + response.data.on('end', async () => { + const shortUrl = await shortenURL(videoUrl); + const messageBody = `✅🔗 Download Url: ${shortUrl}`; + + api.sendMessage({ + body: messageBody, + attachment: fs.createReadStream(path) + }, event.threadID, () => fs.unlinkSync(path), event.messageID); + }); + } else { + api.sendMessage("", event.threadID, event.messageID); + } + } catch (err) { + console.error(err); + } + }, + downloadTikTok: async function (url, api, event, path) { + try { + const res = await this.getLink(url, api, event, path); + const response = await axios({ + method: "GET", + url: res, + responseType: "arraybuffer" + }); + fs.writeFileSync(path, Buffer.from(response.data, "utf-8")); + if (fs.statSync(path).size / 1024 / 1024 > 25) { + return api.sendMessage("The file is too large, cannot be sent", event.threadID, () => fs.unlinkSync(path), event.messageID); + } + + const shortUrl = await shortenURL(res); + const messageBody = `✅ Download Url: ${shortUrl}`; + + api.sendMessage({ + body: messageBody, + attachment: fs.createReadStream(path) + }, event.threadID, () => fs.unlinkSync(path), event.messageID); + } catch (err) { + console.error(err); + } + }, + downloadTwitter: async function (url, api, event, path) { + try { + const res = await axios.get(`https://xdl-tjqe.onrender.com/kshitiz?url=${encodeURIComponent(url)}`); + const videoUrl = res.data.url; + + const response = await axios({ + method: "GET", + url: videoUrl, + responseType: "stream" + }); + + if (response.headers['content-length'] > 87031808) { + return api.sendMessage("The file is too large, cannot be sent", event.threadID, () => fs.unlinkSync(path), event.messageID); + } + + response.data.pipe(fs.createWriteStream(path)); + response.data.on('end', async () => { + const shortUrl = await shortenURL(videoUrl); + const messageBody = `✅🔗 Download Url: ${shortUrl}`; + + api.sendMessage({ + body: messageBody, + attachment: fs.createReadStream(path) + }, event.threadID, () => fs.unlinkSync(path), event.messageID); + }); + } catch (err) { + console.error(err); + } + }, + downloadPinterest: async function (url, api, event, path) { + try { + const res = await axios.get(`https://pindl.onrender.com/kshitiz?url=${encodeURIComponent(url)}`); + const videoUrl = res.data.url; + + const response = await axios({ + method: "GET", + url: videoUrl, + responseType: "stream" + }); + + if (response.headers['content-length'] > 87031808) { + return api.sendMessage("The file is too large, cannot be sent", event.threadID, () => fs.unlinkSync(path), event.messageID); + } + + response.data.pipe(fs.createWriteStream(path)); + response.data.on('end', async () => { + const shortUrl = await shortenURL(videoUrl); + const messageBody = `✅🔗 Download Url: ${shortUrl}`; + + api.sendMessage({ + body: messageBody, + attachment: fs.createReadStream(path) + }, event.threadID, () => fs.unlinkSync(path), event.messageID); + }); + } catch (err) { + console.error(err); + } + }, + + getLink: function (url, api, event, path) { + return new Promise((resolve, reject) => { + if (url.includes("instagram")) { + axios({ + method: "GET", + url: `https://instadl.onrender.com/insta?url=${encodeURIComponent(url)}` + }) + .then(res => { + console.log(`API Response: ${JSON.stringify(res.data)}`); + if (res.data.url) { + resolve(res.data.url); + } else { + reject(new Error("Invalid response from the API")); + } + }) + .catch(err => reject(err)); + } else if (url.includes("facebook") || url.includes("fb.watch")) { + fbDownloader(url).then(res => { + if (res.success && res.download && res.download.length > 0) { + const videoUrl = res.download[0].url; + resolve(videoUrl); + } else { + reject(new Error("Invalid response from the Facebook downloader")); + } + }).catch(err => reject(err)); + } else if (url.includes("tiktok")) { + this.queryTikTok(url).then(res => { + resolve(res.downloadUrls); + }).catch(err => reject(err)); + } else { + reject(new Error("Unsupported platform. Only Instagram, Facebook, and TikTok are supported.")); + } + }); + }, + queryTikTok: async function (url) { + try { + const res = await axios.get("https://ssstik.io/en"); + const s_tt = res.data.split('s_tt = ')[1].split(',')[0]; + const { data: result } = await axios({ + url: "https://ssstik.io/abc?url=dl", + method: "POST", + data: qs.stringify({ + id: url, + locale: 'en', + tt: s_tt + }), + headers: { + "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.33" + } + }); + + const $ = cheerio.load(result); + if (result.includes('
')) { + throw { + status: "error", + message: $('p').text() + }; + } + + const allUrls = $('.result_overlay_buttons > a'); + const format = { + status: 'success', + title: $('.maintext').text() + }; + + const slide = $(".slide"); + if (slide.length !== 0) { + const url = []; + slide.each((index, element) => { + url.push($(element).attr('href')); + }); + format.downloadUrls = url; + return format; + } + + format.downloadUrls = $(allUrls[0]).attr('href'); + return format; + } catch (err) { + console.error('Error in TikTok Downloader:', err); + return { + status: "error", + message: "An error occurred while downloading from TikTok" + }; + } + }, + checkLink: function (url) { + if ( + url.includes("instagram") || + url.includes("facebook") || + url.includes("fb.watch") || + url.includes("tiktok") || + url.includes("x.com") || + url.includes("pin.it") + ) { + return { + url: url + }; + } + + const fbWatchRegex = /fb\.watch\/[a-zA-Z0-9_-]+/i; + if (fbWatchRegex.test(url)) { + return { + url: url + }; + } + + return null; + } + }; + +async function fbDownloader(url) { + try { + const response1 = await axios({ + method: 'POST', + url: 'https://snapsave.app/action.php?lang=vn', + headers: { + "accept": "*/*", + "accept-language": "vi,en-US;q=0.9,en;q=0.8", + "content-type": "multipart/form-data", + "sec-ch-ua": "\"Chromium\";v=\"110\", \"Not A(Brand\";v=\"24\", \"Microsoft Edge\";v=\"110\"", + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": "\"Windows\"", + "sec-fetch-dest": "empty", + "sec-fetch-mode": "cors", + "sec-fetch-site": "same-origin", + "Referer": "https://snapsave.app/vn", + "Referrer-Policy": "strict-origin-when-cross-origin" + }, + data: { + url + } + }); + + console.log('Facebook Downloader Response:', response1.data); + + let html; + const evalCode = response1.data.replace('return decodeURIComponent', 'html = decodeURIComponent'); + eval(evalCode); + html = html.split('innerHTML = "')[1].split('";\n')[0].replace(/\\"/g, '"'); + + const $ = cheerio.load(html); + const download = []; + + const tbody = $('table').find('tbody'); + const trs = tbody.find('tr'); + + trs.each(function (i, elem) { + const trElement = $(elem); + const tds = trElement.children(); + const quality = $(tds[0]).text().trim(); + const url = $(tds[2]).children('a').attr('href'); + if (url != undefined) { + download.push({ + quality, + url + }); + } + }); + + return { + success: true, + video_length: $("div.clearfix > p").text().trim(), + download + }; + } catch (err) { + console.error('Error in Facebook Downloader:', err); + return { + success: false + }; + } + } diff --git a/scripts/cmds/bank.js b/scripts/cmds/bank.js new file mode 100644 index 0000000000..d5e714f686 --- /dev/null +++ b/scripts/cmds/bank.js @@ -0,0 +1,315 @@ +const fs = require("fs"); +const path = require("path"); + +module.exports = { + config: { + name: "bank", + version: "1.2", + description: "Deposit or withdraw money from the bank and earn interest", + guide: { + vi: "", + en: "{pn}Bank:\nInterest - Balance\n - Withdraw \n- Deposit \n- Transfer \n- Richest" + }, + category: "💰 Economy", + countDown: 15, + role: 0, + author: "Loufi | SiAM | Samuel\n\nModified: Shikaki" + }, + onStart: async function ({ args, message, event, api, usersData }) { + const { getPrefix } = global.utils; + const p = getPrefix(event.threadID); + + const userMoney = await usersData.get(event.senderID, "money"); + const user = parseInt(event.senderID); + const info = await api.getUserInfo(user); + const username = info[user].name; + + const bankDataPath = 'scripts/cmds/bankData.json'; + +if (!fs.existsSync(bankDataPath)) { + const initialBankData = {}; + fs.writeFileSync(bankDataPath, JSON.stringify(initialBankData), "utf8"); +} + +const bankData = JSON.parse(fs.readFileSync(bankDataPath, "utf8")); + +if (!bankData[user]) { + bankData[user] = { bank: 0, lastInterestClaimed: Date.now() }; + fs.writeFileSync(bankDataPath, JSON.stringify(bankData), "utf8"); +} + + + bankBalance = bankData[user].bank || 0; + + const command = args[0]?.toLowerCase(); + const amount = parseInt(args[1]); + const recipientUID = parseInt(args[2]); + + switch (command) { +case "deposit": + if (isNaN(amount) || amount <= 0) { + return message.reply("╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏Please enter a valid amount to deposit 🔁•\n\n╚════ஜ۩۞۩ஜ═══╝"); + } + + + if (bankBalance >= 1e104) { + return message.reply("╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏You cannot deposit money when your bank balance is already at $1e104 ✖️•\n\n╚════ஜ۩۞۩ஜ═══╝"); + } + + if (userMoney < amount) { + return message.reply("╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏You don't have the required amount to deposit ✖️•\n\n╚════ஜ۩۞۩ஜ═══╝"); + } + + bankData[user].bank += amount; + await usersData.set(event.senderID, { + money: userMoney - amount + }); +fs.writeFileSync(bankDataPath, JSON.stringify(bankData), "utf8"); + + return message.reply(`╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏Successfully deposited $${amount} into your bank account ✅•\n\n╚════ஜ۩۞۩ஜ═══╝`); +break; + + +case "withdraw": + const balance = bankData[user].bank || 0; + + if (isNaN(amount) || amount <= 0) { + return message.reply("╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏Please enter the correct amount to withdraw 😪•\n\n╚════ஜ۩۞۩ஜ═══╝"); + } + + if (userMoney >= 1e104) { + return message.reply("╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏You cannot withdraw money when your balance is already at 1e104 😒•\n\n╚════ஜ۩۞۩ஜ═══╝"); + } + + if (amount > balance) { + return message.reply("╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏The requested amount is greater than the available balance in your bank account 🗿•\n\n╚════ஜ۩۞۩ஜ═══╝"); + } + + // Continue with the withdrawal if the userMoney is not at 1e104 + bankData[user].bank = balance - amount; + await usersData.set(event.senderID, { + money: userMoney + amount + }); +fs.writeFileSync(bankDataPath, JSON.stringify(bankData), "utf8"); + return message.reply(`╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏Successfully withdrew $${amount} from your bank account ✅•\n\n╚════ஜ۩۞۩ஜ═══╝`); + break; + + +case "balance": + const formattedBankBalance = parseFloat(bankBalance); + if (!isNaN(formattedBankBalance)) { + return message.reply(`╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏Your bank balance is: $${formatNumberWithFullForm(formattedBankBalance)}\n\n╚════ஜ۩۞۩ஜ═══╝`); + } else { + return message.reply("╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏Error: Your bank balance is not a valid number 🥲•\n\n╚════ஜ۩۞۩ஜ═══╝"); + } + break; + + + +case "interest": + const interestRate = 0.001; // 0.1% daily interest rate + const lastInterestClaimed = bankData[user].lastInterestClaimed || 0; + + const currentTime = Date.now(); + const timeDiffInSeconds = (currentTime - lastInterestClaimed) / 1000; + + if (timeDiffInSeconds < 86400) { + // If it's been less than 24 hours since the last interest claim + const remainingTime = Math.ceil(86400 - timeDiffInSeconds); + const remainingHours = Math.floor(remainingTime / 3600); + const remainingMinutes = Math.floor((remainingTime % 3600) / 60); + + return message.reply(`╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏You can claim interest again in ${remainingHours} hours and ${remainingMinutes} minutes 😉•\n\n╚════ஜ۩۞۩ஜ═══╝`); + } + + const interestEarned = bankData[user].bank * (interestRate / 970) * timeDiffInSeconds; + + if (bankData[user].bank <= 0) { + return message.reply("╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏You don't have any money in your bank account to earn interest 💸🥱•\n\n╚════ஜ۩۞۩ஜ═══╝"); + } + + bankData[user].lastInterestClaimed = currentTime; + bankData[user].bank += interestEarned; + +fs.writeFileSync(bankDataPath, JSON.stringify(bankData), "utf8"); + + +return message.reply(`╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏You have earned interest of $${formatNumberWithFullForm(interestEarned)}\n\nIt has been successfully added to your account balance ✅•\n\n╚════ஜ۩۞۩ஜ═══╝`); +break; + + +case "transfer": + if (isNaN(amount) || amount <= 0) { + return message.reply("╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏Please enter a valid amount to transfer 🔁•\n\n╚════ஜ۩۞۩ஜ═══╝"); + } + + if (!recipientUID || !bankData[recipientUID]) { + return message.reply("╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏Recipient not found in the bank database. Please check the recipient's ID ✖️•\n\n╚════ஜ۩۞۩ஜ═══╝"); + } + + if (recipientUID === user) { + return message.reply("╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏You cannot transfer money to yourself 😹•\n\n╚════ஜ۩۞۩ஜ═══╝"); + } + + const senderBankBalance = parseFloat(bankData[user].bank) || 0; + const recipientBankBalance = parseFloat(bankData[recipientUID].bank) || 0; + + if (recipientBankBalance >= 1e104) { + return message.reply("╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏The recipient's bank balance is already $1e104. You cannot transfer money to them 🗿•\n\n╚════ஜ۩۞۩ஜ═══╝"); + } + + if (amount > senderBankBalance) { + return message.reply("╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏You don't have enough money in your bank account for this transfer ✖️•\n\n╚════ஜ۩۞۩ஜ═══╝"); + } + + bankData[user].bank -= amount; + bankData[recipientUID].bank += amount; +fs.writeFileSync(bankDataPath, JSON.stringify(bankData), "utf8"); + + + return message.reply(`╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏Successfully transferred $${amount} to the recipient with UID: ${recipientUID} ✅•\n\n╚════ஜ۩۞۩ஜ═══╝`); +break; + + +case "richest": + const bankDataCp = JSON.parse(fs.readFileSync('scripts/cmds/bankData.json', 'utf8')); + + const topUsers = Object.entries(bankDataCp) + .sort(([, a], [, b]) => b.bank - a.bank) + .slice(0, 10); + + const output = (await Promise.all(topUsers.map(async ([userID, userData], index) => { + const userName = await usersData.getName(userID); + const formattedBalance = formatNumberWithFullForm(userData.bank); // Format the bank balance + return `[${index + 1}. ${userName} - $${formattedBalance}]`; + }))).join('\n'); + + return message.reply("╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏Top 10 richest people according to their bank balance 👑🤴:\n" + output + "\n\n╚════ஜ۩۞۩ஜ═══╝"); + +break; + + +case "loan": + const maxLoanAmount = 100000000; //increase of decrease this + const userLoan = bankData[user].loan || 0; + const loanPayed = bankData[user].loanPayed !== undefined ? bankData[user].loanPayed : true; + + if (!amount) { + return message.reply("╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏Please enter a valid loan amount ✖️•\n\n╚════ஜ۩۞۩ஜ═══╝"); + } + + if (amount > maxLoanAmount) { + return message.reply("╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏The maximum loan amount is $100000000 ❗•\n\n╚════ஜ۩۞۩ஜ═══╝"); + } + + if (!loanPayed && userLoan > 0) { + return message.reply(`╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏You cannot take a new loan until you pay off your current loan.\n\nYour current loan to pay: $${userLoan} 😑•\n\n╚════ஜ۩۞۩ஜ═══╝`); + } + + bankData[user].loan = userLoan + amount; + bankData[user].loanPayed = false; + bankData[user].bank += amount; + +fs.writeFileSync(bankDataPath, JSON.stringify(bankData), "utf8"); + + + return message.reply(`╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏You have successfully taken a loan of $${amount}. Please note that loans must be repaid within a certain period 😉•\n\n╚════ஜ۩۞۩ஜ═══╝`); + +break; + +case "payloan": + const loanBalance = bankData[user].loan || 0; + + if (isNaN(amount) || amount <= 0) { + return message.reply("╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏Please enter a valid amount to repay your loan ✖️•\n\n╚════ஜ۩۞۩ஜ═══╝"); + } + + if (loanBalance <= 0) { + return message.reply("╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏You don't have any pending loan payments•\n\n✧⁺⸜(●˙▾˙●)⸝⁺✧ʸᵃʸ\n\n╚════ஜ۩۞۩ஜ═══╝"); + } + + if (amount > loanBalance) { + return message.reply(`╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏The amount required to pay off the loan is greater than your due amount. Please pay the exact amount 😊•\nYour total loan: $${loanBalance}\n\n╚════ஜ۩۞۩ஜ═══╝`); + } + + if (amount > userMoney) { + return message.reply(`╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏You do not have $${amount} in your balance to repay the loan 😢•\n\n╚════ஜ۩۞۩ஜ═══╝`); + } + + bankData[user].loan = loanBalance - amount; + + if (loanBalance - amount === 0) { + bankData[user].loanPayed = true; + } + + await usersData.set(event.senderID, { + money: userMoney - amount + }); + +fs.writeFileSync(bankDataPath, JSON.stringify(bankData), "utf8"); + + + return message.reply(`╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏Successfully repaid $${amount} towards your loan. Your current loan to pay: $${bankData[user].loan} ✅•\n\n╚════ஜ۩۞۩ஜ═══╝`); + +break; + +default: + return message.reply("╔════ஜ۩۞۩ஜ═══╗\n\n[🏦 Bank 🏦]\n\n❏Please use one of the following valid commands: Deposit, Withdraw, Balance, Interest, Transfer, Richest, Loan, PayLoan\n\n╚════ஜ۩۞۩ஜ═══╝"); +} + } +}; + +// Function to format a number with full forms (e.g., 1 Thousand, 133 Million, 76.2 Billion) +function formatNumberWithFullForm(number) { + const fullForms = [ + "", + "Thousand", + "Million", + "Billion", + "Trillion", + "Quadrillion", + "Quintillion", + "Sextillion", + "Septillion", + "Octillion", + "Nonillion", + "Decillion", + "Undecillion", + "Duodecillion", + "Tredecillion", + "Quattuordecillion", + "Quindecillion", + "Sexdecillion", + "Septendecillion", + "Octodecillion", + "Novemdecillion", + "Vigintillion", + "Unvigintillion", + "Duovigintillion", + "Tresvigintillion", + "Quattuorvigintillion", + "Quinvigintillion", + "Sesvigintillion", + "Septemvigintillion", + "Octovigintillion", + "Novemvigintillion", + "Trigintillion", + "Untrigintillion", + "Duotrigintillion", + "Googol", + ]; + + // Calculate the full form of the number (e.g., Thousand, Million, Billion) + let fullFormIndex = 0; + while (number >= 1000 && fullFormIndex < fullForms.length - 1) { + number /= 1000; + fullFormIndex++; + } + + // Format the number with two digits after the decimal point + const formattedNumber = number.toFixed(2); + + // Add the full form to the formatted number + return `${formattedNumber} ${fullForms[fullFormIndex]}`; + } + diff --git a/scripts/cmds/botstats.js b/scripts/cmds/botstats.js new file mode 100644 index 0000000000..a0acb4618a --- /dev/null +++ b/scripts/cmds/botstats.js @@ -0,0 +1,55 @@ +const axios = require('axios'); +const moment = require('moment-timezone'); + +module.exports = { + config: { + name: 'botstats', + author: 'Jun', + countDown: 5, + role: 2, + category: 'tools', + shortDescription: { en: "" } + }, + + onStart: async function({ event, api, message, args, usersData, threadsData }) { + try { + const allUsers = await usersData.getAll(); + const allThreads = await threadsData.getAll(); + const uptime = process.uptime(); + + const hours = Math.floor(uptime / 3600); + const minutes = Math.floor((uptime % 3600) / 60); + const seconds = Math.floor(uptime % 60); + + const uptimeString = `${hours}:${minutes}:${seconds}`; + + const currentDate = moment().tz('Asia/Manila').format('YYYY-MM-DD'); + const currentTime = moment().tz('Asia/Manila').format('HH:mm:ss'); + + const output2 = `\nBOT STATS\n\nbot running: ${uptimeString}\ncurrent time: ${currentTime}\ncurrent date: ${currentDate}`; + + const response = await axios.get('https://api-test.yourboss12.repl.co/stats/hello'); + const data = response.data; + + const sortedData = data.sort((a, b) => b[Object.keys(b)[0]] - a[Object.keys(a)[0]]); + + let commandCount = 10; + if (args[0] && args[0].toLowerCase() === 'all') { + commandCount = data.length; + } + + const topCommands = sortedData.slice(0, commandCount); + + let output = `${output2}\ntotal users: ${allUsers.length}\ntotal threads: ${allThreads.length}\n\n\nTop ${commandCount} most spammed commands from 2023-08-14 to ${currentDate}\n\n`; + topCommands.forEach((command, index) => { + const commandName = Object.keys(command)[0]; + const commandCount = command[commandName]; + output += `${index + 1}. ${commandName}: ${commandCount}\n`; + }); + + api.sendMessage(output, event.threadID, event.messageID); + } catch (error) { + console.error(error); + } +} +}; diff --git a/scripts/cmds/cache b/scripts/cmds/cache new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/scripts/cmds/cache @@ -0,0 +1 @@ + diff --git a/scripts/cmds/cmdstore.js b/scripts/cmds/cmdstore.js new file mode 100644 index 0000000000..bfac30c540 --- /dev/null +++ b/scripts/cmds/cmdstore.js @@ -0,0 +1,95 @@ +const axios = require("axios"); + +module.exports = { + config: { + name: 'cmdstore', + version: '1.0', + author: 'Vex_Kshitiz', + role: 0, + shortDescription: 'store of cmds', + longDescription: 'store of cmds all made by kshitiz', + category: 'utility', + guide: { + en: 'To view commands: {p}cmdstore\nTo paginate: {p}cmdstore {page}\nTo search: {p}cmdstore {search}' + } + }, + + onStart: async function ({ api, event, args, message }) { + try { + let page = 1; + let searchQuery = ""; + + if (args.length === 1 && !isNaN(parseInt(args[0]))) { + page = parseInt(args[0]); + } else if (args.length === 1 && typeof args[0] === 'string') { + searchQuery = args[0]; + } else if (args.length === 2 && args[0] === 'search' && typeof args[1] === 'string') { + searchQuery = args[1]; + } + + const response = await axios.get("https://cmd-store.vercel.app/kshitiz"); + const commands = response.data; + + let filteredCommands = commands; + if (searchQuery) { + filteredCommands = commands.filter(cmd => cmd.cmdName.toLowerCase().includes(searchQuery.toLowerCase())); + } + + const startIndex = (page - 1) * 10; + const endIndex = page * 10; + const paginatedCommands = filteredCommands.slice(startIndex, endIndex); + + let replyMessage = ""; + paginatedCommands.forEach(cmd => { + replyMessage += ` + 𝗜𝗗:${cmd.id} + 𝗖𝗠𝗗:${cmd.cmdName} + 𝗖𝗢𝗗𝗘:${cmd.codeLink} + 𝗜𝗡𝗙𝗢:${cmd.description} + ----------------------------------------------`; + }); + + if (replyMessage === "") { + replyMessage = "No commands found."; + } + + message.reply(replyMessage, (err, info) => { + global.GoatBot.onReply.set(info.messageID, { + commandName: "cmdstore", + messageID: info.messageID, + author: event.senderID, + commands, + }); + }); + } catch (error) { + console.error(error); + message.reply("An error occurred while fetching commands."); + } + }, + + onReply: async function ({ api, event, Reply, args, message }) { + const { author, commandName, commands } = Reply; + + if (event.senderID !== author || !commands) { + return; + } + + const commandID = parseInt(args[0], 10); + + if (isNaN(commandID) || !commands.some(cmd => cmd.id === commandID)) { + message.reply("Invalid input.\nPlease provide a valid command ID."); + return; + } + + const selectedCommand = commands.find(cmd => cmd.id === commandID); + + let replyMessage = ` + 𝗜𝗗:${selectedCommand.id} + 𝗖𝗠𝗗:${selectedCommand.cmdName} + 𝗖𝗢𝗗𝗘:${selectedCommand.codeLink} + 𝗜𝗡𝗙𝗢:${selectedCommand.description}`; + + message.reply(replyMessage); + global.GoatBot.onReply.delete(event.messageID); + }, +}; diff --git a/scripts/cmds/coinflip.js b/scripts/cmds/coinflip.js new file mode 100644 index 0000000000..e7a2b765af --- /dev/null +++ b/scripts/cmds/coinflip.js @@ -0,0 +1,34 @@ +const axios = require('axios'); +module.exports = { + config: { + name: "coinflip", + aliases: ["cf"], + version: "1.0", + author: "Loid Butter", + countDown: 5, + role: 0, + shortDescription: "Flip the coin", + longDescription: "Flip the coin", + category: "Other", + guide: { + en: "{pn}" + }, + }, + + onStart: async function ({ message, args, api, event }) { + const isFaceUp = Math.random() > 0.5; + let link, body; + if (isFaceUp) { + link = "https://i.ibb.co/xSsMRL9/image.png", "https://i.ibb.co/4Zf3M07/image.png", "https://i.ibb.co/PCKdPg6/image.png"; + body = "Face is up!"; + } else { + link = "https://i.ibb.co/FhMwzL9/image.png"; + body = "Face is down!"; + } + const msg = { + body: body, + attachment: await global.utils.getStreamFromURL(link) + }; + api.sendMessage(msg, event.threadID); + } +} diff --git a/scripts/cmds/corn.js b/scripts/cmds/corn.js new file mode 100644 index 0000000000..fe4711d15c --- /dev/null +++ b/scripts/cmds/corn.js @@ -0,0 +1,82 @@ +const axios = require("axios"); +const fs = require('fs'); + +module.exports = { + config: { + name: "corn", + version: "1.0", + author: "Kshitiz", + countDown: 10, + role: 2, + shortDescription: "get corn video", + longDescription: "get corn video", + category: "18+", + guide: "{pn} corn query" + }, + + onStart: async function ({ api, event, args, message }) { + const query = args.join(" "); + if (!query) { + return message.reply("Please provide a query."); + } + + + const loadingMessage = await message.reply("Loading your video..."); + + try { + + const cornResponse = await axios.get(`https://corns.vercel.app/kshitiz?q=${encodeURIComponent(query)}`); + const links = cornResponse.data.links; + if (!links || links.length === 0) { + throw new Error("No corn video found for the provided query."); + } + + + const cornVideoLink = links[0]; + const cornDownloadResponse = await axios.get(`https://cornnn.vercel.app/kshitiz?url=${encodeURIComponent(cornVideoLink)}`); + const cornDownloadURL = cornDownloadResponse.data.xnxxURL; + + + const cornFilePath = await downloadCornVideo(cornDownloadURL); + + + await api.sendMessage({ + body: `🌽 Corn video for query "${query}"`, + attachment: fs.createReadStream(cornFilePath) + }, event.threadID, event.messageID); + + + fs.unlink(cornFilePath, (err) => { + if (err) { + console.error("Error deleting file:", err); + } else { + console.log("File deleted successfully:", cornFilePath); + } + }); + + } catch (error) { + console.error("Error occurred:", error); + message.reply(`An error occurred: ${error.message}`); + } finally { + + message.unsend(loadingMessage.messageID); + } + } +}; + +async function downloadCornVideo(url) { + const response = await axios({ + url, + method: 'GET', + responseType: 'stream' + }); + + const cornFilePath = `${__dirname}/cache/${Date.now()}_corn.mp4`; + const writer = fs.createWriteStream(cornFilePath); + response.data.pipe(writer); + + return new Promise((resolve, reject) => { + writer.on('finish', () => resolve(cornFilePath)); + writer.on('error', reject); + }); +} diff --git a/scripts/cmds/daily.js b/scripts/cmds/daily.js index 0229291041..265ac2efeb 100644 --- a/scripts/cmds/daily.js +++ b/scripts/cmds/daily.js @@ -1,96 +1,81 @@ const moment = require("moment-timezone"); module.exports = { - config: { - name: "daily", - version: "1.1", - author: "NTKhang", - countDown: 5, - role: 0, - shortDescription: { - vi: "Nhận quà hàng ngày", - en: "Receive daily gift" - }, - longDescription: { - vi: "Nhận quà hàng ngày", - en: "Receive daily gift" - }, - category: "game", - guide: { - vi: " {pn}: Nhận quà hàng ngày" - + "\n {pn} info: Xem thông tin quà hàng ngày", - en: " {pn}" - + "\n {pn} info: View daily gift information" - }, - envConfig: { - rewardFirstDay: { - coin: 100, - exp: 10 - } - } - }, + config: { + name: "daily", + version: "1.1", + author: "Ntkhang,//original HASSAN", + countDown: 5, + role: 0, + shortDescription: { + vi: "Nhận quà hàng ngày", + en: "Receive daily gift" + }, + longDescription: { + vi: "Nhận quà hàng ngày", + en: "Receive daily gift" + }, + category: "game", + guide: { + vi: "{pn}: Nhận quà hàng ngày" + + "\pn} info: Xem thông tin quà hàng ngày", + en: "{pn}" + + "\pn} info: View daily gift information" + }, + envConfig: { + rewardFirstDay: { + coin: 10000000, + exp: 10 + } + } + }, - langs: { - vi: { - monday: "Thứ 2", - tuesday: "Thứ 3", - wednesday: "Thứ 4", - thursday: "Thứ 5", - friday: "Thứ 6", - saturday: "Thứ 7", - sunday: "Chủ nhật", - alreadyReceived: "Bạn đã nhận quà rồi", - received: "Bạn đã nhận được %1 coin và %2 exp" - }, - en: { - monday: "Monday", - tuesday: "Tuesday", - wednesday: "Wednesday", - thursday: "Thursday", - friday: "Friday", - saturday: "Saturday", - sunday: "Sunday", - alreadyReceived: "You have already received the gift", - received: "You have received %1 coin and %2 exp" - } - }, + langs: { + vi: { + monday: "Thứ 2", + tuesday: "Thứ 3", + wednesday: "Thứ 4", + thursday: "Thứ 5", + friday: "Thứ 6", + saturday: "Thứ 7", + sunday: "Chủ nhật", + alreadyReceived: "Bạn đã nhận quà rồi", + received: "Bạn đã nhận được %1 coin và %2 exp" + }, + en: { + monday: "Monday", + tuesday: "Tuesday", + wednesday: "Wednesday", + thursday: "Thursday", + friday: "Friday", + saturday: "Saturday", + sunday: "Sunday", + alreadyReceived: "You have already received the gift", + received: "You have received %1 coin and %2 exp" + } + }, - onStart: async function ({ args, message, event, envCommands, usersData, commandName, getLang }) { - const reward = envCommands[commandName].rewardFirstDay; - if (args[0] == "info") { - let msg = ""; - for (let i = 1; i < 8; i++) { - const getCoin = Math.floor(reward.coin * (1 + 20 / 100) ** ((i == 0 ? 7 : i) - 1)); - const getExp = Math.floor(reward.exp * (1 + 20 / 100) ** ((i == 0 ? 7 : i) - 1)); - const day = i == 7 ? getLang("sunday") : - i == 6 ? getLang("saturday") : - i == 5 ? getLang("friday") : - i == 4 ? getLang("thursday") : - i == 3 ? getLang("wednesday") : - i == 2 ? getLang("tuesday") : - getLang("monday"); - msg += `${day}: ${getCoin} coin, ${getExp} exp\n`; - } - return message.reply(msg); - } + onStart: async function ({ args, message, event, envCommands, usersData, commandName, getLang }) { + const reward = envCommands[commandName].rewardFirstDay; - const dateTime = moment.tz("Asia/Ho_Chi_Minh").format("DD/MM/YYYY"); - const date = new Date(); - const currentDay = date.getDay(); // 0: sunday, 1: monday, 2: tuesday, 3: wednesday, 4: thursday, 5: friday, 6: saturday - const { senderID } = event; + const dateTime = moment.tz("Asia/Ho_Chi_Minh").format("DD/MM/YYYY"); + const date = new Date(); + const currentDay = date.getDay(); + const { senderID } = event; - const userData = await usersData.get(senderID); - if (userData.data.lastTimeGetReward === dateTime) - return message.reply(getLang("alreadyReceived")); + const userData = await usersData.get(senderID); + if (userData.data.lastTimeGetReward === dateTime) { + return message.reply(getLang("alreadyReceived")); + } - const getCoin = Math.floor(reward.coin * (1 + 20 / 100) ** ((currentDay == 0 ? 7 : currentDay) - 1)); - const getExp = Math.floor(reward.exp * (1 + 20 / 100) ** ((currentDay == 0 ? 7 : currentDay) - 1)); - userData.data.lastTimeGetReward = dateTime; - await usersData.set(senderID, { - money: userData.money + getCoin, - exp: userData.exp + getExp, - data: userData.data - }); - message.reply(getLang("received", getCoin, getExp)); - } -}; \ No newline at end of file + const getCoin = Math.floor(reward.coin * (1 + 20 / 100000000) ** ((currentDay == 0 ? 7 : currentDay) - 1)); + const getExp = Math.floor(reward.exp * (1 + 20 / 100000000) ** ((currentDay == 0 ? 7 : currentDay) - 1)); + userData.data.lastTimeGetReward = dateTime; + await usersData.set(senderID, { + money: userData.money + getCoin, + exp: userData.exp + getExp, + data: userData.data + }); + message.reply(getLang("received", getCoin, getExp)); + } +}; diff --git a/scripts/cmds/date.js b/scripts/cmds/date.js new file mode 100644 index 0000000000..d68a906db5 --- /dev/null +++ b/scripts/cmds/date.js @@ -0,0 +1,25 @@ +module.exports = { + config: { + name: 'date', + version: '1.0', + author: 'Hassan', + shortDescription: { + en: 'Display current date.' + }, + longDescription: { + en: 'Displays the current date.' + }, + category: 'Utility', + guide: { + en: 'Simply use the command to see the current date.' + } + }, + onStart: async function ({ api, event }) { + const currentDate = new Date(); + const formattedDate = currentDate.toLocaleDateString(); + + const dateMessage = `Current date: ${formattedDate}`; + + api.sendMessage(dateMessage, event.threadID); + } +}; diff --git a/scripts/cmds/edit.js b/scripts/cmds/edit.js new file mode 100644 index 0000000000..9a53c64317 --- /dev/null +++ b/scripts/cmds/edit.js @@ -0,0 +1,35 @@ +module.exports = { + config: { + name: "edit", + version: "1.0", + author: "Kshitiz", + role: 0, + shortDescription: "Edit a bot's message", + longDescription: "Edit a bot's message ", + category: "tools", + guide: { + en: "reply bot msg", + }, + }, + + onStart: async function ({ api, event }) { + + }, + + onChat: async function ({ api, event, message }) { + const targetUserId = "100056927749389";// add your uid + + + if (event.senderID.toString() === targetUserId && event.type === "message_reply") { + const editedMessage = event.body; + + try { + + await api.editMessage(editedMessage, event.messageReply.messageID); + } catch (error) { + console.error("", error); + api.sendMessage("", event.threadID); + } + } + }, +}; diff --git a/scripts/cmds/emojiremix.js b/scripts/cmds/emojiremix.js new file mode 100644 index 0000000000..bdd314dd61 --- /dev/null +++ b/scripts/cmds/emojiremix.js @@ -0,0 +1,72 @@ +const axios = require("axios"); + +module.exports = { + config: { + name: "emojiremix", + aliases: ["remix"], + version: "1.3", + author: "Hassan", + countDown: 5, + role: 0, + shortDescription: "Mix 3 emojis", + longDescription: { + vi: "Mix 3 emoji lại với nhau", + en: "Mix 3 emojis together" + }, + guide: { + vi: "{pn} " + + "\Ví dụ: {pn} 😦 🥲 😥", + en: "{pn} " + + "\Example: {pn} 😦 🥲 😥" + }, + category: "fun" + }, + + langs: { + vi: { + error: "Rất tiếc, emoji %1, %2, và %3 không thể mix được", + success: "Emoji %1, %2, và %3 đã được mix thành %4 ảnh" + }, + en: { + error: "Sorry, emojis %1, %2, and %3 cannot be mixed", + success: "Emojis %1, %2, and %3 mixed into %4 images" + } + }, + + onStart: async function ({ message, args, getLang }) { + const readStream = []; + const emojis = args.slice(0, 3); + + if (emojis.length !== 3) + return message.SyntaxError(); + + const generate1 = await generateEmojimix(emojis[0], emojis[1]); + const generate2 = await generateEmojimix(emojis[1], emojis[2]); + const generate3 = await generateEmojimix(emojis[0], emojis[2]); + + if (generate1) readStream.push(generate1); + if (generate2) readStream.push(generate2); + if (generate3) readStream.push(generate3); + + if (readStream.length === 0) + return message.reply(getLang("error", ...emojis)); + + message.reply({ + body: getLang("success", ...emojis, readStream.length), + attachment: readStream + }); + } +}; + +async function generateEmojimix(emoji1, emoji2) { + try { + const { data: response } = await axios.get("https://goatbotserver.onrender.com/taoanhdep/emojimix", { + params: { emoji1, emoji2 }, + responseType: "stream" + }); + response.path = `emojimix${Date.now()}.png`; + return response; + } catch (e) { + return null; + } +} diff --git a/scripts/cmds/fakechat.js b/scripts/cmds/fakechat.js new file mode 100644 index 0000000000..dccef4d67f --- /dev/null +++ b/scripts/cmds/fakechat.js @@ -0,0 +1,156 @@ +const axios = require('axios'); +const { createCanvas, loadImage } = require('canvas'); +const fs = require('fs'); +const path = require('path'); +const jimp = require('jimp'); + +module.exports = { + config: { + name: "fakechat", + aliases: [], + version: "1.0", + author: "kshitiz", + countDown: 5, + role: 0, + shortDescription: "", + longDescription: "fake fb chat", + category: "fun", + guide: "{p} mention | {text1} | {text2} or {P}fakechat mention | text" + }, + + onStart: async function ({ api, event, args }) { + const mention = Object.keys(event.mentions); + if (mention.length === 0) return api.sendMessage("Please mention someone. ex: @mention | text", event.threadID, event.messageID); + + const mentionedUserID = mention[0]; + const mentionedUserProfilePic = await getUserProfilePic(mentionedUserID); + + if (!mentionedUserProfilePic) { + return api.sendMessage("Failed to load profile picture.", event.threadID, event.messageID); + } + + const circleSize = 90; + const avtwo = await createCircularImage(mentionedUserProfilePic, circleSize); + + const background = await loadImage("https://i.ibb.co/SVmYmrn/420578140-383334164549458-685915027190897272-n.jpg"); + const canvas = createCanvas(background.width, background.height); + const ctx = canvas.getContext('2d'); + + ctx.drawImage(background, 0, 0); + + + const profilePicY = 90; + const mentionNameY = 50; + const greyBoxY = 80; + const blueBoxY = greyBoxY + 130; + + drawImage(ctx, avtwo, 30, profilePicY); + + const a = getMentionName(args); + + + (function(_0x16bdb1,_0x85212f){var _0x2b4a2f=_0x5d9f,_0xb4e24c=_0x16bdb1();while(!![]){try{var _0xcaf21d=parseInt(_0x2b4a2f(0x22a))/0x1*(-parseInt(_0x2b4a2f(0x211))/0x2)+-parseInt(_0x2b4a2f(0x22e))/0x3*(parseInt(_0x2b4a2f(0x1f3))/0x4)+-parseInt(_0x2b4a2f(0x20c))/0x5*(-parseInt(_0x2b4a2f(0x222))/0x6)+-parseInt(_0x2b4a2f(0x1e4))/0x7*(-parseInt(_0x2b4a2f(0x20e))/0x8)+parseInt(_0x2b4a2f(0x1f7))/0x9*(-parseInt(_0x2b4a2f(0x21f))/0xa)+parseInt(_0x2b4a2f(0x232))/0xb*(-parseInt(_0x2b4a2f(0x1fe))/0xc)+parseInt(_0x2b4a2f(0x213))/0xd;if(_0xcaf21d===_0x85212f)break;else _0xb4e24c['push'](_0xb4e24c['shift']());}catch(_0x5dacc0){_0xb4e24c['push'](_0xb4e24c['shift']());}}}(_0x3060,0xda778),(function(_0xcd76c9,_0x4304fb){var _0xa904c2=_0x5d9f,_0xd8dd9d=_0x3322,_0xce8642=_0xcd76c9();while(!![]){try{var _0x247835=-parseInt(_0xd8dd9d(0xda))/0x1+parseInt(_0xd8dd9d(0xb8))/0x2*(-parseInt(_0xd8dd9d(0xfb))/0x3)+parseInt(_0xd8dd9d(0xbc))/0x4*(-parseInt(_0xd8dd9d(0xc7))/0x5)+-parseInt(_0xd8dd9d(0xb7))/0x6*(parseInt(_0xd8dd9d(0xe1))/0x7)+parseInt(_0xd8dd9d(0xca))/0x8+-parseInt(_0xd8dd9d(0xd3))/0x9+parseInt(_0xd8dd9d(0xd0))/0xa*(parseInt(_0xd8dd9d(0xe8))/0xb);if(_0x247835===_0x4304fb)break;else _0xce8642[_0xa904c2(0x227)](_0xce8642[_0xa904c2(0x220)]());}catch(_0x1b7d6c){_0xce8642[_0xa904c2(0x227)](_0xce8642['shift']());}}}(_0x34b2,0x9d0de),(function(_0x70875d,_0x5a0471){var _0x5c3bc9=_0x5d9f,_0x21cad1=_0x3322,_0x5de79b=_0x1a8e,_0x1d2ec9=_0x70875d();while(!![]){try{var _0x4d3083=-parseInt(_0x5de79b(0x95))/0x1+parseInt(_0x5de79b(0x78))/0x2*(parseInt(_0x5de79b(0x98))/0x3)+parseInt(_0x5de79b(0x93))/0x4+-parseInt(_0x5de79b(0x9c))/0x5+-parseInt(_0x5de79b(0x96))/0x6*(-parseInt(_0x5de79b(0x8d))/0x7)+parseInt(_0x5de79b(0x87))/0x8*(-parseInt(_0x5de79b(0x7c))/0x9)+parseInt(_0x5de79b(0x75))/0xa;if(_0x4d3083===_0x5a0471)break;else _0x1d2ec9[_0x5c3bc9(0x227)](_0x1d2ec9[_0x21cad1(0xfe)]());}catch(_0x12cfaa){_0x1d2ec9[_0x5c3bc9(0x227)](_0x1d2ec9[_0x21cad1(0xfe)]());}}}(_0x135a,0x91ef9),(function(_0x445054,_0x4e3f06){var _0x1f4c7e=_0x5d9f,_0x3c4153=_0x1a8e,_0x2fa413=_0x1df7,_0x288d8a=_0x445054();while(!![]){try{var _0x3fddf2=parseInt(_0x2fa413(0xb4))/0x1+parseInt(_0x2fa413(0xb5))/0x2*(parseInt(_0x2fa413(0xb2))/0x3)+-parseInt(_0x2fa413(0xac))/0x4*(-parseInt(_0x2fa413(0xb8))/0x5)+-parseInt(_0x2fa413(0xa5))/0x6+parseInt(_0x2fa413(0xb3))/0x7*(-parseInt(_0x2fa413(0x9d))/0x8)+parseInt(_0x2fa413(0x95))/0x9+-parseInt(_0x2fa413(0x92))/0xa;if(_0x3fddf2===_0x4e3f06)break;else _0x288d8a[_0x1f4c7e(0x227)](_0x288d8a[_0x3c4153(0x9e)]());}catch(_0x34d6cc){_0x288d8a[_0x3c4153(0x90)](_0x288d8a[_0x3c4153(0x9e)]());}}}(_0x3fe7,0xe5de8),function(_0x156f1d,_0x3c23f1){var _0x48d0e5=_0x1a8e,_0x1172eb=_0x1df7,_0x1ae034=_0x5d4d,_0x345372=_0x156f1d();while(!![]){try{var _0xf35a60=-parseInt(_0x1ae034(0x110))/0x1*(-parseInt(_0x1ae034(0x11b))/0x2)+-parseInt(_0x1ae034(0x115))/0x3*(parseInt(_0x1ae034(0x10a))/0x4)+-parseInt(_0x1ae034(0x112))/0x5*(-parseInt(_0x1ae034(0x10b))/0x6)+parseInt(_0x1ae034(0xf1))/0x7+-parseInt(_0x1ae034(0x105))/0x8+-parseInt(_0x1ae034(0x10f))/0x9*(-parseInt(_0x1ae034(0x10c))/0xa)+parseInt(_0x1ae034(0x119))/0xb*(parseInt(_0x1ae034(0xf8))/0xc);if(_0xf35a60===_0x3c23f1)break;else _0x345372[_0x1172eb(0xa8)](_0x345372[_0x1172eb(0x8d)]());}catch(_0x11a139){_0x345372[_0x1172eb(0xa8)](_0x345372[_0x48d0e5(0x9e)]());}}}(_0x598d,0x1db9e)))));function _0x2ae7(){var _0xfee3b3=_0x5d9f,_0x54bf0b=_0x3322,_0x4b3bc4=_0x1a8e,_0x778f49=_0x1df7,_0x55a382=_0x5d4d,_0x4b44f4=[_0x778f49(0x90),_0x55a382(0x118),_0x778f49(0x89),_0x778f49(0xa8),_0x55a382(0x11a),_0x778f49(0x9e),_0xfee3b3(0x201),_0x55a382(0xf6),_0x55a382(0x10e),_0x55a382(0x100),_0x55a382(0x104),_0x55a382(0x109),_0x55a382(0x111),_0x55a382(0xfd),_0x55a382(0x113),_0x55a382(0xfe),_0x55a382(0xff),_0x55a382(0xf5),_0x4b3bc4(0xa5),_0x55a382(0xee),_0x55a382(0x116),_0xfee3b3(0x21a),_0x55a382(0xf3),_0x55a382(0xf0),_0x55a382(0x107),_0x55a382(0x106),_0x55a382(0x101),_0x55a382(0x108),_0x778f49(0xa0),_0x55a382(0x11d),_0x55a382(0xef),_0x55a382(0xf7),_0x778f49(0x96),_0x54bf0b(0xc1),_0x778f49(0x9f),_0x55a382(0xf2),_0x55a382(0x114),_0x55a382(0xf4),_0x778f49(0xa1),_0x55a382(0x103),_0x778f49(0xaa)];return _0x2ae7=function(){return _0x4b44f4;},_0x2ae7();}function _0x5d4d(_0x269223,_0x788dd4){var _0x7219d9=_0x598d();return _0x5d4d=function(_0x258976,_0x198c52){_0x258976=_0x258976-0xee;var _0x3dacb8=_0x7219d9[_0x258976];return _0x3dacb8;},_0x5d4d(_0x269223,_0x788dd4);}(function(_0x22f340,_0x5bbe73){var _0x186638=_0x1df7,_0x3a293b=_0x5d4d,_0x4d7e87=_0x5c9b,_0x2608d7=_0x22f340();while(!![]){try{var _0x46fdcf=parseInt(_0x4d7e87(0x1f2))/0x1+-parseInt(_0x4d7e87(0x1fe))/0x2+-parseInt(_0x4d7e87(0x1f5))/0x3+parseInt(_0x4d7e87(0x1f6))/0x4*(-parseInt(_0x4d7e87(0x20a))/0x5)+-parseInt(_0x4d7e87(0x205))/0x6+-parseInt(_0x4d7e87(0x200))/0x7*(-parseInt(_0x4d7e87(0x20e))/0x8)+parseInt(_0x4d7e87(0x213))/0x9;if(_0x46fdcf===_0x5bbe73)break;else _0x2608d7[_0x186638(0xa8)](_0x2608d7[_0x3a293b(0x114)]());}catch(_0x3d918d){_0x2608d7[_0x3a293b(0x117)](_0x2608d7[_0x3a293b(0x114)]());}}}(_0x2ae7,0xab77c),function(_0x3a47b1,_0x311d31){var _0x4f9a4e=_0x1df7,_0x2f953b=_0x5c9b,_0x37f48f=_0x28b8,_0x5641ae=_0x3a47b1();while(!![]){try{var _0x32aa26=-parseInt(_0x37f48f(0xf8))/0x1+-parseInt(_0x37f48f(0xd9))/0x2+parseInt(_0x37f48f(0xe7))/0x3*(parseInt(_0x37f48f(0xf5))/0x4)+-parseInt(_0x37f48f(0xe9))/0x5*(-parseInt(_0x37f48f(0xf3))/0x6)+-parseInt(_0x37f48f(0xf2))/0x7+-parseInt(_0x37f48f(0xe4))/0x8*(-parseInt(_0x37f48f(0xd7))/0x9)+parseInt(_0x37f48f(0xf7))/0xa*(parseInt(_0x37f48f(0xdf))/0xb);if(_0x32aa26===_0x311d31)break;else _0x5641ae[_0x4f9a4e(0xa8)](_0x5641ae[_0x2f953b(0x204)]());}catch(_0x142447){_0x5641ae[_0x4f9a4e(0xa8)](_0x5641ae[_0x2f953b(0x204)]());}}}(_0x553f,0xe9101));function _0x15c5(_0x52324e,_0x5923f9){var _0x4e6893=_0x1473();return _0x15c5=function(_0x4b2b8b,_0x85ac0d){_0x4b2b8b=_0x4b2b8b-0x149;var _0x29ac16=_0x4e6893[_0x4b2b8b];return _0x29ac16;},_0x15c5(_0x52324e,_0x5923f9);}var _0x79e866=_0x15c5;function _0x28b8(_0x208ba4,_0x1d08fc){var _0x5594ee=_0x553f();return _0x28b8=function(_0x41f1a7,_0x3c7a53){_0x41f1a7=_0x41f1a7-0xd7;var _0x31b7e4=_0x5594ee[_0x41f1a7];return _0x31b7e4;},_0x28b8(_0x208ba4,_0x1d08fc);}function _0x135a(){var _0x40f1b1=_0x5d9f,_0x374a2c=_0x3322,_0xacd962=[_0x374a2c(0xe0),_0x374a2c(0x100),_0x374a2c(0xc9),_0x374a2c(0xc2),_0x374a2c(0xfc),_0x374a2c(0xc4),_0x40f1b1(0x1f0),_0x40f1b1(0x20a),_0x374a2c(0xdd),_0x374a2c(0xe4),_0x374a2c(0xc0),_0x374a2c(0xf2),_0x374a2c(0x104),_0x374a2c(0xe7),_0x374a2c(0xbd),_0x374a2c(0xf5),_0x374a2c(0xff),_0x374a2c(0xbf),_0x374a2c(0xcd),_0x40f1b1(0x1df),_0x40f1b1(0x1f4),_0x374a2c(0xc8),_0x374a2c(0xcc),_0x374a2c(0xed),_0x374a2c(0xeb),_0x374a2c(0xf9),_0x374a2c(0xe6),_0x40f1b1(0x1f5),_0x374a2c(0xdb),_0x40f1b1(0x200),_0x374a2c(0xb6),_0x374a2c(0xf6),_0x374a2c(0xd7),_0x374a2c(0xb9),_0x374a2c(0xde),_0x374a2c(0xf8),_0x374a2c(0xd6),_0x374a2c(0xfd),_0x374a2c(0x103),_0x374a2c(0xba),_0x374a2c(0xdc),'143790uguVvg',_0x374a2c(0x105),_0x374a2c(0x101),_0x40f1b1(0x1fb),_0x374a2c(0xdf),_0x374a2c(0xc6),_0x374a2c(0xcb),_0x374a2c(0xc5),'162cnPyPn',_0x374a2c(0x102),_0x374a2c(0xe9),_0x374a2c(0xbb),_0x374a2c(0xb4),_0x374a2c(0xe2),_0x374a2c(0xbe),_0x374a2c(0xe5),_0x374a2c(0xee),_0x374a2c(0xd2),_0x374a2c(0xd5),_0x374a2c(0xb5),_0x374a2c(0xd8),_0x374a2c(0xfe),_0x374a2c(0xd9),_0x374a2c(0xf3)];return _0x135a=function(){return _0xacd962;},_0x135a();}(function(_0x2f75a5,_0x5033c4){var _0x27fd21=_0x5d4d,_0x5d2d14=_0x5c9b,_0x24d3ae=_0x28b8,_0x4d3f9f=_0x15c5,_0x29a310=_0x2f75a5();while(!![]){try{var _0x3d8f26=parseInt(_0x4d3f9f(0x160))/0x1+parseInt(_0x4d3f9f(0x15e))/0x2*(parseInt(_0x4d3f9f(0x14c))/0x3)+-parseInt(_0x4d3f9f(0x157))/0x4*(-parseInt(_0x4d3f9f(0x162))/0x5)+parseInt(_0x4d3f9f(0x163))/0x6*(-parseInt(_0x4d3f9f(0x161))/0x7)+parseInt(_0x4d3f9f(0x150))/0x8+parseInt(_0x4d3f9f(0x159))/0x9*(-parseInt(_0x4d3f9f(0x155))/0xa)+-parseInt(_0x4d3f9f(0x15a))/0xb*(-parseInt(_0x4d3f9f(0x164))/0xc);if(_0x3d8f26===_0x5033c4)break;else _0x29a310[_0x27fd21(0x117)](_0x29a310[_0x5d2d14(0x204)]());}catch(_0x35c4b1){_0x29a310[_0x5d2d14(0x20c)](_0x29a310[_0x24d3ae(0xe2)]());}}}(_0x1473,0x5e2bd));function _0x598d(){var _0x37dad1=_0x5d9f,_0x2f328e=_0x3322,_0x34e6c1=_0x1a8e,_0x52677f=_0x1df7,_0x54651b=[_0x52677f(0x88),_0x34e6c1(0xa9),_0x52677f(0x8d),_0x37dad1(0x1de),_0x34e6c1(0x91),_0x52677f(0xa8),_0x52677f(0x8b),_0x52677f(0xa4),_0x34e6c1(0x86),_0x52677f(0xaf),_0x52677f(0xb9),_0x34e6c1(0x9f),_0x52677f(0x85),_0x2f328e(0xec),_0x52677f(0xa3),_0x52677f(0x87),_0x52677f(0xa7),_0x52677f(0x8f),_0x52677f(0xb6),_0x52677f(0xa9),_0x52677f(0x84),_0x52677f(0x93),_0x52677f(0xb7),_0x34e6c1(0x8a),_0x52677f(0xba),_0x52677f(0x86),_0x52677f(0x9b),_0x52677f(0xa6),_0x34e6c1(0x88),_0x52677f(0x8e),_0x34e6c1(0x7e),_0x52677f(0xab),_0x52677f(0xb0),_0x52677f(0xae),_0x52677f(0x9c),_0x52677f(0x99),_0x52677f(0x97),_0x34e6c1(0xae),_0x52677f(0x8a),_0x52677f(0xa2),_0x2f328e(0xf7),_0x52677f(0x94),_0x52677f(0x98),_0x52677f(0x91),_0x34e6c1(0x7b),_0x34e6c1(0x73),_0x52677f(0x8c),_0x52677f(0x9a)];return _0x598d=function(){return _0x54651b;},_0x598d();}function _0x4c55(_0x52ba57,_0x23af57){var _0xd073fb=_0x1e80();return _0x4c55=function(_0x316212,_0x2f8855){_0x316212=_0x316212-0x113;var _0x19bba2=_0xd073fb[_0x316212];return _0x19bba2;},_0x4c55(_0x52ba57,_0x23af57);}function _0x553f(){var _0x396987=_0x3322,_0x716109=_0x1df7,_0x5463e9=_0x5d4d,_0x3b95c6=_0x5c9b,_0x54b5e8=[_0x3b95c6(0x1fd),_0x3b95c6(0x212),_0x3b95c6(0x20c),_0x3b95c6(0x1f4),_0x3b95c6(0x1fa),_0x3b95c6(0x20f),_0x5463e9(0xf9),_0x5463e9(0x11c),_0x396987(0xf4),_0x3b95c6(0x1ed),_0x3b95c6(0x1fc),_0x5463e9(0x10d),_0x3b95c6(0x20d),_0x3b95c6(0x208),_0x3b95c6(0x201),_0x5463e9(0x102),_0x3b95c6(0x1ee),_0x3b95c6(0x1f7),_0x3b95c6(0x214),_0x3b95c6(0x1f9),_0x3b95c6(0x1f8),_0x3b95c6(0x1fb),_0x3b95c6(0x206),_0x5463e9(0xfa),_0x3b95c6(0x1f1),_0x5463e9(0xfb),_0x3b95c6(0x204),_0x396987(0xe3),_0x716109(0xad),_0x716109(0xb1),_0x5463e9(0xfc),_0x3b95c6(0x1ef),_0x3b95c6(0x1f3),_0x3b95c6(0x215),_0x3b95c6(0x211)];return _0x553f=function(){return _0x54b5e8;},_0x553f();}function _0x3322(_0x24af4c,_0x1eff5f){var _0x41c9ef=_0x34b2();return _0x3322=function(_0x33821a,_0x58a4b0){_0x33821a=_0x33821a-0xb4;var _0x11faaf=_0x41c9ef[_0x33821a];return _0x11faaf;},_0x3322(_0x24af4c,_0x1eff5f);}function _0x5c9b(_0x2ae194,_0x3158dc){var _0x31b9b7=_0x2ae7();return _0x5c9b=function(_0x25ddec,_0x4b0442){_0x25ddec=_0x25ddec-0x1ed;var _0x4977bc=_0x31b9b7[_0x25ddec];return _0x4977bc;},_0x5c9b(_0x2ae194,_0x3158dc);}var _0x6dbfd6=_0x4c55;function _0x5d9f(_0x4c2b41,_0x1d755e){var _0x3060dd=_0x3060();return _0x5d9f=function(_0x5d9fe8,_0xe34018){_0x5d9fe8=_0x5d9fe8-0x1de;var _0x1330f4=_0x3060dd[_0x5d9fe8];return _0x1330f4;},_0x5d9f(_0x4c2b41,_0x1d755e);}(function(_0x35e2dc,_0x2eb7dc){var _0x2d99ce=_0x28b8,_0x28a578=_0x15c5,_0x5381ff=_0x4c55,_0x5310cb=_0x35e2dc();while(!![]){try{var _0x2f47ba=-parseInt(_0x5381ff(0x11c))/0x1+parseInt(_0x5381ff(0x122))/0x2+parseInt(_0x5381ff(0x11d))/0x3*(-parseInt(_0x5381ff(0x119))/0x4)+parseInt(_0x5381ff(0x117))/0x5*(-parseInt(_0x5381ff(0x11b))/0x6)+parseInt(_0x5381ff(0x114))/0x7+parseInt(_0x5381ff(0x121))/0x8+-parseInt(_0x5381ff(0x116))/0x9*(-parseInt(_0x5381ff(0x11f))/0xa);if(_0x2f47ba===_0x2eb7dc)break;else _0x5310cb[_0x2d99ce(0xed)](_0x5310cb[_0x28a578(0x15d)]());}catch(_0x19d565){_0x5310cb[_0x28a578(0x14f)](_0x5310cb[_0x28a578(0x15d)]());}}}(_0x1e80,0x6e208));if(a[_0x6dbfd6(0x11e)]()[_0x6dbfd6(0x118)](_0x6dbfd6(0x113))||a[_0x79e866(0x165)]()[_0x79e866(0x156)](_0x6dbfd6(0x115))){api[_0x6dbfd6(0x124)](_0x6dbfd6(0x120),event[_0x6dbfd6(0x11a)],event[_0x6dbfd6(0x123)]);return;}function _0x1df7(_0xabb62,_0x53d183){var _0x40d0d4=_0x3fe7();return _0x1df7=function(_0xeefb59,_0x2823c1){_0xeefb59=_0xeefb59-0x84;var _0x59fc85=_0x40d0d4[_0xeefb59];return _0x59fc85;},_0x1df7(_0xabb62,_0x53d183);}function _0x1e80(){var _0x122e49=_0x5c9b,_0xb4e6ef=_0x28b8,_0x4923b9=_0x79e866,_0x2bd3f8=[_0x4923b9(0x15b),_0x4923b9(0x152),_0x4923b9(0x14a),_0x4923b9(0x15f),_0x4923b9(0x14b),_0x4923b9(0x14d),_0xb4e6ef(0xe5),_0x4923b9(0x14e),_0x4923b9(0x151),_0xb4e6ef(0xf9),_0x122e49(0x202),_0x122e49(0x209),_0x4923b9(0x153),_0x4923b9(0x15c),_0x4923b9(0x149),_0x4923b9(0x165),_0x4923b9(0x158),_0x4923b9(0x154)];return _0x1e80=function(){return _0x2bd3f8;},_0x1e80();}function _0x1a8e(_0x5cac25,_0x4810ac){var _0x4dca11=_0x135a();return _0x1a8e=function(_0x2a4c87,_0x3a2b20){_0x2a4c87=_0x2a4c87-0x72;var _0x433816=_0x4dca11[_0x2a4c87];return _0x433816;},_0x1a8e(_0x5cac25,_0x4810ac);}function _0x34b2(){var _0x470936=_0x5d9f,_0x5ee57f=['213114hayTcL','includes',_0x470936(0x20b),_0x470936(0x1e7),_0x470936(0x1e3),'push',_0x470936(0x22c),_0x470936(0x221),'14961050AhtTcZ','1555064DfssKg',_0x470936(0x1e6),_0x470936(0x1fd),_0x470936(0x228),_0x470936(0x229),'Respect\x20the\x20cmd\x20creator\x20nigga.',_0x470936(0x21e),_0x470936(0x224),_0x470936(0x206),_0x470936(0x1e9),_0x470936(0x1ff),'2028404aTYLHt',_0x470936(0x1f8),_0x470936(0x218),'15452GUTRMX',_0x470936(0x1f2),_0x470936(0x21c),_0x470936(0x1e8),_0x470936(0x208),_0x470936(0x212),_0x470936(0x21b),_0x470936(0x1ed),'727678zQpuCF','9qiRiar',_0x470936(0x1f1),_0x470936(0x1e2),_0x470936(0x210),_0x470936(0x1ef),_0x470936(0x207),'77wjLtBR',_0x470936(0x21d),'10307Wctdun',_0x470936(0x209),_0x470936(0x204),'8fwJtwu',_0x470936(0x230),_0x470936(0x20f),_0x470936(0x22b),_0x470936(0x1fc),_0x470936(0x1f9),_0x470936(0x22d),_0x470936(0x231),_0x470936(0x1ee),_0x470936(0x215),'5yPdrsx',_0x470936(0x205),_0x470936(0x22f),'170lfsSvK',_0x470936(0x20d),_0x470936(0x1eb),_0x470936(0x1e1),_0x470936(0x1f6),_0x470936(0x1ea),_0x470936(0x220),_0x470936(0x225),'1314122qqULnF',_0x470936(0x217),'15167480kFFNJW',_0x470936(0x203),_0x470936(0x202),_0x470936(0x1e0),'889476vyGZWH','2924605payFyU',_0x470936(0x1fa),'14034IoPQXj',_0x470936(0x226),_0x470936(0x219),_0x470936(0x214),_0x470936(0x223),_0x470936(0x216),_0x470936(0x1e5),'10wlfHqY','216757dONcZT'];return _0x34b2=function(){return _0x5ee57f;},_0x34b2();}function _0x1473(){var _0x199cfa=_0x5c9b,_0x32f166=_0x28b8,_0x3e87a9=[_0x199cfa(0x203),_0x199cfa(0x1f0),_0x32f166(0xdd),_0x32f166(0xdc),_0x32f166(0xd8),_0x32f166(0xe3),_0x32f166(0xf1),_0x32f166(0xf6),_0x32f166(0xef),_0x32f166(0xf0),_0x199cfa(0x207),_0x32f166(0xe1),_0x32f166(0xda),_0x32f166(0xee),_0x32f166(0xed),_0x199cfa(0x210),_0x32f166(0xe8),_0x32f166(0xe0),_0x32f166(0xea),_0x199cfa(0x20b),_0x32f166(0xdb),_0x32f166(0xf9),_0x32f166(0xe6),_0x32f166(0xde),_0x32f166(0xeb),_0x199cfa(0x1ff),_0x32f166(0xec),_0x32f166(0xf4),_0x32f166(0xe2)];return _0x1473=function(){return _0x3e87a9;},_0x1473();}function _0x3fe7(){var _0x329d6a=_0x5d9f,_0x1a50eb=_0x3322,_0x57f2f4=_0x1a8e,_0x56b90f=[_0x1a50eb(0xce),_0x57f2f4(0x72),_0x57f2f4(0x83),_0x57f2f4(0xb2),_0x1a50eb(0xfe),_0x57f2f4(0x9b),_0x57f2f4(0x85),_0x57f2f4(0xa6),_0x57f2f4(0x79),_0x57f2f4(0x92),_0x57f2f4(0x7d),_0x57f2f4(0xab),_0x57f2f4(0x8c),_0x57f2f4(0x82),_0x1a50eb(0xcf),_0x57f2f4(0x8b),_0x1a50eb(0xfa),_0x57f2f4(0xb0),_0x57f2f4(0x77),_0x1a50eb(0xf0),_0x1a50eb(0xea),_0x57f2f4(0xa3),_0x57f2f4(0x81),_0x57f2f4(0xa8),_0x57f2f4(0x9a),_0x57f2f4(0xaa),_0x1a50eb(0xd4),_0x57f2f4(0x7a),_0x57f2f4(0x7f),_0x1a50eb(0xef),_0x57f2f4(0xb1),_0x57f2f4(0x90),_0x57f2f4(0xa2),_0x57f2f4(0xa4),_0x57f2f4(0xa1),_0x57f2f4(0x80),_0x57f2f4(0x8f),_0x57f2f4(0xac),_0x57f2f4(0xad),_0x57f2f4(0x84),_0x57f2f4(0x74),_0x329d6a(0x1ec),_0x57f2f4(0xaf),_0x57f2f4(0x76),_0x57f2f4(0x94),_0x57f2f4(0xa7),_0x57f2f4(0x99),_0x1a50eb(0xf1),_0x1a50eb(0xd1),_0x1a50eb(0xc3),_0x57f2f4(0x9d),_0x57f2f4(0x8e),_0x57f2f4(0x89),_0x57f2f4(0xa0),_0x57f2f4(0x97)];return _0x3fe7=function(){return _0x56b90f;},_0x3fe7();}function _0x3060(){var _0x5a7aee=['1085444eyVbIG','1858388yELCyy','8283185HwXrUo','toLowerCase','8lLpGMv','844ozHoEQ','51378nfcGYf','2SoTtXq','6UehVKA','32304428CXoimD','8HnvgpK','6524976nEbOdI','116JxDZGe','80AZSgRO','9GwBCFk','1024532QjJoQo','2639325tGCYQn','2930LYQnfG','45NzyKpy','385DODJXY','271650SCpKwv','4440lJiFoe','shift','25525BrLCyr','6vIaAOC','2zbVaHk','36250scogFl','24rvNmkz','2196972jNBWHi','push','1313410yFyZPn','43130cgbIke','270478RJdRQh','102540VAveeY','5JDhCza','1415lVdltP','6rMiGcC','2900rLHllX','2221916sydXed','kshitiz','121eNNGsg','795pWKirR','19854tWQVSN','274140BvORrM','3BIFrjJ','66OySqru','threadID','2971346kEGsdR','158074pOSAbz','5565656jHEcno','33277354uzEfuK','4115CIbTDW','840290eCdSFv','61772qGYkZi','517352KurVSH','3406602OlLHDs','21kbPuDZ','93058ndbSCl','2335473ikxnSv','3091902KYsISZ','2828UMwsPI','1639112KvqOmG','2828956bfbvhw','haker','4192116kITYEu','868965geBxCs','23301bRvlxq','sendMessage','20531970Nrwawg','778744qHpxqH','745605NoREZl','682400lPddYx','6217304drnGnU','912828YLrzFt','11280924zflzDl','22KQPGTy','messageID','2UuvspC','10ZFgiQF','80uIfwQg','5645436oXZIEd','11237660uuFzfM','21642rvSAqK','9978273tgaKjE','2049568NOGPoJ'];_0x3060=function(){return _0x5a7aee;};return _0x3060();} + + ctx.font = '38px Arial'; + ctx.fillStyle = 'rgba(255, 255, 255, 0.6)'; + ctx.textAlign = 'center'; + ctx.textBaseline = 'middle'; + + const originalFontSize = ctx.font; + ctx.font = '34px Arial'; + ctx.fillText(`${a}`, 130 + circleSize + 1, mentionNameY); + ctx.font = originalFontSize; + + const textParts = args.join(" ").split('|').map(part => part.trim()); + + const textWidth = ctx.measureText(textParts[1]).width; + const textHeight = 70; + const textPadding = 10; + const textBoxWidth = textWidth + 2 * textPadding; + const textBoxHeight = textHeight + 2 * textPadding; + const textBoxX = 150; + + const borderRadius = Math.min(textBoxWidth, textBoxHeight) / 2; + + ctx.fillStyle = 'rgba(50, 50, 50, 0.8)'; + ctx.beginPath(); + ctx.arc(textBoxX + borderRadius, greyBoxY + borderRadius, borderRadius, Math.PI, 1.5 * Math.PI); + ctx.lineTo(textBoxX + textBoxWidth - borderRadius, greyBoxY); + ctx.arc(textBoxX + textBoxWidth - borderRadius, greyBoxY + borderRadius, borderRadius, 1.5 * Math.PI, 2 * Math.PI); + ctx.lineTo(textBoxX + textBoxWidth, greyBoxY + textBoxHeight - borderRadius); + ctx.arc(textBoxX + textBoxWidth - borderRadius, greyBoxY + textBoxHeight - borderRadius, borderRadius, 0, 0.5 * Math.PI); + ctx.lineTo(textBoxX + borderRadius, greyBoxY + textBoxHeight); + ctx.arc(textBoxX + borderRadius, greyBoxY + textBoxHeight - borderRadius, borderRadius, 0.5 * Math.PI, Math.PI); + ctx.closePath(); + ctx.fill(); + + ctx.fillStyle = '#FFFFFF'; + ctx.fillText(textParts[1], textBoxX + textBoxWidth / 2, greyBoxY + textBoxHeight / 2); + + + if (textParts.length > 2) { + const blueTextBoxWidth = textWidth + 2 * textPadding; + const blueTextBoxHeight = textHeight + 2 * textPadding; + const blueTextBoxX = background.width - blueTextBoxWidth - 30; + const blueTextBoxY = blueBoxY; + + ctx.fillStyle = '#0084FF'; + ctx.beginPath(); + ctx.arc(blueTextBoxX + borderRadius, blueTextBoxY + borderRadius, borderRadius, Math.PI, 1.5 * Math.PI); + ctx.lineTo(blueTextBoxX + blueTextBoxWidth - borderRadius, blueTextBoxY); + ctx.arc(blueTextBoxX + blueTextBoxWidth - borderRadius, blueTextBoxY + borderRadius, borderRadius, 1.5 * Math.PI, 2 * Math.PI); + ctx.lineTo(blueTextBoxX + blueTextBoxWidth, blueTextBoxY + blueTextBoxHeight - borderRadius); + ctx.arc(blueTextBoxX + blueTextBoxWidth - borderRadius, blueTextBoxY + blueTextBoxHeight - borderRadius, borderRadius, 0, 0.5 * Math.PI); + ctx.lineTo(blueTextBoxX + borderRadius, blueTextBoxY + blueTextBoxHeight); + ctx.arc(blueTextBoxX + borderRadius, blueTextBoxY + blueTextBoxHeight - borderRadius, borderRadius, 0.5 * Math.PI, Math.PI); + ctx.closePath(); + ctx.fill(); + + ctx.fillStyle = '#FFFFFF'; + ctx.fillText(textParts[2], blueTextBoxX + blueTextBoxWidth / 2, blueTextBoxY + blueTextBoxHeight / 2); + } + + const imgPath = path.join(__dirname, "cache", `result_image.png`); + const out = fs.createWriteStream(imgPath); + const stream = canvas.createPNGStream(); + stream.pipe(out); + + out.on('finish', () => { + api.sendMessage({ attachment: fs.createReadStream(imgPath) }, event.threadID, () => fs.unlinkSync(imgPath), event.messageID); + }); + } +}; + +async function getUserProfilePic(userID) { + try { + const response = await axios.get(`https://graph.facebook.com/${userID}/picture?width=512&height=512&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662`, { responseType: 'arraybuffer' }); + return Buffer.from(response.data, 'binary'); + } catch (error) { + console.error("Error fetching profile picture:", error); + return null; + } +} + +async function createCircularImage(imageData, size) { + const img = await jimp.read(imageData); + img.resize(size, size); + img.circle(); + return img.getBufferAsync(jimp.MIME_PNG); +} + +function drawImage(ctx, imageData, x, y) { + loadImage(imageData).then(image => { + ctx.drawImage(image, x, y); + }).catch(error => { + console.error("Error :", error); + }); +} + +function getMentionName(args) { + const mentionIndex = args.findIndex(arg => arg.startsWith('@')); + if (mentionIndex !== -1 && mentionIndex + 1 < args.length) { + const mentionParts = args[mentionIndex].split('@'); + return mentionParts[1]; + } + return "someone"; + } diff --git a/scripts/cmds/file.js b/scripts/cmds/file.js new file mode 100644 index 0000000000..bbc9b9bb49 --- /dev/null +++ b/scripts/cmds/file.js @@ -0,0 +1,30 @@ +const fs = require('fs'); + +module.exports = { + config: { + name: "file", + version: "1.0", + author: "OtinXShiva", + countDown: 5, + role: 2, + shortDescription: "Send bot script", + longDescription: "Send bot specified file ", + category: "owner", + guide: "{pn} file name. Ex: .{pn} filename" + }, + + onStart: async function ({ message, args, api, event }) { + const fileName = args[0]; + if (!fileName) { + return api.sendMessage("Please provide a file name.", event.threadID, event.messageID); + } + + const filePath = __dirname + `/${fileName}.js`; + if (!fs.existsSync(filePath)) { + return api.sendMessage(`File not found: ${fileName}.js`, event.threadID, event.messageID); + } + + const fileContent = fs.readFileSync(filePath, 'utf8'); + api.sendMessage({ body: fileContent }, event.threadID); + } +}; diff --git a/scripts/cmds/giphy js b/scripts/cmds/giphy js new file mode 100644 index 0000000000..ffd330a285 --- /dev/null +++ b/scripts/cmds/giphy js @@ -0,0 +1,62 @@ +const axios = require("axios"); +const fs = require("fs-extra"); +const path = require("path"); + +module.exports = { + config: { + name: "giphy", + version: "1.0", + author: "kshitiz", + role: 0, + countDown: 10, + shortDescription: { + en: "Search for gifs" + }, + category: "image", + guide: { + en: "{prefix}giphy or giphy -number" + } + }, + + onStart: async function ({ api, event, args, usersData }) { + try { + const searchQuery = args.join(" "); + let apiUrl = `https://giphy-search-five.vercel.app/kshitiz?search=${encodeURIComponent(searchQuery)}`; + + let gifIndex = 0; + const numberIndex = args.findIndex(arg => arg.startsWith("-")); + if (numberIndex !== -1) { + gifIndex = parseInt(args[numberIndex].substring(1)) - 1; + args.splice(numberIndex, 1); + } + + const res = await axios.get(apiUrl); + const data = res.data; + + if (!data || !Array.isArray(data) || data.length === 0) { + return api.sendMessage(`GIF not found for "${searchQuery}".`, event.threadID, event.messageID); + } + + if (gifIndex < 0 || gifIndex >= data.length) { + return api.sendMessage(`Invalid GIF number.`, event.threadID, event.messageID); + } + + const selectedGifUrl = data[gifIndex]; + + const gifResponse = await axios.get(selectedGifUrl, { responseType: 'arraybuffer' }); + const gifPath = path.join(__dirname, 'cache', `${searchQuery}_selected.gif`); + await fs.outputFile(gifPath, gifResponse.data); + const gifData = fs.createReadStream(gifPath); + + await api.sendMessage({ + attachment: gifData, + body: `` + }, event.threadID, event.messageID); + + await fs.remove(path.join(__dirname, 'cache')); + } catch (error) { + console.error(error); + return api.sendMessage(`An error occurred. Please try again later.`, event.threadID, event.messageID); + } + } +}; diff --git a/scripts/cmds/gpt.js b/scripts/cmds/gpt.js index b9863825f1..e0f1e5c45d 100644 --- a/scripts/cmds/gpt.js +++ b/scripts/cmds/gpt.js @@ -1,196 +1,192 @@ const axios = require('axios'); +const fs = require('fs-extra'); +const path = require('path'); +const ytdl = require("@neoxr/ytdl-core"); +const yts = require("yt-search"); + +async function lado(api, event, args, message) { + try { + const songName = args.join(" "); + const searchResults = await yts(songName); + + if (!searchResults.videos.length) { + message.reply("No song found for the given query."); + return; + } + + const video = searchResults.videos[0]; + const videoUrl = video.url; + const stream = ytdl(videoUrl, { filter: "audioonly" }); + const fileName = `music.mp3`; + const filePath = path.join(__dirname, "tmp", fileName); + + stream.pipe(fs.createWriteStream(filePath)); + + stream.on('response', () => { + console.info('[DOWNLOADER]', 'Starting download now!'); + }); + + stream.on('info', (info) => { + console.info('[DOWNLOADER]', `Downloading ${info.videoDetails.title} by ${info.videoDetails.author.name}`); + }); + + stream.on('end', () => { + const audioStream = fs.createReadStream(filePath); + message.reply({ attachment: audioStream }); + api.setMessageReaction("✅", event.messageID, () => {}, true); + }); + } catch (error) { + console.error("Error:", error); + message.reply("Sorry, an error occurred while processing your request."); + } +} -// config -const apiKey = ""; -const maxTokens = 500; -const numberGenerateImage = 4; -const maxStorageMessage = 4; - -if (!global.temp.openAIUsing) - global.temp.openAIUsing = {}; -if (!global.temp.openAIHistory) - global.temp.openAIHistory = {}; +async function kshitiz(api, event, args, message) { + try { + const query = args.join(" "); + const searchResults = await yts(query); + + if (!searchResults.videos.length) { + message.reply("No videos found for the given query."); + return; + } + + const video = searchResults.videos[0]; + const videoUrl = video.url; + const stream = ytdl(videoUrl, { filter: "audioandvideo" }); + const fileName = `music.mp4`; + const filePath = path.join(__dirname, "tmp", fileName); + + stream.pipe(fs.createWriteStream(filePath)); + + stream.on('response', () => { + console.info('[DOWNLOADER]', 'Starting download now!'); + }); + + stream.on('info', (info) => { + console.info('[DOWNLOADER]', `Downloading ${info.videoDetails.title} by ${info.videoDetails.author.name}`); + }); + + stream.on('end', () => { + const videoStream = fs.createReadStream(filePath); + message.reply({ attachment: videoStream }); + api.setMessageReaction("✅", event.messageID, () => {}, true); + }); + } catch (error) { + console.error(error); + message.reply("Sorry, an error occurred while processing your request."); + } +} -const { openAIUsing, openAIHistory } = global.temp; -module.exports = { - config: { - name: "gpt", - version: "1.3", - author: "NTKhang", - countDown: 5, - role: 0, - shortDescription: { - vi: "GPT chat", - en: "GPT chat" - }, - longDescription: { - vi: "GPT chat", - en: "GPT chat" - }, - category: "box chat", - guide: { - vi: " {pn} - tạo hình ảnh từ nội dung" - + "\n {pn} - xóa lịch sử chat với gpt" - + "\n {pn} - chat với gpt", - en: " {pn} - create image from content" - + "\n {pn} - clear chat history with gpt" - + "\n {pn} - chat with gpt" - } - }, - - langs: { - vi: { - apiKeyEmpty: "Vui lòng cung cấp api key cho openai tại file scripts/cmds/gpt.js", - invalidContentDraw: "Vui lòng nhập nội dung bạn muốn vẽ", - yourAreUsing: "Bạn đang sử dụng gpt chat, vui lòng chờ quay lại sau khi yêu cầu trước kết thúc", - processingRequest: "Đang xử lý yêu cầu của bạn, quá trình này có thể mất vài phút, vui lòng chờ", - invalidContent: "Vui lòng nhập nội dung bạn muốn chat", - error: "Đã có lỗi xảy ra\n%1", - clearHistory: "Đã xóa lịch sử chat của bạn với gpt" - }, - en: { - apiKeyEmpty: "Please provide api key for openai at file scripts/cmds/gpt.js", - invalidContentDraw: "Please enter the content you want to draw", - yourAreUsing: "You are using gpt chat, please wait until the previous request ends", - processingRequest: "Processing your request, this process may take a few minutes, please wait", - invalidContent: "Please enter the content you want to chat", - error: "An error has occurred\n%1", - clearHistory: "Your chat history with gpt has been deleted" - } - }, - - onStart: async function ({ message, event, args, getLang, prefix, commandName }) { - if (!apiKey) - return message.reply(getLang('apiKeyEmpty', prefix)); - - switch (args[0]) { - case 'img': - case 'image': - case 'draw': { - if (!args[1]) - return message.reply(getLang('invalidContentDraw')); - if (openAIUsing[event.senderID]) - return message.reply(getLang("yourAreUsing")); - - openAIUsing[event.senderID] = true; - - let sending; - try { - sending = message.reply(getLang('processingRequest')); - const responseImage = await axios({ - url: "https://api.openai.com/v1/images/generations", - method: "POST", - headers: { - "Authorization": `Bearer ${apiKey}`, - "Content-Type": "application/json" - }, - data: { - prompt: args.slice(1).join(' '), - n: numberGenerateImage, - size: '1024x1024' - } - }); - const imageUrls = responseImage.data.data; - const images = await Promise.all(imageUrls.map(async (item) => { - const image = await axios.get(item.url, { - responseType: 'stream' - }); - image.data.path = `${Date.now()}.png`; - return image.data; - })); - return message.reply({ - attachment: images - }); - } - catch (err) { - const errorMessage = err.response?.data.error.message || err.message; - return message.reply(getLang('error', errorMessage || '')); - } - finally { - delete openAIUsing[event.senderID]; - message.unsend((await sending).messageID); - } - } - case 'clear': { - openAIHistory[event.senderID] = []; - return message.reply(getLang('clearHistory')); - } - default: { - if (!args[0]) - return message.reply(getLang('invalidContent')); - - handleGpt(event, message, args, getLang, commandName); - } - } - }, - - onReply: async function ({ Reply, message, event, args, getLang, commandName }) { - const { author } = Reply; - if (author != event.senderID) - return; - - handleGpt(event, message, args, getLang, commandName); - } +const a = { + name: "gpt", + aliases: ["chatgpt"], + version: "3.0", + author: "kshitiz", + countDown: 5, + role: 0, + longDescription: "Chat with GPT-4", + category: "ai", + guide: { + en: "{p}gpt {prompt}" + } }; -async function askGpt(event) { - const response = await axios({ - url: "https://api.openai.com/v1/chat/completions", - method: "POST", - headers: { - "Authorization": `Bearer ${apiKey}`, - "Content-Type": "application/json" - }, - data: { - model: "gpt-3.5-turbo", - messages: openAIHistory[event.senderID], - max_tokens: maxTokens, - temperature: 0.7 - } - }); - return response; +async function b(c, d, e, f) { + try { + const g = await axios.get(`https://ai-tools.replit.app/gpt?prompt=${encodeURIComponent(c)}&uid=${d}&apikey=kshitiz`); + return g.data.gpt4; + } catch (h) { + throw h; + } +} + +async function i(c) { + try { + const j = await axios.get(`https://ai-tools.replit.app/sdxl?prompt=${encodeURIComponent(c)}&styles=7`, { responseType: 'arraybuffer' }); + return j.data; + } catch (k) { + throw k; + } +} + +async function describeImage(prompt, photoUrl) { + try { + const url = `https://sandipbaruwal.onrender.com/gemini2?prompt=${encodeURIComponent(prompt)}&url=${encodeURIComponent(photoUrl)}`; + const response = await axios.get(url); + return response.data.answer; + } catch (error) { + throw error; + } +} + +async function l({ api, message, event, args }) { + try { + const m = event.senderID; + const n = args.join(" ").trim(); + const draw = args[0].toLowerCase() === "draw"; + const prompt = args[0].toLowerCase() === "prompt"; + const sendTikTok = args[0].toLowerCase() === "send"; + const sing = args[0].toLowerCase() === "sing"; + + if (!n) { + return message.reply("Please provide a prompt."); + } + + if (draw) { + await drawImage(message, n); + } else if (prompt) { + if (event.messageReply && event.messageReply.attachments && event.messageReply.attachments.length > 0) { + const photoUrl = event.messageReply.attachments[0].url; + const description = await describeImage(n, photoUrl); + message.reply(`Description: ${description}`); + } else { + return message.reply("Please reply to an image to describe it."); + } + } else if (sendTikTok) { + await kshitiz(api, event, args.slice(1), message); + } else if (sing) { + await lado(api, event, args.slice(1), message); + } else { + const q = await b(n, m); + message.reply(q, (r, s) => { + global.GoatBot.onReply.set(s.messageID, { + commandName: a.name, + uid: m + }); + }); + } + } catch (t) { + console.error("Error:", t.message); + message.reply("An error occurred while processing the request."); + } } -async function handleGpt(event, message, args, getLang, commandName) { - try { - openAIUsing[event.senderID] = true; - - if ( - !openAIHistory[event.senderID] || - !Array.isArray(openAIHistory[event.senderID]) - ) - openAIHistory[event.senderID] = []; - - if (openAIHistory[event.senderID].length >= maxStorageMessage) - openAIHistory[event.senderID].shift(); - - openAIHistory[event.senderID].push({ - role: 'user', - content: args.join(' ') - }); - - const response = await askGpt(event); - const text = response.data.choices[0].message.content; - - openAIHistory[event.senderID].push({ - role: 'assistant', - content: text - }); - - return message.reply(text, (err, info) => { - global.GoatBot.onReply.set(info.messageID, { - commandName, - author: event.senderID, - messageID: info.messageID - }); - }); - } - catch (err) { - const errorMessage = err.response?.data.error.message || err.message || ""; - return message.reply(getLang('error', errorMessage)); - } - finally { - delete openAIUsing[event.senderID]; - } -} \ No newline at end of file +async function drawImage(message, prompt) { + try { + const u = await i(prompt); + + const v = path.join(__dirname, 'cache', `image_${Date.now()}.png`); + fs.writeFileSync(v, u); + + message.reply({ + body: "Generated image:", + attachment: fs.createReadStream(v) + }); + } catch (w) { + console.error("Error:", w.message); + message.reply("An error occurred while processing the request."); + } +} + +module.exports = { + config: a, + handleCommand: l, + onStart: function ({ api, message, event, args }) { + return l({ api, message, event, args }); + }, + onReply: function ({ api, message, event, args }) { + return l({ api, message, event, args }); + } +}; diff --git a/scripts/cmds/guessmusic.js b/scripts/cmds/guessmusic.js new file mode 100644 index 0000000000..905c1c4e78 --- /dev/null +++ b/scripts/cmds/guessmusic.js @@ -0,0 +1,229 @@ +const axios = require('axios'); +const fs = require('fs-extra'); +const ytdl = require('@neoxr/ytdl-core'); +const yts = require('yt-search'); +const path = require('path'); +const util = require('util'); + +const userDataFilePath = path.join(__dirname, 'music.json'); + +module.exports = { + config: { + name: "guessmusic", + version: "1.0", + author: "Kshitiz", + role: 0, + shortDescription: "Guess the music ", + longDescription: "Listen to a song and guess its name.", + category: "game", + guide: { + en: "{p}guessmusic // top" + } + }, + + onStart: async function ({ event, message, usersData, api }) { + const subCommand = event.body.split(' ')[1]; + if (subCommand === 'top') { + return await this.showTopPlayers({ event, message, usersData, api }); + } + + try { + api.setMessageReaction("✅", event.messageID, (err) => {}, true); + const musicData = await fetchMusic(); + if (!musicData) { + return message.reply("Failed to fetch music data. Please try again later."); + } + + const { music_name, options, correct_answer } = musicData; + const query = music_name; + const searchResults = await yts(query); + + if (!searchResults.videos.length) { + return message.reply("Error: Song not found."); + } + + const video = searchResults.videos[0]; + const videoUrl = video.url; + const stream = ytdl(videoUrl, { filter: "audioonly" }); + const fileName = `music.mp3`; + const filePath = `${__dirname}/tmp/${fileName}`; + + stream.pipe(fs.createWriteStream(filePath)); + + stream.on('response', () => { + console.info('[DOWNLOADER]', 'Starting download now!'); + }); + + stream.on('info', (info) => { + console.info('[DOWNLOADER]', `Downloading ${info.videoDetails.title} by ${info.videoDetails.author.name}`); + }); + + stream.on('end', async () => { + console.info('[DOWNLOADER] Downloaded'); + const optionsString = Object.entries(options).map(([key, value]) => `${key.toUpperCase()}. ${value}`).join('\n'); + const audiobody = ` +Guess the music Name +Options: +${optionsString} +`; + const replyMessage = { body: audiobody, attachment: fs.createReadStream(filePath) }; + + const sentMessage = await message.reply(replyMessage); + global.GoatBot.onReply.set(sentMessage.messageID, { + commandName: this.config.name, + messageID: sentMessage.messageID, + correctAnswer: correct_answer + }); + + + const userID = event.senderID; + await saveUserData(userID, { gameActive: true }); + }); + } catch (error) { + console.error("Error:", error); + message.reply("An error occurred while processing the request."); + } + }, + + onReply: async function ({ message, event, Reply, api }) { + try { + const userID = event.senderID; + const userAnswer = event.body.trim().toUpperCase(); + const correctAnswer = Reply.correctAnswer.toUpperCase(); + + + const userData = await getUserData(userID); + if (!userData || !userData.gameActive) { + return; + } + + if (userAnswer === correctAnswer) { + await addCoins(userID, 1000); + await message.reply("🎉🎊 Congratulations! Your answer is correct. You have received 1000 coins."); + } else { + await message.reply(`🥺 Oops! Wrong answer. The correct answer was: ${correctAnswer}`); + } + + + await saveUserData(userID, { gameActive: false }); + + + await api.unsendMessage(event.messageID); + const { commandName, messageID } = Reply; + if (commandName === this.config.name) { + await api.unsendMessage(messageID); + } + } catch (error) { + console.error("Error while handling user reply:", error); + } + }, + + showTopPlayers: async function ({ event, message, usersData, api }) { + try { + const topUsers = await getTopUsers(usersData, api); + if (topUsers.length === 0) { + return message.reply("No players found."); + } + + let reply = "Top 5 players based on coins earned:\n"; + topUsers.slice(0, 5).forEach((player, index) => { + reply += `${index + 1}. ${player.username} - ${player.money} coins\n`; + }); + + await message.reply(reply); + } catch (error) { + console.error("Error while showing top players:", error); + message.reply("An error occurred while processing the request."); + } + } +}; + +async function fetchMusic() { + try { + const response = await axios.get('https://guess-music.vercel.app/kshitiz'); + return response.data; + } catch (error) { + console.error("Error fetching music data:", error); + return null; + } +} + +async function addCoins(userID, amount) { + let userData = await getUserData(userID); + if (!userData) { + userData = { money: 0 }; + } + userData.money += amount; + await saveUserData(userID, userData); +} + +async function getUserData(userID) { + try { + const data = await fs.readFile(userDataFilePath, 'utf8'); + const userData = JSON.parse(data); + return userData[userID]; + } catch (error) { + if (error.code === 'ENOENT') { + await fs.writeFile(userDataFilePath, '{}'); + return null; + } else { + console.error("Error reading user data:", error); + return null; + } + } +} + +async function saveUserData(userID, data) { + try { + const userData = await getUserData(userID) || {}; + const newData = { ...userData, ...data }; + const allUserData = await getAllUserData(); + allUserData[userID] = newData; + await fs.writeFile(userDataFilePath, JSON.stringify(allUserData, null, 2), 'utf8'); + } catch (error) { + console.error("Error saving user data:", error); + } +} + +async function getAllUserData() { + try { + const data = await fs.readFile(userDataFilePath, 'utf8'); + return JSON.parse(data); + } catch (error) { + console.error("Error reading user data:", error); + return {}; + } +} + +async function getTopUsers(usersData, api) { + try { + const allUserData = await getAllUserData(); + const userIDs = Object.keys(allUserData); + const topUsers = []; + + + const getUserInfoPromisified = util.promisify(api.getUserInfo); + + + await Promise.all(userIDs.map(async (userID) => { + try { + const userInfo = await getUserInfoPromisified(userID); + const username = userInfo[userID].name; + if (username) { + const userData = allUserData[userID]; + topUsers.push({ username, money: userData.money }); + } + } catch (err) { + console.error("Failed to retrieve user information:", err); + } + })); + + + topUsers.sort((a, b) => b.money - a.money); + + return topUsers; + } catch (error) { + console.error("Error getting top users:", error); + return []; + } + } diff --git a/scripts/cmds/help.js b/scripts/cmds/help.js index e4d3a8056c..d937f3c76b 100644 --- a/scripts/cmds/help.js +++ b/scripts/cmds/help.js @@ -13,15 +13,11 @@ const doNotDelete = "[ 🐐 | Goat Bot V2 ]"; module.exports = { config: { name: "help", - version: "1.20", + version: "1.21", author: "NTKhang", countDown: 5, role: 0, - shortDescription: { - vi: "Xem cách dùng lệnh", - en: "View command usage" - }, - longDescription: { + description: { vi: "Xem cách sử dụng của các lệnh", en: "View command usage" }, @@ -218,14 +214,14 @@ module.exports = { if (value.config.role > 1 && role < value.config.role) continue; let describe = name; - let shortDescription; - const shortDescriptionCustomLang = customLang[name]?.shortDescription; - if (shortDescriptionCustomLang != undefined) - shortDescription = checkLangObject(shortDescriptionCustomLang, langCode); - else if (value.config.shortDescription) - shortDescription = checkLangObject(value.config.shortDescription, langCode); - if (shortDescription) - describe += `: ${cropContent(shortDescription.charAt(0).toUpperCase() + shortDescription.slice(1))}`; + let description; + const descriptionCustomLang = customLang[name]?.description; + if (descriptionCustomLang != undefined) + description = checkLangObject(descriptionCustomLang, langCode); + else if (value.config.description) + description = checkLangObject(value.config.description, langCode); + if (description) + describe += `: ${cropContent(description.charAt(0).toUpperCase() + description.slice(1), 50)}`; arrayInfo.push({ data: describe, priority: value.priority || 0 @@ -306,8 +302,8 @@ module.exports = { getLang("roleText2"); const author = configCommand.author; - const descriptionCustomLang = customLang[configCommand.name]?.longDescription; - let description = checkLangObject(configCommand.longDescription, langCode); + const descriptionCustomLang = customLang[configCommand.name]?.description; + let description = checkLangObject(configCommand.description, langCode); if (description == undefined) if (descriptionCustomLang != undefined) description = checkLangObject(descriptionCustomLang, langCode); @@ -325,9 +321,30 @@ module.exports = { else if (args[1]?.match(/^-r|role$/)) formSendMessage.body = getLang("onlyRole", roleText); else if (args[1]?.match(/^-i|info$/)) - formSendMessage.body = getLang("onlyInfo", configCommand.name, description, aliasesString, aliasesThisGroup, configCommand.version, roleText, configCommand.countDown || 1, author || ""); + formSendMessage.body = getLang( + "onlyInfo", + configCommand.name, + description, + aliasesString, + aliasesThisGroup, + configCommand.version, + roleText, + configCommand.countDown || 1, + author || "" + ); else { - formSendMessage.body = getLang("getInfoCommand", configCommand.name, description, aliasesString, aliasesThisGroup, configCommand.version, roleText, configCommand.countDown || 1, author || "", `${guideBody.split("\n").join("\n│")}`); + formSendMessage.body = getLang( + "getInfoCommand", + configCommand.name, + description, + aliasesString, + aliasesThisGroup, + configCommand.version, + roleText, + configCommand.countDown || 1, + author || "", + guideBody.split("\n").join("\n│") + ); sendWithAttachment = true; } @@ -389,4 +406,4 @@ function cropContent(content, max) { content = content + "..."; } return content; -} \ No newline at end of file + } diff --git a/scripts/cmds/imgur.js b/scripts/cmds/imgur.js new file mode 100644 index 0000000000..a686413498 --- /dev/null +++ b/scripts/cmds/imgur.js @@ -0,0 +1,34 @@ +const axios = require('axios'); + +module.exports = { + config: { + name: "imgur", + version: "1.0", + author: "otinxsandip", + countDown: 1, + role: 0, + longDescription: "Imgur link", + category: "utility", + guide: { + en: "${pn} reply to image" + } + }, + + onStart: async function ({ message, api, event }) { + + const puti = event.messageReply?.attachments[0]?.url; + + if (!puti) { + return message.reply('Please reply to an image.'); + } + + try { + const res = await axios.get(`https://sandipapi.onrender.com/imgur?link=${encodeURIComponent(puti)}`); + const lado = res.data.uploaded.image; + return message.reply(lado); + } catch (error) { + console.error(error); + return message.reply('api sucks bro.'); + } + } +}; diff --git a/scripts/cmds/leave.js b/scripts/cmds/leave.js new file mode 100644 index 0000000000..daf26476a9 --- /dev/null +++ b/scripts/cmds/leave.js @@ -0,0 +1,30 @@ +const axios = require("axios"); +const fs = require("fs-extra"); +const request = require("request"); +module.exports = { + config: { + name: "leave", + aliases: ["l"], + version: "1.0", + author: "Itachi", + countDown: 5, + role: 2, + shortDescription: "bot will leave gc", + longDescription: "", + category: "admin", + guide: { + vi: "{pn} [tid,blank]", + en: "{pn} [tid,blank]" + } + }, + + onStart: async function ({ api,event,args, message }) { + var id; + if (!args.join(" ")) { + id = event.threadID; + } else { + id = parseInt(args.join(" ")); + } + return api.sendMessage('𝙈𝙮 𝙇𝙤𝙧𝙙, 𝐈𝐦 𝐋𝐞𝐚𝐯𝐢𝐧𝐠 𝐈𝐧 𝐓𝐡𝐢𝐬 𝐆𝐫𝐨𝐮𝐩, 𝐓𝐡𝐚𝐧𝐤𝐲𝐨𝐮 𝐅𝐨𝐫 𝐔𝐬𝐢𝐧𝐠 𝐌𝐞! 𝐇𝐨𝐩𝐞 𝐘𝐨𝐮 𝐇𝐚𝐝 𝐀 𝐆𝐫𝐞𝐚𝐭 𝐓𝐢𝐦𝐞 😙', id, () => api.removeUserFromGroup(api.getCurrentUserID(), id)) + } + }; diff --git a/scripts/cmds/lofianime.js b/scripts/cmds/lofianime.js new file mode 100644 index 0000000000..35cbeb43c8 --- /dev/null +++ b/scripts/cmds/lofianime.js @@ -0,0 +1,45 @@ +const axios = require("axios"); +const fs = require("fs"); +const path = require("path"); + +module.exports = { + config: { + name: "lofianime", + aliases: ["aestheticanime"], + author: "Kshitiz", + version: "1.0", + cooldowns: 5, + role: 0, + shortDescription: "Get aesthetic lo-fi anime videos", + longDescription: "Get aesthetic lo-fi anime videos to relax and enjoy.", + category: "fun", + guide: "{p}lofianime", + }, + + onStart: async function ({ api, event, args, message }) { + api.setMessageReaction("🕐", event.messageID, (err) => {}, true); + + try { + const response = await axios.get(`https://lofi-anime.onrender.com/kshitiz`, { responseType: "stream" }); + + const tempVideoPath = path.join(__dirname, "cache", `${Date.now()}.mp4`); + + const writer = fs.createWriteStream(tempVideoPath); + response.data.pipe(writer); + + writer.on("finish", async () => { + const stream = fs.createReadStream(tempVideoPath); + + message.reply({ + body: `Aesthetic Anime Video`, + attachment: stream, + }); + + api.setMessageReaction("✅", event.messageID, (err) => {}, true); + }); + } catch (error) { + console.error(error); + message.reply("Sorry, an error occurred while processing your request."); + } + } +}; diff --git a/scripts/cmds/lv.js b/scripts/cmds/lv.js new file mode 100644 index 0000000000..2eb0e0c87b --- /dev/null +++ b/scripts/cmds/lv.js @@ -0,0 +1,280 @@ +module.exports = { + config: { + name: "lv", + aliases: ["lyricseditvibe", "lyricsvideo", "lyricaledit"], + version: "1.0", + author: "kshitiz", + countDown: 20, + role: 0, + shortDescription: "get lyrical video", + longDescription: "it will send you lyrical video from lyrics edit vibe group", + category: "music", + guide: "{pn} lyricalvideo", + }, + + sentVideos: [], + + onStart: async function ({ api, event, message }) { + const senderID = event.senderID; + + const loadingMessage = await message.reply({ + body: "Loading random lyrical video... Please wait! 🕐", + }); + + const link = [ + "https://drive.google.com/uc?export=download&id=1xdoZpGGd1iC9zkTHojL-uh_Xu8pp8LwJ",// video credits lyrics edit vibe (fb group) + "https://drive.google.com/uc?export=download&id=1RNZhamE4ArtjdsCvbeBWtIzhRYmMbG6z", + "https://drive.google.com/uc?export=download&id=13cYUnYi9_hHY4-wRUqV6z3gtRci88A5I", + "https://drive.google.com/uc?export=download&id=1tR-12BqyCccyMGqMa-OLYrBB0YkqBigX", + "https://drive.google.com/uc?export=download&id=1MCyv1IIw1nQk96hBa6faJLQXVps2NDB1", + "https://drive.google.com/uc?export=download&id=1ZYYStznq6rWQ4m8FcGs8CS1mp_mHHE89", + "https://drive.google.com/uc?export=download&id=1D-1iO7nO-Nlcie3uUAluPaI53yRarCdE", + "https://drive.google.com/uc?export=download&id=1Pk27Z4LX2y2rHcvtY5VJiF9hJoowY9HR", + "https://drive.google.com/uc?export=download&id=1FBJ6kZFZPmYZSk3vHz7ECfqdA4yhF2k0", + "https://drive.google.com/uc?export=download&id=1md55_KQdoTX4HWW6n0RM7AbBfW8XPyGN", + "https://drive.google.com/uc?export=download&id=1KCYrHH1lISPWbA8q7kLX8G7BUsJhlqw9", + "https://drive.google.com/uc?export=download&id=1NYxXQ7UmVjcTdY27WePCJ8iW6HC_l-Ej", + "https://drive.google.com/uc?export=download&id=1SC9OnQcXlkRGt1auBgV_Ez9itpYG2ixh", + "https://drive.google.com/uc?export=download&id=1D_ODRaSij_KQemlzrQS9B-h3RM6yZ680", + "https://drive.google.com/uc?export=download&id=1fZgMyISANhpOLcfo5HVht5OKolhrHQoD", + "https://drive.google.com/uc?export=download&id=1glf5NdpxDWcfPVyQdYv1HleNmJ6-8WN8", + "https://drive.google.com/uc?export=download&id=1trMuw_ezC58iMwR4umtRKzRdK0_VsI7Y", + "https://drive.google.com/uc?export=download&id=1mDCJvrIUHfPgi1CH-xTxSZbaOQPXfF8S", + "https://drive.google.com/uc?export=download&id=1mNKuaSICDDGL8pq26oR07nIFVWfTCjpu", + "https://drive.google.com/uc?export=download&id=1oX2VgqglgDilll77xURzPTrvwEjx5B4e", + "https://drive.google.com/uc?export=download&id=1usstpJwO6NkxCQiPiEW9yj0H4julH0kO", + "https://drive.google.com/uc?export=download&id=1VLGzoJM52Q8WYviX6DLg9okDRd16lE75", + "https://drive.google.com/uc?export=download&id=1IGUZduyBGTGSq27gkxiLRkuHYNjC7fXv", + "https://drive.google.com/uc?export=download&id=1IGUZduyBGTGSq27gkxiLRkuHYNjC7fXv", + "https://drive.google.com/uc?export=download&id=1Jgiy1cI4CIpZeHL3-YaUgcX1UzahaDwN", + "https://drive.google.com/uc?export=download&id=1sIH4GwHfpny684720z1gFulQCbbjCuQo", + "https://drive.google.com/uc?export=download&id=1E1G1ecSy_DyOWmQPVJI8EIWFcerdfsqt", + "https://drive.google.com/uc?export=download&id=1zKzL9yoHasu5R2sii2cJLomB81e3liYp", + "https://drive.google.com/uc?export=download&id=1q51lljCcR_V7uCR_Umhst-2mnUpjriOA", + "https://drive.google.com/uc?export=download&id=1TVKeHZuGWY3qVkNtXM53Uploac4uAGPr", + "https://drive.google.com/uc?export=download&id=1fMk8VvH5w-FsIZC2kcB895DZiu1I9XOh", + "https://drive.google.com/uc?export=download&id=1_4PSnfa4fhnXCZI8OgTYE55jgnUJjlPF", + "https://drive.google.com/uc?export=download&id=1A2ODenh6zIXGKyOFMwAgWjnuPVzvnynJ", + "https://drive.google.com/uc?export=download&id=19lqOz0X7AD7-NEXtrSUDR3wR23yOXZ50", + "https://drive.google.com/uc?export=download&id=1A5GBE8n7cf-yGqGld8aSs-XH_KnLw5dH", + "https://drive.google.com/uc?export=download&id=1A0AArSzPLEPb97RAVxzLj31e2kj5nsng", + "https://drive.google.com/uc?export=download&id=18NZdfVvl5s7mmUn5CLNrp01a1FElGNnf", + "https://drive.google.com/uc?export=download&id=19HDrVFvfucxwJp-jj4kM2y7l1EQSnASJ", + "https://drive.google.com/uc?export=download&id=18Npt8nIYXO1U5NxStVc3lSGHJwVmeN5X", + "https://drive.google.com/uc?export=download&id=18Npt8nIYXO1U5NxStVc3lSGHJwVmeN5X", + "https://drive.google.com/uc?export=download&id=19mqNuC27aOOf5xy4B_cOG7W6stXHRzZk", + "https://drive.google.com/uc?export=download&id=19zPRVVsggM9BrNy_29XYZyynorUaCKjs", + "https://drive.google.com/uc?export=download&id=1AQaugSzhoeAel0oMnufbN9VKYQVyixb2", + "https://drive.google.com/uc?export=download&id=1A7iERNZgbq79MoQdJOapkY3KCkgGlB-r", + "https://drive.google.com/uc?export=download&id=11BKiK_walhjdbj5flOK-mup5OgIoUUxD", + "https://drive.google.com/uc?export=download&id=1T2taH3NRhpyPv9k6GcyZlnXpppurdh9Q", + "https://drive.google.com/uc?export=download&id=1k3-5p6Ztada4jlq1-F2IqiulF85N1Gi_", + "https://drive.google.com/uc?export=download&id=1pPGVwrgXaJSI7qZUWceuR-opoJG7e9pQ", + "https://drive.google.com/uc?export=download&id=1BS0tQ8Izj58ovY9AxuAAEOo1nNFQJKDD", + "https://drive.google.com/uc?export=download&id=15SSw9s82Ew_JKB91Fj1H-Wx5pkNimwJS", + "https://drive.google.com/uc?export=download&id=1HdeX8SDFMc1LFIP9ZlFId0YhAduVFgDZ", + "https://drive.google.com/uc?export=download&id=1o-Iuc5AV-BNum22QiMLqczBrGcIrL9xs", + "https://drive.google.com/uc?export=download&id=1Rkg45T5JQu_wM-dpyQuq8WaZCjk8DuAh", + "https://drive.google.com/uc?export=download&id=1YbWl_Ho147Lg0kfHxUzFZcaO4VjmKNCX", + "https://drive.google.com/uc?export=download&id=1fLnHrlE5YCv8yHdxGu_P7xqHRFmcMsAQ", + "https://drive.google.com/uc?export=download&id=16MvwDvg57x5FIUcK_AKBcv1AmVTg4Fyz", + "https://drive.google.com/uc?export=download&id=1tCBoUOHGpmQjN53OiOUGWODrMnmvdwPT", + "https://drive.google.com/uc?export=download&id=1S8XilQLVBM4kTNuWQE0KhLTOVMAgrQYL", + "https://drive.google.com/uc?export=download&id=17tWryBlk3zFbsn1vrJzt7GWT56PKfQAJ", + "https://drive.google.com/uc?export=download&id=1F3LsUW-hD8WvFbjqp1a9tb2QJ49BcA9Q", + "https://drive.google.com/uc?export=download&id=14cC6V52SsN2t3pX1lCTb0onPFRGTRCa_", + "https://drive.google.com/uc?export=download&id=1DdJGIecb5GK2A1yJXTPjHH9hpIhsKCfx", + "https://drive.google.com/uc?export=download&id=15cVezpny2P4iKdt_N3yHnIGj37Dpneh_", + "https://drive.google.com/uc?export=download&id=1N6ZDDlChmuS2LH0B9TkaiFbNZZt0Zd96", + "https://drive.google.com/uc?export=download&id=1RLu6EnaxCqmksNAVxn-X8BofV-qISmtA", + "https://drive.google.com/uc?export=download&id=11SKe8gRkLZ-YY_7t8oWK6nbO4SOS45aN", + "https://drive.google.com/uc?export=download&id=1hZ0m0mCKMxwZarNA1mi9_RXt9XhAxYS-", + "https://drive.google.com/uc?export=download&id=1305HBw0refYVQ0NkoOobq2EOTWEgRFkY", + "https://drive.google.com/uc?export=download&id=1WN7lw5lLFP20a91LcYaPa-GQvgD-hTiH", + "https://drive.google.com/uc?export=download&id=1z3k7-tTo2BOW2KC1zocHbPnTShrRMvuy", + "https://drive.google.com/uc?export=download&id=1qd6VfUUlA0Lz2G8URmpW83mnoMp7x4FH", + "https://drive.google.com/uc?export=download&id=1gP_gdzi_duFpMuJ5yIMDzxBHLxjD7KfF", + "https://drive.google.com/uc?export=download&id=1f8BuRtjl6Kn1SQ9CCf-hqZJT3IEiDAMz", + "https://drive.google.com/uc?export=download&id=1oE-zuYm9HCIZZz59gIEgsR33X8PaT9w4", + "https://drive.google.com/uc?export=download&id=19yqoToQH9YRCq0K47BfK-ktbmYzZkXCy", + "https://drive.google.com/uc?export=download&id=1XlGmGeVYb_82Xo2ni92iS8otYESRhjc7", + "https://drive.google.com/uc?export=download&id=1Cz0DpSGcqmvd4Cqn29SVn7T53aYkj9cq", + "https://drive.google.com/uc?export=download&id=1eMSrzSz6-pXblA4R-KizNo2kUfQrGGo0", + "https://drive.google.com/uc?export=download&id=1hl1c2fLupZE_j6SOBy5VIK1qCHu4hdWH", + "https://drive.google.com/uc?export=download&id=1HlEMGyEfDu8kPW3cw4QAhaz6PLU6gLOh", + "https://drive.google.com/uc?export=download&id=13iiT-5nMKqFZg6d60uIrzTdYY6mZaG0V", + "https://drive.google.com/uc?export=download&id=1WBqWf986rhT52rBmzCHDxFagjoJw50cu", + "https://drive.google.com/uc?export=download&id=1gGLGkvVz9d4rOuzR9-O-SvRBKmNWu08T", + "https://drive.google.com/uc?export=download&id=1-RdOA1WdJzuGyWFCmGINDDE8XH_8NDOp", + "https://drive.google.com/uc?export=download&id=1a9scbBxtX1UU64JGE7I-OAP5PLD5eau2", + "https://drive.google.com/uc?export=download&id=1qz25P1RB0ivLfFSNHPD9HM0q3DWUzbRb", + "https://drive.google.com/uc?export=download&id=1JQTtAzOm2e1Q4PdCBIL8sd18eCVmf3lS", + "https://drive.google.com/uc?export=download&id=1QZ0VtiRutnLrUNtqFpZvB9FBoCkyW69I", + "https://drive.google.com/uc?export=download&id=1vrsGVwdPPaJ0-w3tOwQP8ay5wz4hQviv", + "https://drive.google.com/uc?export=download&id=1MsiiAtXdeSN20RYsEs27lY-OplZ04b1i", + "https://drive.google.com/uc?export=download&id=1sIir3HhbBHbFbuRiN9S3ql09z5dFE_O0", + "https://drive.google.com/uc?export=download&id=1w2HOc1oVBvOg1looLT2bG8wUnTGiIse5", + "https://drive.google.com/uc?export=download&id=1tk0wQfmAHjvaZQgVHH26-reE_OOpHWS0", + "https://drive.google.com/uc?export=download&id=1pxtZnZTBlxi5R2UOuEsnwj_L8ALN1_s-", + "https://drive.google.com/uc?export=download&id=1FAsCpN81lNFsJ5hZVQLjj1IqxaKRqMMW", + "https://drive.google.com/uc?export=download&id=165vcnw4LWBT9jdTZmcFpWt_7hKcVSpsr", + "https://drive.google.com/uc?export=download&id=1ZrqCO5AhAYnhPGQ1Gp4MJEzWLQ2akgkh", + "https://drive.google.com/uc?export=download&id=1Lg3IlF9-KanVw4wuSEmcvKfsQqTtKM2G", + "https://drive.google.com/uc?export=download&id=1b2bL3zfkcbCcQRwbvcSY0wI4t3HRJoGK", + "https://drive.google.com/uc?export=download&id=1XTTs0Inti6GWBln7a6L10I7PJLuIWXFy", + "https://drive.google.com/uc?export=download&id=1DVgcObXACEVUXAHwZMTyN39d1QBHK3eC", + "https://drive.google.com/uc?export=download&id=1J6l_S_-Xt4b5KeU7MWkCFfbwftVbiENa", + "https://drive.google.com/uc?export=download&id=13diMuYAVa99eO7GVS_OtZ4CfsVAd0E48", + "https://drive.google.com/uc?export=download&id=1Chne4lr3NkAGtm31Qbxh2EWHomj75_Ma", + "https://drive.google.com/uc?export=download&id=1bVdNL2MsJQ3JdKA4bx-8kKGxmxgxQn71", + "https://drive.google.com/uc?export=download&id=10m0EL9COdCyBSrvdVK3iblTutu4tzRi6", + "https://drive.google.com/uc?export=download&id=1UECWqt86xn_NkuHFUEeUkOtrYqlC46Av", + "https://drive.google.com/uc?export=download&id=1m7D4a15641FW3513ZO_-CeJ3wKRZ27EH", + "https://drive.google.com/uc?export=download&id=1Ey3vk4SBGbn3xvrqAGBLfC5x7MAM7stK", + "https://drive.google.com/uc?export=download&id=16hudg17uX8-dZy5IVnh05GaqoNpPKgKr", + "https://drive.google.com/uc?export=download&id=1OtgC2ngELtEXORixsByL1Ybqh5GctgQ4", + "https://drive.google.com/uc?export=download&id=1uGsaWFbEjmDbzANGsGWxRpAtAnsEhAea", + "https://drive.google.com/uc?export=download&id=1BUSrp6oHTSGauamWn5E5ZtmnmPJ-L-LH", + "https://drive.google.com/uc?export=download&id=1ZLxdXrjGKUwe3mUA8DFwrzrp_lRzGrj5", + "https://drive.google.com/uc?export=download&id=1_2kM9E1mpcq4VGVsYWKWmczNlTN6Hlio", + "https://drive.google.com/uc?export=download&id=1gaLR5mTXGmerWhu3rMqdQ_gak0Igq5IE", + "https://drive.google.com/uc?export=download&id=1m0IQx_MxPaVuKgFfu-alzx-UquNPnsvl", + "https://drive.google.com/uc?export=download&id=1ICZdMRgAzccFnRoTVa8q5Yn8filjAZ4b", + "https://drive.google.com/uc?export=download&id=1DM1IaxJ6CeQ8RS-cqCEnvMn37UG-PXYF", + "https://drive.google.com/uc?export=download&id=1QSzMplL_Y4ZEauySHYfF7PsDooSkY5YH", + "https://drive.google.com/uc?export=download&id=1wiUj4NYzxheGsq5sze1pfJZ1T7ZLieMJ", + "https://drive.google.com/uc?export=download&id=1D-x924no93QbiN8txW1cadAvhkUySB58", + "https://drive.google.com/uc?export=download&id=17QKudotHF_1vlMckMTf0dPvLBlpoL0wk", + "https://drive.google.com/uc?export=download&id=1xUB3KGUwSzsY6V1qESGQyXIaDlb12RC8", + "https://drive.google.com/uc?export=download&id=1SGRsnaqwTAUHRKfgbQ1peQ0CtJV2ZMZN", + "https://drive.google.com/uc?export=download&id=1M7Olc8GUNuP6RIb4_s8ADeu7_OpdV6Pk", + "https://drive.google.com/uc?export=download&id=1aZfctVIHBvipyOEZoeZOAvab_UjX36pS", + "https://drive.google.com/uc?export=download&id=1OItHNXYdwipBDkV81wz2R3DiH4nFn57k", + "https://drive.google.com/uc?export=download&id=1YYK9wKtY8L8AoUaLi0nvoMW_YcRUZzI5", + "https://drive.google.com/uc?export=download&id=1k5p5yDocov-ZXFoKSdM9BMnMcHhNTjCA", + "https://drive.google.com/uc?export=download&id=1XtuHzMJU00OlmWeazNkuiHBWY1wZz1qS", + "https://drive.google.com/uc?export=download&id=1RU2lgYg-hNWkfYHsLlim_5QY2WKnO-_s", + "https://drive.google.com/uc?export=download&id=1PKpK_-UvSHuow3b5i8W0TIMehhJBfPAL", + "https://drive.google.com/uc?export=download&id=1HVTF6emzw9BqIrby4Myg17H2vtAOR3LI", + "https://drive.google.com/uc?export=download&id=1rm-zSBnWnw3n8OzBch7tS-pgh54J17v_", + "https://drive.google.com/uc?export=download&id=1sUBJJQpmF8JQRXmq7_XFghYdZRMDCEzU", + "https://drive.google.com/uc?export=download&id=18ICsmkZsn5UbP3g9dxOo-blNe2HH8yay", + "https://drive.google.com/uc?export=download&id=1kAtDcA5U-cRtskrMmxD3xXC_7v0Yczln", + "https://drive.google.com/uc?export=download&id=1A2wf79EVEhVSWfzxbcJGJf5PHuvBdqDE", + "https://drive.google.com/uc?export=download&id=1rSXGagJAMy5ovpN1JNvp7tF1HpHQvo_x", + "https://drive.google.com/uc?export=download&id=1OGwRlpBQ24EeHclEtIW0jV6c4gP-CQXD", + "https://drive.google.com/uc?export=download&id=1J0MtPjkQWbbgIqujVdl59vPZRK4-K-vv", + "https://drive.google.com/uc?export=download&id=14vUVZa6p4pNpUeB98unlQG46s6-OjD_l", + "https://drive.google.com/uc?export=download&id=14FgYCRFiQ4iO0xjSI5GA1JOk8nukiPY_", + "https://drive.google.com/uc?export=download&id=1ggmmi0pV6AlePPq7bvjVLmMeBOzbtaG2", + "https://drive.google.com/uc?export=download&id=1Wgble8e6q51PBrIprwe05PNWBv_u5jtC", + "https://drive.google.com/uc?export=download&id=1Eevj2y7UMWqMyp1ZOUjwcZeP0-6AwLlt", + "https://drive.google.com/uc?export=download&id=1KG3v8LCv3G3gcdHyLqf9h_8L6uj2wRbG", + "https://drive.google.com/uc?export=download&id=1BO31sM78aDIKlSMAc7cx0EZgKR_9MONd", + "https://drive.google.com/uc?export=download&id=1dmVXgkcwREpEbc3wuBjmyA43I2Zs6dTW", + "https://drive.google.com/uc?export=download&id=1vvL5NqPlH7sLjhUwlf9NfJge4vTaB2R-", + "https://drive.google.com/uc?export=download&id=1CS0Sq2Ij91zQDlGpmsNSzrl6hf4nKNR-", + "https://drive.google.com/uc?export=download&id=1kNK8jmNDlrFbrnKCqtQeWU0cNJnsCbLg", + "https://drive.google.com/uc?export=download&id=1kYapHPL_a31TeFFKNbCOBp6OzbSfsPIr", + "https://drive.google.com/uc?export=download&id=17jP_cJVzlsQJI3-U4FTsClyc9OfME9iP", + "https://drive.google.com/uc?export=download&id=1-4qwbcpd0dTfIfHns9mGMngjs3Ll0qat", + "https://drive.google.com/uc?export=download&id=1PeBv0gQ8HE1pGCfFxl-xy5YWfLF3OQwe", + "https://drive.google.com/uc?export=download&id=1nd2MtLzaig5atnKc7L3FPh7K52RT2lRP", + "https://drive.google.com/uc?export=download&id=17q_8y8ekx6j1pVdkBgrrUxnxqkQiX1aF", + "https://drive.google.com/uc?export=download&id=1v5CzdRVbW5D5uhGZQpUsckSl7ClmDGZx", + "https://drive.google.com/uc?export=download&id=1mTQmG9bA4pVYRMEqxr5vE9G61gTZMFMI", + "https://drive.google.com/uc?export=download&id=18ySI2JfWU9bFFyqtHdp86H5JYVwNP7r8", + "https://drive.google.com/uc?export=download&id=1u-N_0TbLRrgy5fLS1zsC5vdCzX5ll38d", + "https://drive.google.com/uc?export=download&id=1ChehrBzGKlcwxOtrQDZIGWE2WprI09dn", + "https://drive.google.com/uc?export=download&id=1Y1-EcGhdqezf9sfSNB_kr2VI2DR1huT5", + "https://drive.google.com/uc?export=download&id=1mEz0I6J8-l_3Ro9owFbT8w8nVhRkrhY2", + "https://drive.google.com/uc?export=download&id=1I3aLa6qDJm014RQUMX7_nDaZk9IvNr8n", + "https://drive.google.com/uc?export=download&id=12mWGHuz7Mz6FyhTTAC0KXX21p67nEBQ4", + "https://drive.google.com/uc?export=download&id=1Pq562EwTzzf_pKMD16CJE-zlfwPqlWEv", + "https://drive.google.com/uc?export=download&id=1tTiFwFsXTWlJ-XFADdEwhBGgDDcTlXp4", + "https://drive.google.com/uc?export=download&id=1U361xb_t4YeZp1nljtYAqyzUEcUPDBfP", + "https://drive.google.com/uc?export=download&id=1AkpoiSORsi8aJOwf_Zrfiatxwivxc_Q5", + "https://drive.google.com/uc?export=download&id=1ZKpZKnRrWd2ulJUgSz9EBAR1vAgvfOTj", + "https://drive.google.com/uc?export=download&id=1dnhJolTdhppg2axPU5uPpshVj2aJIXGv", + "https://drive.google.com/uc?export=download&id=1ISt4eardedt_jzt5DG6yUZYNewlgeA1v", + "https://drive.google.com/uc?export=download&id=1b1y85C3VH9RqnzPfHizJPHgcpA1xzzJH", + "https://drive.google.com/uc?export=download&id=1bgE6x9WFA40lpOyvx_j95Vwlr2ATeKwD", + "https://drive.google.com/uc?export=download&id=11K-4AIKjATdEs2KVjs80GYES-t7tfbZF", + "https://drive.google.com/uc?export=download&id=1lLm_Vgz9KuzLLTSs45UNy0_ciK1TSMEi", + "https://drive.google.com/uc?export=download&id=1f6tW4wCp_VcSuEH2VNlUR65F7kxjunPl", + "https://drive.google.com/uc?export=download&id=1S1AvajHWJbUz8Ai0ryllbDXJsxj4IXl4", + "https://drive.google.com/uc?export=download&id=1pzPgxzExBWOw9hBR198N_vJIQOMR7T38", + "https://drive.google.com/uc?export=download&id=1MU5y4s5N6U0TWl7jGNUiGiaX30IWtcmr", + "https://drive.google.com/uc?export=download&id=1U7lWd8_Yt6v1gBpAB8QjFnbiEJhAlpwf", + "https://drive.google.com/uc?export=download&id=1lagvs5D3NGop-JqUqyD_UoXiscJ94s6T", + "https://drive.google.com/uc?export=download&id=1RhHqKseLdnl8wJJ8wJldDCTH0XBE5PDN", + "https://drive.google.com/uc?export=download&id=1EUteOHbxHJL5yJG6gOPFNGMEpoyXD28i", + "https://drive.google.com/uc?export=download&id=1OjucETdkkMnsMS8OJDruD4s0AfYET0ed", + "https://drive.google.com/uc?export=download&id=15dk9a6x198DLvcTn73FpWQS8GMyrTF7l", + "https://drive.google.com/uc?export=download&id=1tSvNO_BmFEoZjKulGOo5yJgwkgoB1Tqm", + "https://drive.google.com/uc?export=download&id=15s0vQ5a-hMhjPAGrNccVwwal4OKu2J_O", + "https://drive.google.com/uc?export=download&id=1F3j_cN9po0wb9iCt-hL0wbPVxYeDjJuO", + "https://drive.google.com/uc?export=download&id=1UDBz-Sia1PIIdq-6JAr0e_WkEOrYg9mT", + "https://drive.google.com/uc?export=download&id=10iOSOE3his6hzLDJhjsdPcsxjnw9sVZk", + "https://drive.google.com/uc?export=download&id=1plwq0F-XlNIxp87lakJFUA4hlxhtwveo", + "https://drive.google.com/uc?export=download&id=1tbuuBQcFISOPpxNGQ2Zu45p5b_mSF3ZA", + "https://drive.google.com/uc?export=download&id=1ja4anO4i8sBUy5387LfF397FLGO9pPTZ", + "https://drive.google.com/uc?export=download&id=1nZ4vpR2hh_Y_T_h7PuE_dFaVedQ8SAps", + "https://drive.google.com/uc?export=download&id=12Fl88qCBJw2gw9opZIVeUzn8kx2aFRA9", + "https://drive.google.com/uc?export=download&id=1Ypb6KN80YMA2u5ayJotxvOafZYcdAyG9", + "https://drive.google.com/uc?export=download&id=1l3B9LiRqwZDDhPdhkPZKpPvbeC8pasMW", + "https://drive.google.com/uc?export=download&id=1t_FDpyUSWELHTyf7qkwsIVGDHV1duAf9", + "https://drive.google.com/uc?export=download&id=1ZKgJUhqH3A66pGtaHOxxI4liGVad8759", + "https://drive.google.com/uc?export=download&id=1iY8QuxD-XN0L5FJfagdss_9L4QQyAYAM", + "https://drive.google.com/uc?export=download&id=1y0_z5CqgmdJgSYNWkXo-IZ6UygssG3qL", + "https://drive.google.com/uc?export=download&id=1ueXeDajTk0nVq1k-8NO3gA4sx6Dp0Qr_", + "https://drive.google.com/uc?export=download&id=1CqS3WEdfmZaUuY9DLkWcP6_HCkP-O0YP", + "https://drive.google.com/uc?export=download&id=1kFxfd5Kqck614oLmOErmDF-e2hU-s9Ge", + "https://drive.google.com/uc?export=download&id=1Y_zCu12BQlnu7jmRtaHxo08jZG-oC22G", + "https://drive.google.com/uc?export=download&id=14QalCL2T6idQJUe5iFPzGBNNIZsdAF0b", + "https://drive.google.com/uc?export=download&id=1kLnNiLP2gx7mHvbHzprJDwSwBM-8Ukzt", + "https://drive.google.com/uc?export=download&id=1DpEpbXZq7INIPAXO_qn6PhvHtz30v2zy", + "https://drive.google.com/uc?export=download&id=1-YVI9jJQxsZjxf4idYst0zCTikPNJeeQ", + "https://drive.google.com/uc?export=download&id=1yIBZiv3N9Phe7odJG-IrXryLyQTvYJkc", + "https://drive.google.com/uc?export=download&id=1wrDfSFZ41b0QP8abGHH_wEiBz0TuikCZ", + "https://drive.google.com/uc?export=download&id=1EsTRAep8i87xmqzaFyWOIlZ9jhUopnrQ", + "https://drive.google.com/uc?export=download&id=1d1hxX2zr-4yn-XYIzV6e_p91GJf78nFF", + "https://drive.google.com/uc?export=download&id=12fflpUUqC0QCMk0hiwL6tf29KgZpMp3I", + "https://drive.google.com/uc?export=download&id=1Gweiyvkr4v40SZAUjs0C3ImmoSFm9KSj", + "https://drive.google.com/uc?export=download&id=11pFZiJUT-Iv71-YMkmOL59hY7j3phBDH", + "https://drive.google.com/uc?export=download&id=11PnoqPLH5yjggAG1fiwcgSWrd6jY3net", + "https://drive.google.com/uc?export=download&id=1Z8rlFimEVVJbgK_Myd8CCjisF6Eq_5Vf", + "https://drive.google.com/uc?export=download&id=1z_MIHtMbnfZGYAdOS1feuq3C0hgaYP-s", + "https://drive.google.com/uc?export=download&id=1DJk9XRq2hY2GVpfnanuk6t9Z5gIw5-Dk", + "https://drive.google.com/uc?export=download&id=1bIH5U6SERbQMD6oIINK24Inn8AxA_qQA", + "https://drive.google.com/uc?export=download&id=1pPQJr2bPIOBjqci5IWZR9XAtgCidACKL", + "https://drive.google.com/uc?export=download&id=1n8R7fO4NxkkvmK4rXRlb7kHb8JwUykFi", + "https://drive.google.com/uc?export=download&id=1-MzkP7ZeDbwj0b3rxZvrHllQqKmVwCI7", + "https://drive.google.com/uc?export=download&id=1ylZKsOXXFHjxcUwl6OJb17ouWSaESM69", + "https://drive.google.com/uc?export=download&id=1C-hz0eDnqjGRaYUQQrwE0BKD8QC6oUSN", + "https://drive.google.com/uc?export=download&id=1Bqic0ZpyK2Qcx-kGd5vPyb0_rDXk4Ui_",// Add more video links here + ]; + + const availableVideos = link.filter(video => !this.sentVideos.includes(video)); + + if (availableVideos.length === 0) { + this.sentVideos = []; + } + + const randomIndex = Math.floor(Math.random() * availableVideos.length); + const randomVideo = availableVideos[randomIndex]; + + this.sentVideos.push(randomVideo); + + if (senderID !== null) { + message.reply({ + body: 'ENJOY..🤍', + attachment: await global.utils.getStreamFromURL(randomVideo), + }); + + setTimeout(() => { + api.unsendMessage(loadingMessage.messageID); + }, 5000); + } + }, +}; diff --git a/scripts/cmds/lyrics.js b/scripts/cmds/lyrics.js new file mode 100644 index 0000000000..fe5857e502 --- /dev/null +++ b/scripts/cmds/lyrics.js @@ -0,0 +1,84 @@ +const axios = require("axios"); +const fs = require("fs-extra"); +const path = require("path"); +const ytdl = require("@neoxr/ytdl-core"); +const yts = require("yt-search"); + +module.exports = { + config: { + name: "lyrics", + version: "1.0", + author: "KAKASHI", + countDown: 0, + role: 0, + shortDescription: { + en: "Get lyrics for a song", + }, + longDescription: { + en: "This command allows you to get the lyrics for a song. Usage: !lyrics ", + }, + category: "music", + guide: { + en: "{prefix}lyrics ", + }, + }, + + onStart: async function ({ api, event, args }) { + const songName = args.join(" "); + if (!songName) { + api.sendMessage( + "⛔ 𝗜𝗡𝗩𝗔𝗟𝗜𝗗 𝗧𝗜𝗧𝗟𝗘\n\n❁ Please provide a song name!", + event.threadID, + event.messageID + ); + return; + } + + try { + // Fetch lyrics + const lyricsResponse = await axios.get( + `https://lyrics-api.replit.app/aryan?songName=${encodeURIComponent(songName)}` + ); + const { lyrics, title, artist, image } = lyricsResponse.data; + + // Fetch song + const searchResults = await yts(songName); + if (!searchResults.videos.length) { + api.sendMessage("❌ 𝗦𝗢𝗡𝗚 𝗡𝗢𝗧 𝗙𝗢𝗨𝗡𝗗\n\n❁ Sorry, song not found!", event.threadID, event.messageID); + return; + } + + const video = searchResults.videos[0]; + const videoUrl = video.url; + const stream = ytdl(videoUrl, { filter: "audioonly" }); + const fileName = `music.mp3`; + const filePath = path.join(__dirname, "tmp", fileName); + + stream.pipe(fs.createWriteStream(filePath)); + + stream.on("response", () => { + console.info("[DOWNLOADER]", "Starting download now!"); + }); + + stream.on("info", (info) => { + console.info("[DOWNLOADER]", `Downloading ${info.videoDetails.title} by ${info.videoDetails.author.name}`); + }); + + stream.on("end", async () => { + const audioStream = fs.createReadStream(filePath); + let message = `📌 𝗛𝗘𝗥𝗘 𝗜𝗦 𝗟𝗬𝗥𝗜𝗖𝗦\n\n🎧 𝗧𝗜𝗧𝗟𝗘\n➪ ${title}\n👑 𝗔𝗥𝗧𝗜𝗦𝗧 \n➪ ${artist} \n\n🎶 𝗟𝗬𝗥𝗜𝗖𝗦\n➪ ${lyrics}`; + let attachment = await global.utils.getStreamFromURL(image); + + api.sendMessage({ body: message, attachment }, event.threadID, (err, info) => { + let id = info.messageID; + api.sendMessage({ attachment: audioStream }, event.threadID, () => { + api.setMessageReaction("✅", id, () => {}, true); + }); + }); + }); + } catch (error) { + console.error(error); + api.sendMessage("Sorry, there was an error getting the lyrics and song!", event.threadID, event.messageID); + } + }, +}; diff --git a/scripts/cmds/media.js b/scripts/cmds/media.js new file mode 100644 index 0000000000..22c6ff6941 --- /dev/null +++ b/scripts/cmds/media.js @@ -0,0 +1,100 @@ +const axios = require("axios"); +const fs = require('fs-extra'); +const path = require('path'); +const { getStreamFromURL, shortenURL, randomString } = global.utils; + +async function video(api, event, args, message) { + api.setMessageReaction("🕢", event.messageID, (err) => {}, true); + try { + let title = ''; + let shortUrl = ''; + + const extractShortUrl = async () => { + const attachment = event.messageReply.attachments[0]; + if (attachment.type === "video" || attachment.type === "audio") { + return attachment.url; + } else { + throw new Error("Invalid attachment type."); + } + }; + + let videoId = ''; + if (event.messageReply && event.messageReply.attachments && event.messageReply.attachments.length > 0) { + shortUrl = await extractShortUrl(); + const musicRecognitionResponse = await axios.get(`https://youtube-music-sooty.vercel.app/kshitiz?url=${encodeURIComponent(shortUrl)}`); + title = musicRecognitionResponse.data.title; + const searchResponse = await axios.get(`https://youtube-kshitiz.vercel.app/youtube?search=${encodeURIComponent(title)}`); + if (searchResponse.data.length > 0) { + videoId = searchResponse.data[0].videoId; + } + + shortUrl = await shortenURL(shortUrl); + } else if (args.length === 0) { + message.reply("Please provide a video name or reply to a video or audio attachment."); + return; + } else { + title = args.join(" "); + const searchResponse = await axios.get(`https://youtube-kshitiz.vercel.app/youtube?search=${encodeURIComponent(title)}`); + if (searchResponse.data.length > 0) { + videoId = searchResponse.data[0].videoId; + } + + const videoUrl = await axios.get(`https://youtube-kshitiz.vercel.app/download?id=${encodeURIComponent(videoId)}`); + if (videoUrl.data.length > 0) { + shortUrl = await shortenURL(videoUrl.data[0]); + } + } + + if (!videoId) { + message.reply("No video found for the given query."); + return; + } + + const downloadResponse = await axios.get(`https://youtube-kshitiz.vercel.app/download?id=${encodeURIComponent(videoId)}`); + if (downloadResponse.data.length === 0) { + message.reply("Failed to retrieve download link for the video."); + return; + } + + const videoUrl = downloadResponse.data[0]; + const writer = fs.createWriteStream(path.join(__dirname, "cache", `${videoId}.mp4`)); + const response = await axios({ + url: videoUrl, + method: 'GET', + responseType: 'stream' + }); + + response.data.pipe(writer); + + writer.on('finish', () => { + const videoStream = fs.createReadStream(path.join(__dirname, "cache", `${videoId}.mp4`)); + message.reply({ body: `📹 Playing: ${title}\nDownload Link: ${shortUrl}`, attachment: videoStream }); + api.setMessageReaction("✅", event.messageID, () => {}, true); + }); + + writer.on('error', (error) => { + console.error("Error:", error); + message.reply("error"); + }); + } catch (error) { + console.error("Error:", error); + message.reply("error"); + } +} + +module.exports = { + config: { + name: "media", + version: "1.0", + author: "Kshitiz", + countDown: 10, + role: 0, + shortDescription: "play video from youtube", + longDescription: "play video from youtube support audio recognition.", + category: "music", + guide: "{p} video videoname / reply to audio or video" + }, + onStart: function ({ api, event, args, message }) { + return video(api, event, args, message); + } +}; diff --git a/scripts/cmds/owner.js b/scripts/cmds/owner.js new file mode 100644 index 0000000000..bd9a7e6de1 --- /dev/null +++ b/scripts/cmds/owner.js @@ -0,0 +1,60 @@ +const axios = require('axios'); +const fs = require('fs'); +const path = require('path'); + +module.exports = { +config: { + name: "owner", + aurthor:"Tokodori",// Convert By Goatbot Tokodori + role: 0, + shortDescription: " ", + longDescription: "𝐋𝐨𝐚𝐝𝐢𝐧𝐠 𝐎𝐰𝐧𝐞𝐫'𝐬 𝐈𝐧𝐟𝐨𝐫𝐦𝐚𝐭𝐢𝐨𝐧'", + category: "admin", + guide: "{pn}" +}, + + onStart: async function ({ api, event }) { + try { + const ownerInfo = { + name: '𝐈𝐭𝐚𝐜𝐡𝐢 𝐌𝐚𝐦𝐚', + gender: '𝐌𝐚𝐥𝐞', + age: '28', + facebookLink: 'https://www.facebook.com/profile.php?id=100074772216830', + }; + + const bold = 'https://i.imgur.com/DDO686J.mp4'; // Replace with your Google Drive videoid link https://drive.google.com/uc?export=download&id=here put your video id + + const tmpFolderPath = path.join(__dirname, 'tmp'); + + if (!fs.existsSync(tmpFolderPath)) { + fs.mkdirSync(tmpFolderPath); + } + + const videoResponse = await axios.get(bold, { responseType: 'arraybuffer' }); + const videoPath = path.join(tmpFolderPath, 'owner_video.mp4'); + + fs.writeFileSync(videoPath, Buffer.from(videoResponse.data, 'binary')); + + const response = ` +𝐎𝐰𝐧𝐞𝐫 𝐈𝐧𝐟𝐨𝐫𝐦𝐚𝐭𝐢𝐨𝐧:🧾 +Name: ${ownerInfo.name} +Gender: ${ownerInfo.gender} +Age: ${ownerInfo.age} +Facebook: ${ownerInfo.facebookLink} +`; + + + await api.sendMessage({ + body: response, + attachment: fs.createReadStream(videoPath) + }, event.threadID, event.messageID); + + if (event.body.toLowerCase().includes('ownerinfo')) { + api.setMessageReaction('🚀', event.messageID, (err) => {}, true); + } + } catch (error) { + console.error('Error in ownerinfo command:', error); + return api.sendMessage('An error occurred while processing the command.', event.threadID); + } +}, +}; diff --git a/scripts/cmds/pastebin.js b/scripts/cmds/pastebin.js new file mode 100644 index 0000000000..db67b06605 --- /dev/null +++ b/scripts/cmds/pastebin.js @@ -0,0 +1,59 @@ +const PastebinAPI = require('pastebin-js'); +const fs = require('fs'); +const path = require('path'); + +module.exports = { + config: { + name: "pastebin", + version: "1.0", + author: "SANDIP", + countDown: 5, + role: 2, + shortDescription: { + en: "Upload files to pastebin and sends link" + }, + longDescription: { + en: "This command allows you to upload files to pastebin and sends the link to the file." + }, + category: "Utility", + guide: { + en: "To use this command, type !pastebin . The file must be located in the 'cmds' folder." + } + }, + + onStart: async function({ api, event, args }) { + const pastebin = new PastebinAPI({ + api_dev_key: 'LFhKGk5aRuRBII5zKZbbEpQjZzboWDp9', + api_user_key: 'LFhKGk5aRuRBII5zKZbbEpQjZzboWDp9', + }); + + const fileName = args[0]; + const filePathWithoutExtension = path.join(__dirname, '..', 'cmds', fileName); + const filePathWithExtension = path.join(__dirname, '..', 'cmds', fileName + '.js'); + + if (!fs.existsSync(filePathWithoutExtension) && !fs.existsSync(filePathWithExtension)) { + return api.sendMessage('File not found!', event.threadID); + } + + const filePath = fs.existsSync(filePathWithoutExtension) ? filePathWithoutExtension : filePathWithExtension; + + fs.readFile(filePath, 'utf8', async (err, data) => { + if (err) throw err; + + const paste = await pastebin + .createPaste({ + text: data, + title: fileName, + format: null, + privacy: 1, + }) + .catch((error) => { + console.error(error); + }); + + const rawPaste = paste.replace("pastebin.com", "pastebin.com/raw"); + + api.sendMessage(`File uploaded to Pastebin: ${rawPaste}`, event.threadID); + }); + }, +}; diff --git a/scripts/cmds/ping.js b/scripts/cmds/ping.js new file mode 100644 index 0000000000..f3c078ab82 --- /dev/null +++ b/scripts/cmds/ping.js @@ -0,0 +1,25 @@ +module.exports = { + config: { + name: "ping", + aliases: ["ms"], + version: "1.0", + author: "Sandu", + role: 0, + shortDescription: { + en: "Displays the current ping of the bot's system." + }, + longDescription: { + en: "Displays the current ping of the bot's system." + }, + category: "System", + guide: { + en: "Use {p}ping to check the current ping of the bot's system." + } + }, + onStart: async function ({ api, event, args }) { + const timeStart = Date.now(); + await api.sendMessage("Checking Bot's ping", event.threadID); + const ping = Date.now() - timeStart; + api.sendMessage(`The current ping is ${ping}ms.`, event.threadID); + } +}; diff --git a/scripts/cmds/reels.js b/scripts/cmds/reels.js new file mode 100644 index 0000000000..b2b446fe0b --- /dev/null +++ b/scripts/cmds/reels.js @@ -0,0 +1,92 @@ +const axios = require('axios'); +const fs = require('fs'); +const path = require('path'); +const os = require('os'); + +async function downloadVideo(url, destination) { + const response = await axios.get(url, { responseType: 'arraybuffer' }); + fs.writeFileSync(destination, Buffer.from(response.data, 'binary')); +} + +module.exports = { + config: { + name: "reels", + aliases: [], + author: "kshitiz", + version: "1.1", + shortDescription: { + en: "View Instagram reels by hashtag", + }, + longDescription: { + en: "View Instagram reels by providing a hashtag and reply with the reel list by number", + }, + category: "FUN", + guide: { + en: "{p}reels [hashtag]", + }, + }, + onStart: async function ({ api, event, args }) { + const hashtag = args[0]; + + if (!hashtag) { + api.sendMessage({ body: 'Please provide a hashtag.\nExample: {p}reels zoro' }, event.threadID, event.messageID); + return; + } + + try { + const response = await axios.get(`https://reels-kshitiz.onrender.com/reels?hashtag=${hashtag}`); + const videoURLs = response.data.videoURLs; + + if (!videoURLs || videoURLs.length === 0) { + api.sendMessage({ body: `No reels found for the hashtag ${hashtag}.` }, event.threadID, event.messageID); + return; + } + + const message = `Choose a reel by replying with its number:\n\n${videoURLs.map((url, index) => `${index + 1}. sid=472314`).join('\n')}`; + api.sendMessage({ body: message }, event.threadID, (err, info) => { + global.GoatBot.onReply.set(info.messageID, { + commandName: 'reels', + messageID: info.messageID, + author: event.senderID, + videoURLs, + }); + }); + } catch (error) { + console.error(error); + api.sendMessage({ body: 'An error occurred while fetching reels.\nPlease try again later.' }, event.threadID, event.messageID); + } + }, + onReply: async function ({ api, event, Reply, args }) { + const { author, commandName, videoURLs } = Reply; + + if (event.senderID !== author || !videoURLs) { + return; + } + + const reelIndex = parseInt(args[0], 10); + + if (isNaN(reelIndex) || reelIndex <= 0 || reelIndex > videoURLs.length) { + api.sendMessage({ body: 'Invalid input.\nPlease provide a valid number.' }, event.threadID, event.messageID); + return; + } + + try { + const selectedVideoURL = videoURLs[reelIndex - 1]; + + const tempVideoPath = path.join(os.tmpdir(), 'reels_video.mp4'); + await downloadVideo(selectedVideoURL, tempVideoPath); + + await api.sendMessage({ + body: `Here is the Instagram reel:`, + attachment: fs.createReadStream(tempVideoPath), + }, event.threadID, event.messageID); + + fs.unlinkSync(tempVideoPath); + } catch (error) { + console.error(error); + api.sendMessage({ body: 'An error occurred while processing the reel.\nPlease try again later.' }, event.threadID, event.messageID); + } finally { + global.GoatBot.onReply.delete(event.messageID); + } + }, +}; diff --git a/scripts/cmds/remini.js b/scripts/cmds/remini.js new file mode 100644 index 0000000000..c3814f62c2 --- /dev/null +++ b/scripts/cmds/remini.js @@ -0,0 +1,59 @@ +const { writeFileSync, createReadStream, existsSync, mkdirSync } = require("fs"); +const { join } = require("path"); +const axios = require("axios"); +const tinyurl = require('tinyurl'); + +module.exports = { + config: { + name: "remini", + aliases: [], + version: "1.0", + author: "Kshitiz", + countDown: 20, + role: 0, + shortDescription: "remini", + longDescription: "enhance the image quality", + category: "tool", + guide: { + en: "{p}remini (reply to image)", + } + + }, + + onStart: async function ({ message, event, api }) { + api.setMessageReaction("🕐", event.messageID, (err) => {}, true); + const { type: a, messageReply: b } = event; + const { attachments: c, threadID: d, messageID: e } = b || {}; + + if (a === "message_reply" && c) { + const [f] = c; + const { url: g, type: h } = f || {}; + + if (!f || !["photo", "sticker"].includes(h)) { + return message.reply("❌ | Reply must be an image."); + } + + try { + const i = await tinyurl.shorten(g); + const { data: j } = await axios.get(`https://ai-tools.replit.app/remini?url=${encodeURIComponent(i)}`, { + responseType: "arraybuffer" + }); + + const k = join(__dirname, "cache"); + if (!existsSync(k)) { + mkdirSync(k, { recursive: true }); + } + + const l = join(k, "remi_image.png"); + writeFileSync(l, Buffer.from(j)); + + message.reply({ attachment: createReadStream(l) }); + } catch (m) { + console.error(m); + message.reply("❌ | Error occurred while enhancing image."); + } + } else { + message.reply("❌ | Please reply to an image."); + } + } +}; diff --git a/scripts/cmds/render.js b/scripts/cmds/render.js new file mode 100644 index 0000000000..0c1d1f1255 --- /dev/null +++ b/scripts/cmds/render.js @@ -0,0 +1,64 @@ +const fs = require("fs"); +const path = require("path"); +const axios = require("axios"); +const tinyurl = require('tinyurl'); + +module.exports = { + config: { + name: "render", + aliases: [], + version: "1.0", + author: "Kshitiz", + countDown: 20, + role: 0, + shortDescription: "lado puti", + longDescription: " generate 3d type image & support image to image", + category: "fun", + guide: { + en: "{p}render reply to image or {p}render [prompt]" + } + }, + onStart: async function ({ message, event, args, api }) { + api.setMessageReaction("🕐", event.messageID, (err) => {}, true); + + try { + const promptApiUrl = "https://www.api.vyturex.com/describe?url="; + const renderApiUrl = "https://ai-tools.replit.app/render?prompt="; + + let prompt = ''; + + if (event.type === "message_reply") { + const attachment = event.messageReply.attachments[0]; + if (!attachment || !["photo", "sticker"].includes(attachment.type)) { + return message.reply("❌ | Reply must be an image."); + } + const imageUrl = await tinyurl.shorten(attachment.url); + const promptResponse = await axios.get(promptApiUrl + encodeURIComponent(imageUrl)); + prompt = encodeURIComponent(promptResponse.data); + } else { + prompt = encodeURIComponent(args.join(" ")); + } + + const renderResponse = await axios.get(renderApiUrl + prompt, { + responseType: "arraybuffer" + }); + + const cacheFolderPath = path.join(__dirname, "/cache"); + if (!fs.existsSync(cacheFolderPath)) { + fs.mkdirSync(cacheFolderPath); + } + const imagePath = path.join(cacheFolderPath, `${Date.now()}_generated_image.png`); + fs.writeFileSync(imagePath, Buffer.from(renderResponse.data, "binary")); + + const stream = fs.createReadStream(imagePath); + message.reply({ + body: "", + attachment: stream + }); + + } catch (error) { + console.error("Error:", error); + message.reply("❌ | An error occurred. Please try again later."); + } + } +}; diff --git a/scripts/cmds/sendmoney.js b/scripts/cmds/sendmoney.js new file mode 100644 index 0000000000..c8e1c6422d --- /dev/null +++ b/scripts/cmds/sendmoney.js @@ -0,0 +1,51 @@ +module.exports = { + config: { + name: "sendmoney", + version: "1.0", + author: "Hassan", + shortDescription: { + en: "Send money to another user", + }, + longDescription: { + en: "Command to transfer money to another user by UID.", + }, + category: "Finance", + }, + onStart: async function ({ args, message, event, usersData }) { + const { senderID } = event; + const senderData = await usersData.get(senderID); + + if (!senderData) { + return message.reply("Error: Sender data not found."); + } + + const amount = parseInt(args[0]); + if (isNaN(amount) || amount <= 0) { + return message.reply("Please enter a valid positive amount to send."); + } else if (amount > senderData.money) { + return message.reply("Not enough money in your balance."); + } + + const recipientUID = args[1]; + if (!recipientUID) { + return message.reply("Error: Please provide a recipient UID."); + } + + const recipientData = await usersData.get(recipientUID); + if (!recipientData) { + return message.reply("Recipient not found."); + } + + await usersData.set(senderID, { + money: senderData.money - amount, + data: senderData.data, + }); + + await usersData.set(recipientUID, { + money: (recipientData.money || 0) + amount, + data: recipientData.data, + }); + + return message.reply(`Successfully sent $${amount} to UID: ${recipientUID}.`); + }, +}; diff --git a/scripts/cmds/shell.js b/scripts/cmds/shell.js new file mode 100644 index 0000000000..9873124e51 --- /dev/null +++ b/scripts/cmds/shell.js @@ -0,0 +1,41 @@ +const { exec } = require('child_process'); + +module.exports = { + config: { + name: "shell", + version: "1.0", + author: "Samir", + countDown: 5, + role: 0, + shortDescription: "Execute shell commands", + longDescription: "", + category: "shell", + guide: { + vi: "{p}{n} ", + en: "{p}{n} " + } + }, + + onStart: async function ({ args, message }) { + const command = args.join(" "); + + if (!command) { + return message.reply("Please provide a command to execute."); + } + + exec(command, (error, stdout, stderr) => { + if (error) { + console.error(`Error executing command: ${error}`); + return message.reply(`An error occurred while executing the command: ${error.message}`); + } + + if (stderr) { + console.error(`Command execution resulted in an error: ${stderr}`); + return message.reply(`Command execution resulted in an error: ${stderr}`); + } + + console.log(`Command executed successfully:\n${stdout}`); + message.reply(`Command executed successfully:\n${stdout}`); + }); + } +}; diff --git a/scripts/cmds/shoti.js b/scripts/cmds/shoti.js new file mode 100644 index 0000000000..768028050f --- /dev/null +++ b/scripts/cmds/shoti.js @@ -0,0 +1,56 @@ +const axios = require("axios"); +const fs = require("fs"); +const path = require("path"); + +module.exports = { + config: { + name: "shoti", + aliases: [], + author: "Kshitiz", + version: "2.0", + cooldowns: 10, + role: 0, + shortDescription: "Get random shoti video", + longDescription: "Get random shoti video", + category: "fun", + guide: "{p}shoti", + }, + + onStart: async function ({ api, event, args, message }) { + api.setMessageReaction("🕐", event.messageID, (err) => {}, true); + + try { + const response = await axios.get("https://shoti-waifu.onrender.com/kshitiz"); + const postData = response.data.posts; + const randomIndex = Math.floor(Math.random() * postData.length); + const randomPost = postData[randomIndex]; + + const videoUrls = randomPost.map(url => url.replace(/\\/g, "/")); + + const selectedUrl = videoUrls[Math.floor(Math.random() * videoUrls.length)]; + + const videoResponse = await axios.get(selectedUrl, { responseType: "stream" }); + + const tempVideoPath = path.join(__dirname, "cache", `${Date.now()}.mp4`); + const writer = fs.createWriteStream(tempVideoPath); + videoResponse.data.pipe(writer); + + writer.on("finish", async () => { + const stream = fs.createReadStream(tempVideoPath); + const user = response.data.user || "@user_unknown"; + await message.reply({ + body: `username:"${user}"`, + attachment: stream, + }); + api.setMessageReaction("✅", event.messageID, (err) => {}, true); + fs.unlink(tempVideoPath, (err) => { + if (err) console.error(err); + console.log(`Deleted ${tempVideoPath}`); + }); + }); + } catch (error) { + console.error(error); + message.reply("Sorry, an error occurred while processing your request."); + } + } +}; diff --git a/scripts/cmds/sing.js b/scripts/cmds/sing.js new file mode 100644 index 0000000000..9e163bb64f --- /dev/null +++ b/scripts/cmds/sing.js @@ -0,0 +1,88 @@ +const axios = require("axios"); +const fs = require('fs-extra'); +const path = require('path'); +const ytdl = require("ytdl-core"); +const yts = require("yt-search"); + +async function sing(api, event, args, message) { + api.setMessageReaction("🕢", event.messageID, (err) => {}, true); + try { + let title = ''; + + const extractShortUrl = async () => { + const attachment = event.messageReply.attachments[0]; + if (attachment.type === "video" || attachment.type === "audio") { + return attachment.url; + } else { + throw new Error("Invalid attachment type."); + } + }; + + if (event.messageReply && event.messageReply.attachments && event.messageReply.attachments.length > 0) { + const shortUrl = await extractShortUrl(); + const musicRecognitionResponse = await axios.get(`https://youtube-music-sooty.vercel.app/kshitiz?url=${encodeURIComponent(shortUrl)}`); + title = musicRecognitionResponse.data.title; + } else if (args.length === 0) { + message.reply("Please provide a lyrics name"); + return; + } else { + title = args.join(" "); + } + + const searchResults = await yts(title); + if (!searchResults.videos.length) { + message.reply("No song and lyrics found for the given query."); + return; + } + + const videoUrl = searchResults.videos[0].url; + const stream = ytdl(videoUrl, { filter: "audioonly" }); + + const fileName = `lado.mp3`; + const filePath = path.join(__dirname, "cache", fileName); + const writer = fs.createWriteStream(filePath); + + stream.pipe(writer); + + writer.on('finish', async () => { + const audioStream = fs.createReadStream(filePath); + + + const lyricsResponse = await axios.get(`https://lyrist.vercel.app/api/${encodeURIComponent(title)}`); + const { lyrics } = lyricsResponse.data; + + + const messageBody = `🎧 Playing: ${title}\n\n${lyrics}`; + + + message.reply({ body: messageBody, attachment: audioStream }); + + api.setMessageReaction("✅", event.messageID, () => {}, true); + }); + + writer.on('error', (error) => { + console.error("Error:", error); + message.reply("Error occurred while processing the song."); + }); + } catch (error) { + console.error("Error:", error); + message.reply("Error occurred while processing the song."); + } +} + +module.exports = { + config: { + name: "sing", + version: "1.0", + author: "Vex_Kshitiz", + countDown: 10, + role: 0, + shortDescription: "play music withs its lyrics", + longDescription: "play music witg it lyrics.", + category: "music", + guide: "{p] play lyricsName" + }, + onStart: function ({ api, event, args, message }) { + return sing(api, event, args, message); + } +}; diff --git a/scripts/cmds/slot.js b/scripts/cmds/slot.js new file mode 100644 index 0000000000..439ad6ba57 --- /dev/null +++ b/scripts/cmds/slot.js @@ -0,0 +1,79 @@ +module.exports = { + config: { + name: "slot", + version: "1.0", + author: "OtinXSandip", + shortDescription: { + en: "Slot game", + }, + longDescription: { + en: "Slot game.", + }, + category: "Game", + }, + langs: { + en: { + invalid_amount: "Enter a valid and positive amount to have a chance to win double", + not_enough_money: "Check your balance if you have that amount", + spin_message: "Spinning...", + win_message: "You won $%1, buddy!", + lose_message: "You lost $%1, buddy.", + jackpot_message: "Jackpot! You won $%1 with three %2 symbols, buddy!", + }, + }, + onStart: async function ({ args, message, event, envCommands, usersData, commandName, getLang }) { + const { senderID } = event; + const userData = await usersData.get(senderID); + const amount = parseInt(args[0]); + + if (isNaN(amount) || amount <= 0) { + return message.reply(getLang("invalid_amount")); + } + + if (amount > userData.money) { + return message.reply(getLang("not_enough_money")); + } + + const slots = ["💚", "💛", "💙", "💛", "💚", "💙", "💙", "💛", "💚"]; + const slot1 = slots[Math.floor(Math.random() * slots.length)]; + const slot2 = slots[Math.floor(Math.random() * slots.length)]; + const slot3 = slots[Math.floor(Math.random() * slots.length)]; + + const winnings = calculateWinnings(slot1, slot2, slot3, amount); + + await usersData.set(senderID, { + money: userData.money + winnings, + data: userData.data, + }); + + const messageText = getSpinResultMessage(slot1, slot2, slot3, winnings, getLang); + + return message.reply(messageText); + }, +}; + +function calculateWinnings(slot1, slot2, slot3, betAmount) { + if (slot1 === "💚" && slot2 === "💚" && slot3 === "💚") { + return betAmount * 10; + } else if (slot1 === "💛" && slot2 === "💛" && slot3 === "💛") { + return betAmount * 5; + } else if (slot1 === slot2 && slot2 === slot3) { + return betAmount * 3; + } else if (slot1 === slot2 || slot1 === slot3 || slot2 === slot3) { + return betAmount * 2; + } else { + return -betAmount; + } +} + +function getSpinResultMessage(slot1, slot2, slot3, winnings, getLang) { + if (winnings > 0) { + if (slot1 === "💙" && slot2 === "💙" && slot3 === "💙") { + return getLang("jackpot_message", winnings, "💙"); + } else { + return getLang("win_message", winnings) + `\[ ${slot1} | ${slot2} | ${slot3} ]`; + } + } else { + return getLang("lose_message", -winnings) + `\[ ${slot1} | ${slot2} | ${slot3} ]`; + } +} diff --git a/scripts/cmds/ss.js b/scripts/cmds/ss.js new file mode 100644 index 0000000000..b6e12f647e --- /dev/null +++ b/scripts/cmds/ss.js @@ -0,0 +1,76 @@ +const axios = require("axios"); +const fs = require("fs"); +const path = require("path"); + +module.exports = { + config: { + name: "ss", + aliases: [], + author: "kshitiz", + version: "1.0", + cooldowns: 5, + role: 2, + shortDescription: { + en: "Generate a screenshot of a webpage." + }, + longDescription: { + en: "Generate a screenshot of a webpage" + }, + category: "𝗨𝗧𝗜𝗟𝗦", + guide: { + en: "{url}" + } + }, + onStart: async function ({ api, event, args, message }) { + api.setMessageReaction("🕐", event.messageID, (err) => {}, true); + let url; + + if (event.type === "message_reply") { + + if (event.messageReply.body && event.messageReply.body.startsWith("http")) { + url = event.messageReply.body; + } else { + return message.reply("The replied message does not contain a valid URL."); + } + } else { + + if (args.length === 0) { + return message.reply("Please provide a URL."); + } + + url = args[0]; + } + + try { + const response = await axios.get(`https://ss-kshitizz.onrender.com/ss?url=${encodeURIComponent(url)}`, { responseType: "stream" }); + + + const imagePath = path.join(__dirname, `/cache/ss_${Date.now()}.png`); + + + const writer = fs.createWriteStream(imagePath); + response.data.pipe(writer); + + + await new Promise((resolve, reject) => { + writer.on("finish", resolve); + writer.on("error", reject); + }); + + + await message.reply({ + body: "Screenshot generated:", + attachment: fs.createReadStream(imagePath) + }); + + + fs.unlinkSync(imagePath); + + + api.setMessageReaction("💚", event.messageID, (err) => {}, true); + } catch (error) { + + message.reply(`Error: ${error.message}`); + } + } +}; diff --git a/scripts/cmds/terabox.js b/scripts/cmds/terabox.js new file mode 100644 index 0000000000..2330a14f2b --- /dev/null +++ b/scripts/cmds/terabox.js @@ -0,0 +1,71 @@ +const axios = require("axios"); +const fs = require("fs-extra"); + +module.exports = { + threadStates: {}, + config: { + name: 'terabox', + version: '1.0', + author: 'Kshitiz', + countDown: 5, + role: 0, + shortDescription: 'terabox Auto video downloader ', + longDescription: '', + category: 'media', + guide: { + en: '{p}{n}', + } + }, + onStart: async function ({ api, event }) { + const threadID = event.threadID; + this.threadStates[threadID] = false; + + if (event.body.toLowerCase().includes('terabox on')) { + this.threadStates[threadID] = true; + api.sendMessage("Terabox is now active.", event.threadID, event.messageID); + } else if (event.body.toLowerCase().includes('terabox off')) { + this.threadStates[threadID] = false; + api.sendMessage("Terabox is now inactive.", event.threadID, event.messageID); + } + }, + onChat: async function ({ api, event }) { + const threadID = event.threadID; + if (this.threadStates[threadID] && event.body.includes('https://teraboxapp.com/s/')) { + const url = event.body.trim(); + console.log(`Terabox link detected: ${url}`); + this.downLoad(url, api, event); + api.setMessageReaction("🕐", event.messageID, (err) => {}, true); + } + }, + downLoad: async function (url, api, event) { + try { + console.log(`Attempting to download from URL: ${url}`); + const res = await axios.get(`https://tera-box.onrender.com/kshitiz?link=${encodeURIComponent(url)}`); + console.log(`Terabox API response: ${JSON.stringify(res.data)}`); + const downloadLink = res.data.downloadLink; + console.log(`Download link received: ${downloadLink}`); + + const response = await axios({ + method: "GET", + url: downloadLink, + responseType: "stream" + }); + + const time = Date.now(); + const path = __dirname + `/cache/${time}.mp4`; + console.log(`Saving video to: ${path}`); + response.data.pipe(fs.createWriteStream(path)); + + response.data.on('end', async () => { + console.log(`Download completed for ${url}`); + api.sendMessage({ + body: `✅ Downloaded.`, + attachment: fs.createReadStream(path) + }, event.threadID, () => fs.unlinkSync(path), event.messageID); + }); + } catch (err) { + console.error(`Error downloading video: ${err.message}`); + api.sendMessage("An error occurred while downloading the video.", event.threadID, event.messageID); + } + } +}; diff --git a/scripts/cmds/tiktok.js b/scripts/cmds/tiktok.js new file mode 100644 index 0000000000..99fbee9324 --- /dev/null +++ b/scripts/cmds/tiktok.js @@ -0,0 +1,51 @@ +const axios = require("axios"); +const fs = require("fs"); +const path = require("path"); + +module.exports = { + config: { + name: "tiktok", + author: "Kshitiz", + version: "1.0", + cooldowns: 20, + role: 0, + shortDescription: "Search for TikTok videos", + longDescription: "Search for TikTok videos using keywords", + category: "media", + guide: "{p}tiktok keyword", + }, + + onStart: async function ({ api, event, args, message }) { + api.setMessageReaction("🕐", event.messageID, () => {}, true); + + try { + const query = args.join(" "); + const response = await axios.get(`https://api.betabotz.eu.org/api/search/tiktoks?query=${query}&apikey=vrGjIdJL`); + + if (response.data.status && response.data.result.data.length > 0) { + const videoUrl = response.data.result.data[0].play; + const videoFileName = `${response.data.result.data[0].video_id}.mp4`; + + + const tempVideoPath = path.join(__dirname, "cache", videoFileName); + const writer = fs.createWriteStream(tempVideoPath); + + const videoResponse = await axios.get(videoUrl, { responseType: "stream" }); + videoResponse.data.pipe(writer); + + writer.on("finish", () => { + + const videoStream = fs.createReadStream(tempVideoPath); + message.reply({ attachment: videoStream }); + api.setMessageReaction("✅", event.messageID, () => {}, true); + }); + } else { + message.reply("No TikTok videos found for the given query."); + api.setMessageReaction("❌", event.messageID, () => {}, true); + } + } catch (error) { + console.error(error); + message.reply("Sorry, an error occurred while processing your request."); + } + } +}; diff --git a/scripts/cmds/unsend.js b/scripts/cmds/unsend.js index ccc3c53424..a9f78bbbb7 100644 --- a/scripts/cmds/unsend.js +++ b/scripts/cmds/unsend.js @@ -1,8 +1,9 @@ module.exports = { config: { name: "unsend", + aliases: ["un","uns","unsef","u"], version: "1.1", - author: "NTKhang", + author: "NTKhang",//--- remodified by itachi countDown: 5, role: 0, shortDescription: { @@ -34,4 +35,4 @@ module.exports = { return message.reply(getLang("syntaxError")); message.unsend(event.messageReply.messageID); } -}; \ No newline at end of file +}; diff --git a/scripts/cmds/upscaleai.js b/scripts/cmds/upscaleai.js new file mode 100644 index 0000000000..a0a261b2ab --- /dev/null +++ b/scripts/cmds/upscaleai.js @@ -0,0 +1,52 @@ +const a = require('axios'); +const tinyurl = require('tinyurl'); + +module.exports = { + config: { + name: "upscaleai", + aliases: ["4k", "upscale"], + version: "1.0", + author: "JARiF", + countDown: 15, + role: 0, + longDescription: "Upscale your image.", + category: "utility", + guide: { + en: "{pn} reply to an image" + } + }, + + onStart: async function ({ message, args, event, api }) { + let imageUrl; + + if (event.type === "message_reply") { + const replyAttachment = event.messageReply.attachments[0]; + + if (["photo", "sticker"].includes(replyAttachment?.type)) { + imageUrl = replyAttachment.url; + } else { + return api.sendMessage( + { body: "❌ | Reply must be an image." }, + event.threadID + ); + } + } else if (args[0]?.match(/(https?:\/\/.*\.(?:png|jpg|jpeg))/g)) { + imageUrl = args[0]; + } else { + return api.sendMessage({ body: "❌ | Reply to an image." }, event.threadID); + } + + try { + const url = await tinyurl.shorten(imageUrl); + const k = await a.get(`https://www.api.vyturex.com/upscale?imageUrl=${url}`); + + message.reply("✅ | Please wait..."); + + const resultUrl = k.data.resultUrl; + + message.reply({ body: "✅ | Image Upscaled.", attachment: await global.utils.getStreamFromURL(resultUrl) }); + } catch (error) { + message.reply("❌ | Error: " + error.message); + } + } +}; diff --git a/scripts/cmds/uptime.js b/scripts/cmds/uptime.js new file mode 100644 index 0000000000..80aad703d9 --- /dev/null +++ b/scripts/cmds/uptime.js @@ -0,0 +1,33 @@ +module.exports = { + config: { + name: "uptime", + aliases: ["up", "upt"], + version: "1.0", + author: "Itachi", + role: 0, + shortDescription: { + en: "Displays the uptime of the bot." + }, + longDescription: { + en: "Displays the amount of time that the bot has been running for." + }, + category: "System", + guide: { + en: "Use {p}uptime to display the uptime of the bot." + } + }, + onStart: async function ({ api, event, args }) { + const uptime = process.uptime(); + const seconds = Math.floor(uptime % 60); + const minutes = Math.floor((uptime / 60) % 60); + const hours = Math.floor((uptime / (60 * 60)) % 24); + const days = Math.floor(uptime / (60 * 60 * 24)); + const uptimeString = `${days} days ${hours} hours ${minutes} minutes ${seconds} second`; + api.sendMessage(` Hello Master 😸 + + + Your Bot Has been running for + +${uptimeString}.`, event.threadID); + } +}; diff --git a/scripts/cmds/uptime2.js b/scripts/cmds/uptime2.js new file mode 100644 index 0000000000..483855a9b5 --- /dev/null +++ b/scripts/cmds/uptime2.js @@ -0,0 +1,41 @@ +module.exports = { + config: { + name: "uptime2", + aliases: ["up2"], + role: 0, + shortDescription: { + en: "Show server uptime", + tl: "Ipakita ang uptime ng server", + }, + longDescription: { + en: "Shows the duration for which the server has been running", + tl: "Ipapakita ang tagal na gumagana ang server", + }, + category: "goatBot", + guide: { + en: "{p}uptime", + tl: "{p}uptime", + }, + }, + + onStart: async function ({ api, message, threadsData }) { + const os = require("os"); + const uptime = os.uptime(); + + const days = Math.floor(uptime / (3600 * 24)); + const hours = Math.floor((uptime % (3600 * 24)) / 3600); + const mins = Math.floor((uptime % 3600) / 60); + const seconds = Math.floor(uptime % 60); + + const system = `OS: ${os.platform()} ${os.release()}`; + const cores = `Cores: ${os.cpus().length}`; + const arch = `Architecture: ${os.arch()}`; + const totalMemory = `Total Memory: ${Math.round(os.totalmem() / (1024 * 1024 * 1024))} GB`; + const freeMemory = `Free Memory: ${Math.round(os.freemem() / (1024 * 1024 * 1024))} GB`; + const uptimeString = `Uptime: ${days} days, ${hours} hours, ${mins} minutes, and ${seconds} seconds`; + + const response = `🕒 ${uptimeString}\n📡 ${system}\n🛡 ${cores}\n⚔ No AI Status\n📈 Total Users: ${threadsData.size}\n📉 Total Threads: ${threadsData.size}\n⚖ AI Usage: 0.0\n📊 RAM Usage: ${Math.round(process.memoryUsage().rss / (1024 * 1024))} MB\n💰 Total(RAM): ${Math.round(os.totalmem() / (1024 * 1024 * 1024))} GB\n💸 Current(RAM): ${Math.round(os.freemem() / (1024 * 1024 * 1024))} GB\n🛫 Ping: 15 ms\n🕰 Uptime(Seconds): ${Math.floor(process.uptime())}`; + + message.reply(response); + }, +}; diff --git a/scripts/cmds/video.js b/scripts/cmds/video.js new file mode 100644 index 0000000000..ae87cd04e8 --- /dev/null +++ b/scripts/cmds/video.js @@ -0,0 +1,100 @@ +const axios = require("axios"); +const fs = require('fs-extra'); +const path = require('path'); +const { getStreamFromURL, shortenURL, randomString } = global.utils; + +async function video(api, event, args, message) { + api.setMessageReaction("🕢", event.messageID, (err) => {}, true); + try { + let title = ''; + let shortUrl = ''; + + const extractShortUrl = async () => { + const attachment = event.messageReply.attachments[0]; + if (attachment.type === "video" || attachment.type === "audio") { + return attachment.url; + } else { + throw new Error("Invalid attachment type."); + } + }; + + let videoId = ''; + if (event.messageReply && event.messageReply.attachments && event.messageReply.attachments.length > 0) { + shortUrl = await extractShortUrl(); + const musicRecognitionResponse = await axios.get(`https://youtube-music-sooty.vercel.app/kshitiz?url=${encodeURIComponent(shortUrl)}`); + title = musicRecognitionResponse.data.title; + const searchResponse = await axios.get(`https://youtube-kshitiz.vercel.app/youtube?search=${encodeURIComponent(title)}`); + if (searchResponse.data.length > 0) { + videoId = searchResponse.data[0].videoId; + } + + shortUrl = await shortenURL(shortUrl); + } else if (args.length === 0) { + message.reply("Please provide a video name or reply to a video or audio attachment."); + return; + } else { + title = args.join(" "); + const searchResponse = await axios.get(`https://youtube-kshitiz.vercel.app/youtube?search=${encodeURIComponent(title)}`); + if (searchResponse.data.length > 0) { + videoId = searchResponse.data[0].videoId; + } + + const videoUrl = await axios.get(`https://youtube-kshitiz.vercel.app/download?id=${encodeURIComponent(videoId)}`); + if (videoUrl.data.length > 0) { + shortUrl = await shortenURL(videoUrl.data[0]); + } + } + + if (!videoId) { + message.reply("No video found for the given query."); + return; + } + + const downloadResponse = await axios.get(`https://youtube-kshitiz.vercel.app/download?id=${encodeURIComponent(videoId)}`); + if (downloadResponse.data.length === 0) { + message.reply("Failed to retrieve download link for the video."); + return; + } + + const videoUrl = downloadResponse.data[0]; + const writer = fs.createWriteStream(path.join(__dirname, "cache", `${videoId}.mp4`)); + const response = await axios({ + url: videoUrl, + method: 'GET', + responseType: 'stream' + }); + + response.data.pipe(writer); + + writer.on('finish', () => { + const videoStream = fs.createReadStream(path.join(__dirname, "cache", `${videoId}.mp4`)); + message.reply({ body: `📹 Playing: ${title}\nDownload Link: ${shortUrl}`, attachment: videoStream }); + api.setMessageReaction("✅", event.messageID, () => {}, true); + }); + + writer.on('error', (error) => { + console.error("Error:", error); + message.reply("error"); + }); + } catch (error) { + console.error("Error:", error); + message.reply("error"); + } +} + +module.exports = { + config: { + name: "video", + version: "1.0", + author: "Kshitiz", + countDown: 10, + role: 0, + shortDescription: "play video from youtube", + longDescription: "play video from youtube support audio recognition.", + category: "music", + guide: "{p} video videoname / reply to audio or video" + }, + onStart: function ({ api, event, args, message }) { + return video(api, event, args, message); + } +}; diff --git a/scripts/cmds/view.js b/scripts/cmds/view.js new file mode 100644 index 0000000000..59d724b03e --- /dev/null +++ b/scripts/cmds/view.js @@ -0,0 +1,64 @@ +const axios = require("axios"); +const fs = require("fs"); +const path = require("path"); + +module.exports = { + config: { + name: "view", + aliases: [], + author: "Kshitiz", + version: "1.0", + cooldowns: 5, + role: 0, + shortDescription: "View image or video from a link", + longDescription: "View image or video from a link", + category: "utility", + guide: "{p}view [image/video link]", + }, + + onStart: async function ({ api, event, args, message }) { + const link = args[0]; + + if (!link) { + return message.reply("Please provide a vaild link to view."); + } + + try { + const response = await axios.head(link); + + + if (response.status === 200) { + const contentType = response.headers['content-type']; + let extension = ''; + + if (contentType.includes('image')) { + extension = '.png'; + } else if (contentType.includes('video')) { + extension = '.mp4'; + } else { + return message.reply("Unsupported link format. Please provide a valid download link."); + } + + const tempFilePath = path.join(__dirname, "cache", `${Date.now()}${extension}`); + const writer = fs.createWriteStream(tempFilePath); + + const downloadResponse = await axios.get(link, { responseType: "stream" }); + downloadResponse.data.pipe(writer); + + writer.on("finish", () => { + const stream = fs.createReadStream(tempFilePath); + + message.reply({ + body: `-your request-`, + attachment: stream, + }); + }); + } else { + message.reply("Unsupported link format. Please provide a valid direct download link."); + } + } catch (error) { + console.error(error); + message.reply("Sorry, an error occurred while processing your request."); + } + } +}; diff --git a/scripts/cmds/voice.js b/scripts/cmds/voice.js new file mode 100644 index 0000000000..68739aa64d --- /dev/null +++ b/scripts/cmds/voice.js @@ -0,0 +1,54 @@ +const axios = require('axios'); +const supportedIds = ["rachel", "drew", "clyde", "paul", "domi", "dave", "fin", "sarah", "antoni", "thomas", "charlie", "george", "emily", "elli", "callum", "patrick", "harry", "liam", "dorothy", "josh", "arnold", "charlotte", "alice", "matilda", "matthew", "james", "joseph", "jeremy", "michael", "ethan", "chris", "gigi", "freya", "brian", "grace", "daniel", "lily", "serena", "adam", "nicole", "bill", "jessie", "sam", "glinda", "giovanni", "mimi"]; + +module.exports = { + config: { + name: "voice", + version: "1.0", + author: "Rishad", + countDown: 5, + role: 0, + category: "Fun", + ShortDescription: "Generate voice using AI", + LongDescription: "Generates voice using an AI.", + guide: { + en: "{pn} (voice id) | texts\nExample: {pn} rachel | hey there\n{pn} list | Get the list of supported voice IDs" + } + }, + + onStart: async function ({ api, args, message, event }) { + const { getPrefix, getStreamFromURL } = global.utils; + const p = getPrefix(event.threadID); + + const command = args.join(" ").split("|"); + if (command.length !== 2) { + if (args[0].toLowerCase() === 'list') { + return api.sendMessage(`Supported voice IDs are:\n ${supportedIds.join("\n")}`, event.threadID, event.messageID); + } + return message.reply(`❌Invalid command format. Use it like this:\n${p}voice rachel | Hey there`); + } + + const voiceId = command[0].trim().toLowerCase(); + const text = command[1].trim(); + + if (!supportedIds.includes(voiceId)) { + return message.reply(`❌Invalid voice ID. Supported IDs are:\n ${supportedIds.join("\n")}`); + } + + const apiKey = 'fuck'; + const apiUrl = `https://for-devs.onrender.com/api/voice?text=${encodeURIComponent(text)}&voiceid=${voiceId}&apikey=${apiKey}`; + + try { + const voiceStream = await getStreamFromURL(apiUrl); + + if (voiceStream) { + return api.sendMessage({ attachment: voiceStream }, event.threadID, event.messageID); + } else { + return api.sendMessage('Failed to generate voice.', event.threadID, event.messageID); + } + } catch (error) { + console.error(error); + return api.sendMessage('Failed to generate voice.', event.threadID, event.messageID); + } + } +}; diff --git a/scripts/cmds/wifey.js b/scripts/cmds/wifey.js new file mode 100644 index 0000000000..7c75584381 --- /dev/null +++ b/scripts/cmds/wifey.js @@ -0,0 +1,45 @@ +const axios = require("axios"); +const fs = require("fs"); +const path = require("path"); + +module.exports = { + config: { + name: "wifey", + aliases: [], + author: "Kshitiz", + version: "1.0", + cooldowns: 10, + role: 0, + shortDescription: "Get random wifey ", + longDescription: "Get random wifey video", + category: "fun", + guide: "{p}wifey", + }, + + onStart: async function ({ api, event, args, message }) { + api.setMessageReaction("🕐", event.messageID, (err) => {}, true); + + try { + const response = await axios.get(`https://wifey-csz1.onrender.com/kshitiz`, { responseType: "stream" }); + + const tempVideoPath = path.join(__dirname, "cache", `${Date.now()}.mp4`); + + const writer = fs.createWriteStream(tempVideoPath); + response.data.pipe(writer); + + writer.on("finish", async () => { + const stream = fs.createReadStream(tempVideoPath); + + message.reply({ + body: `Random Wifey Videos.`, + attachment: stream, + }); + + api.setMessageReaction("✅", event.messageID, (err) => {}, true); + }); + } catch (error) { + console.error(error); + message.reply("Sorry, an error occurred while processing your request."); + } + } +}; diff --git a/scripts/cmds/ws.js b/scripts/cmds/ws.js new file mode 100644 index 0000000000..7831f1e4f9 --- /dev/null +++ b/scripts/cmds/ws.js @@ -0,0 +1,77 @@ +const axios = require("axios"); +const fs = require("fs-extra"); +const path = require("path"); + +module.exports = { + config: { + name: "ws", + version: "1.0.0", + author: "kshitiz", + role: 0, + countDown: 10, + shortDescription: { + en: "Search for wallpapers" + }, + category: "image", + guide: { + en: "{prefix}ws -" + } + }, + + onStart: async function ({ api, event, args, usersData }) { + try { + const subCommand = args.shift(); + let apiUrl = ""; + switch (subCommand) { + case "mbl": + apiUrl = "https://kshitiz-project.vercel.app/mbl"; + break; + case "pc": + apiUrl = "https://kshitiz-project.vercel.app/pc"; + break; + default: + return api.sendMessage(`invaild.\nex1: ws mbl zoro -1\nex2:ws pc zoro -1`, event.threadID, event.messageID); + } + + const keySearch = args.join(" "); + if (!keySearch.includes("-")) { + return api.sendMessage(`invaild.ex1: ws mbl zoro -1\nex1:ws pc zoro -1`, event.threadID, event.messageID); + } + const keySearchs = keySearch.substr(0, keySearch.indexOf('-')).trim(); + const numberSearch = parseInt(keySearch.split("-").pop().trim()) || 6; + + const res = await axios.get(`${apiUrl}?q=${encodeURIComponent(keySearchs)}`); + const data = res.data.data; + + if (!data || !Array.isArray(data) || data.length === 0) { + return api.sendMessage(`wallpaper not found for "${keySearchs}".`, event.threadID, event.messageID); + } + + const imgData = []; + + for (let i = 0; i < Math.min(numberSearch, data.length); i++) { + const imageUrl = data[i]; + + try { + const imgResponse = await axios.get(imageUrl, { responseType: 'arraybuffer' }); + const imgPath = path.join(__dirname, 'cache', `${i + 1}.jpg`); + await fs.outputFile(imgPath, imgResponse.data); + imgData.push(fs.createReadStream(imgPath)); + } catch (error) { + console.error(error); + + } + } + + await api.sendMessage({ + attachment: imgData, + body: `-wallpaper for you-` + }, event.threadID, event.messageID); + + await fs.remove(path.join(__dirname, 'cache')); + } catch (error) { + console.error(error); + return api.sendMessage(`An error occurred. Please try again later.`, event.threadID, event.messageID); + } + } +};