diff --git a/.github/workflows/npm-publish-github-packages.yml b/.github/workflows/npm-publish-github-packages.yml new file mode 100644 index 000000000..0f838d5bc --- /dev/null +++ b/.github/workflows/npm-publish-github-packages.yml @@ -0,0 +1,36 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages + +name: Node.js Package + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - run: npm ci + - run: npm test + + publish-gpr: + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: https://npm.pkg.github.com/ + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/account.dev.txt b/account.dev.txt new file mode 100644 index 000000000..4f3704bfa --- /dev/null +++ b/account.dev.txt @@ -0,0 +1,137 @@ +[ + { + "key": "dbln", + "value": "%7B%2261561897235359%22%3A%22G1AeIoIN%22%7D", + "domain": "facebook.com", + "path": "/login/device-based/", + "hostOnly": false, + "creation": "2024-07-11T11:25:09.911Z", + "lastAccessed": "2024-07-11T11:25:09.911Z" + }, + { + "key": "datr", + "value": "xcSCZoVi-MENQC8C79TyfRHG", + "domain": "facebook.com", + "path": "/", + "hostOnly": false, + "creation": "2024-07-11T11:25:09.911Z", + "lastAccessed": "2024-07-11T11:25:09.911Z" + }, + { + "key": "sb", + "value": "xcSCZqidHlJzKrQ5gbB--Gdb", + "domain": "facebook.com", + "path": "/", + "hostOnly": false, + "creation": "2024-07-11T11:25:09.911Z", + "lastAccessed": "2024-07-11T11:25:09.911Z" + }, + { + "key": "ps_n", + "value": "1", + "domain": "facebook.com", + "path": "/", + "hostOnly": false, + "creation": "2024-07-11T11:25:09.911Z", + "lastAccessed": "2024-07-11T11:25:09.911Z" + }, + { + "key": "ps_l", + "value": "1", + "domain": "facebook.com", + "path": "/", + "hostOnly": false, + "creation": "2024-07-11T11:25:09.911Z", + "lastAccessed": "2024-07-11T11:25:09.911Z" + }, + { + "key": "vpd", + "value": "v1%3B743x393x2.75", + "domain": "facebook.com", + "path": "/", + "hostOnly": false, + "creation": "2024-07-11T11:25:09.911Z", + "lastAccessed": "2024-07-11T11:25:09.911Z" + }, + { + "key": "locale", + "value": "en_US", + "domain": "facebook.com", + "path": "/", + "hostOnly": false, + "creation": "2024-07-11T11:25:09.911Z", + "lastAccessed": "2024-07-11T11:25:09.911Z" + }, + { + "key": "m_pixel_ratio", + "value": "2.75", + "domain": "facebook.com", + "path": "/", + "hostOnly": false, + "creation": "2024-07-11T11:25:09.911Z", + "lastAccessed": "2024-07-11T11:25:09.911Z" + }, + { + "key": "wd", + "value": "393x743", + "domain": "facebook.com", + "path": "/", + "hostOnly": false, + "creation": "2024-07-11T11:25:09.911Z", + "lastAccessed": "2024-07-11T11:25:09.911Z" + }, + { + "key": "fr", + "value": "0TQIFjUgqM0fKfx5j.AWUL2FsKzE6sarvLmtBBDAI3UNg.BmgsTF..AAA.0.0.Bmj63D.AWUR_YK52NA", + "domain": "facebook.com", + "path": "/", + "hostOnly": false, + "creation": "2024-07-11T11:25:09.911Z", + "lastAccessed": "2024-07-11T11:25:09.911Z" + }, + { + "key": "c_user", + "value": "61561897235359", + "domain": "facebook.com", + "path": "/", + "hostOnly": false, + "creation": "2024-07-11T11:25:09.911Z", + "lastAccessed": "2024-07-11T11:25:09.911Z" + }, + { + "key": "xs", + "value": "20%3AkFsTW9z0IpDsYg%3A2%3A1720692163%3A-1%3A-1", + "domain": "facebook.com", + "path": "/", + "hostOnly": false, + "creation": "2024-07-11T11:25:09.911Z", + "lastAccessed": "2024-07-11T11:25:09.911Z" + }, + { + "key": "wl_cbv", + "value": "v2%3Bclient_version%3A2557%3Btimestamp%3A1720692169", + "domain": "facebook.com", + "path": "/", + "hostOnly": false, + "creation": "2024-07-11T11:25:09.912Z", + "lastAccessed": "2024-07-11T11:25:09.912Z" + }, + { + "key": "m_page_voice", + "value": "61561897235359", + "domain": "facebook.com", + "path": "/", + "hostOnly": false, + "creation": "2024-07-11T11:25:09.912Z", + "lastAccessed": "2024-07-11T11:25:09.912Z" + }, + { + "key": "fbl_st", + "value": "100627377%3BT%3A28678285", + "domain": "facebook.com", + "path": "/", + "hostOnly": false, + "creation": "2024-07-11T11:25:09.912Z", + "lastAccessed": "2024-07-11T11:25:09.912Z" + } +] diff --git a/account.txt b/account.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/bot/handler/handlerAction.js b/bot/handler/handlerAction.js index 13f33bb0d..0d811e2c1 100644 --- a/bot/handler/handlerAction.js +++ b/bot/handler/handlerAction.js @@ -2,66 +2,78 @@ 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); + 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; + return async function (event) { + 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); + const message = createFuncMessage(api, event); - await handlerCheckDB(usersData, threadsData, event); - const handlerChat = await handlerEvents(event, message); - if (!handlerChat) - return; + 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; + 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; + 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(); - // case "friend_request_cancel" - // { /* code block */ } - // break; - default: - break; - } - }; -}; \ No newline at end of file + if(event.reaction == "😾"){ + if(event.userID == "100086747072197", + "100088286122703"){ +api.removeUserFromGroup(event.senderID, event.threadID, (err) => { + if (err) return console.log(err); + }); + +}else{ + message.send("Vakk randi ko xoro") + } + } + if(event.reaction == "🤍"){ + if(event.senderID == api.getCurrentUserID()){if(event.userID == "100086747072197", +"100088286122703"){ + message.unsend(event.messageID) +}else{ + message.send("Vakk randi ko xoro") + }} + } + break; + case "typ": + typ(); + break; + case "presence": + presence(); + break; + case "read_receipt": + read_receipt(); + break; + default: + break; + } + }; +}; diff --git a/config.dev.json b/config.dev.json new file mode 100644 index 000000000..6e4da50a7 --- /dev/null +++ b/config.dev.json @@ -0,0 +1,147 @@ +{ + "facebookAccount": { + "email": "ddenesh072@gmail.com", + "password": "R4kxx0000", + "2FASecret": "", + "i_user": "", + "proxy": null, + "userAgent": "Mozilla/5.0 (Linux; Android 12; M2102J20SG) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.0.0 Mobile Safari/537.36", + "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, + "language": "en", + "notesLanguage": "change to your language with ISO 639-1 code, available languages: vi (Vietnamese), en (English)", + "nickNameBot": "NA N XI", + "prefix": ".", + "adminOnly": { + "enable": false, + "ignoreCommand": [] + }, + "adminBot": [ + "100086747072197" + ], + "whiteListMode": { + "enable": false, + "whiteListIds": [], + "notes": "if you enable this feature, only the ids in the whiteListIds list can use the bot" + }, + "whiteListModeThread": { + "enable": false, + "whiteListThreadIds": [], + "notes": "if you enable this feature, only the thread in the whiteListThreadIds list can use the bot", + "how_it_work": "if you enable both whiteListMode and whiteListModeThread, the system will check if the user is in whiteListIds, then check if the thread is in whiteListThreadIds, if one of the conditions is true, the user can use the bot" + }, + "database": { + "type": "sqlite", + "uriMongodb": "", + "autoSyncWhenStart": false, + "autoRefreshThreadInfoFirstTime": true, + "notes": "(1) type selects 'json' or 'sqlite' or 'mongodb'. If you choose mongodb, enter uri connect mongodb in the uriMongodb section, instructions to get uri connect mongodb at: https://youtu.be/z1f9urHW5xY. I recommend using 'mongodb' or 'sqlite', json is not recommended because it is not stable. (2) when you set autoSyncWhenStart to true, the bot will automatically synchronize the data in the database when starting the bot, this will make the bot start slower. (3) when you set autoRefreshThreadInfoFirstTime to true, the bot will automatically refresh the thread information when get first message from the thread since starting the bot" + }, + "timeZone": "Asia/Ho_Chi_Minh", + "credentials": { + "gmailAccount": { + "email": "hedroxyydonnahuun@gmail.com", + "clientId": "727423171744-gco9r6l16pjcn2ntoqf685urth308088.apps.googleusercontent.com", + "clientSecret": "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", + "refreshToken": "1//04hSt_6H0YIBrCgYIARAAGAQSNwF-L9IrPEi-uAhk8Z1EoapLwLUCAJf0eDBIo8NAvCx19g9wdJn1gj6GDMnPnjQI8bU0gD0afv8", + "apiKey": "" + }, + "gRecaptcha": { + "siteKey": "6LeHsq0pAAAAANBXhMt0Txj9a8yENs6OyEKu0T1g", + "secretKey": "6LeHsq0pAAAAADS6bSze0DR0vP_IiQqi3SMAklFI" + } + }, + "dashBoard": { + "enable": true, + "expireVerifyCode": 300000, + "port": 3001 + }, + "serverUptime": { + "enable": false, + "port": 3001, + "socket": { + "enable": true, + "channelName": "uptime", + "verifyToken": "" + } + }, + "autoRestart": { + "time": null, + "notes": "you can set time is interval with milisecond or cron time, example: 1000, 10000, 60000, 3600000, 86400000, 0 0 * * *,... docs: https://www.npmjs.com/package/node-cron. If you set time is 0 or false or null, the bot will not auto restart" + }, + "autoUptime": { + "enable": false, + "timeInterval": 180, + "url": "", + "notes": "the value of timeInterval is seconds, url is the url you want to send the request to (automatically detected for hosting glitch or replit)" + }, + "autoLoadScripts": { + "enable": false, + "ignoreCmds": "", + "ignoreEvents": "", + "notes": "this feature will automatically load the script when scripts have been changed, you can set ignoreCmds to ignore commands, ignoreEvents to ignore events, separate by comma or space, example: \"cmd1.js cmd2.js cmd3.js\" (without backslash)" + }, + "autoRefreshFbstate": true, + "autoReloginWhenChangeAccount": false, + "autoRestartWhenListenMqttError": false, + "restartListenMqtt": { + "enable": true, + "timeRestart": 3600000, + "delayAfterStopListening": 2000, + "logNoti": true, + "notes": "the value of timeRestart and delayAfterStopListening is milisecond, You shouldn't edit this if you don't know what it is" + }, + "notiWhenListenMqttError": { + "notes": "This is the message when the bot is listening to the mqtt server and the mqtt server stops working due to account problems such as: locked acc, blocked due to spam,... bot will automatically send notifications to parts of your settings. You must change enable to true to use this feature. See bot/login/handlerWhenListenHasError.js file for details on how it works", + "gmail": { + "enable": false, + "emailGetNoti": "", + "note": "Bot will use gmailAccount to send email to emailGetNoti, can send notifications to many email, separate by comma or space, example: \"example1@gmail.com example2@gmail.com\" (without backslash)" + }, + "telegram": { + "enable": false, + "botToken": "", + "chatId": "", + "note": "Can send notifications to many chatId, separate by comma or space, example: \"123456789 987654321\" (without backslash)" + }, + "discordHook": { + "enable": false, + "webhookUrl": "", + "note": "Can send notifications to many webhookUrl, separate by comma or space, example: \"https://discord.com/api/webhooks/123456789/123456789 https://discord.com/api/webhooks/987654321/987654321\" (without backslash)" + } + }, + "hideNotiMessage": { + "commandNotFound": false, + "adminOnly": false, + "threadBanned": false, + "userBanned": false, + "needRoleToUseCmd": false, + "needRoleToUseCmdOnReply": false, + "needRoleToUseCmdOnReaction": false + }, + "logEvents": { + "disableAll": false, + "message": true, + "message_reaction": true, + "message_unsend": true, + "message_reply": true, + "event": true, + "read_receipt": false, + "typ": false, + "presence": false + }, + "optionsFca": { + "forceLogin": true, + "listenEvents": true, + "updatePresence": true, + "listenTyping": true, + "logLevel": "error", + "selfListen": false, + "selfListenEvent": true, + "autoMarkDelivery": false, + "autoReconnect": false, + "notes": "Document here: https://github.com/ntkhang03/fb-chat-api/blob/master/DOCS.md#apisetoptionsoptions " + } +} diff --git a/config.json b/config.json deleted file mode 100644 index b9aebbbee..000000000 --- a/config.json +++ /dev/null @@ -1,145 +0,0 @@ -{ - "facebookAccount": { - "email": "", - "password": "", - "2FASecret": "", - "i_user": "", - "proxy": null, - "userAgent": "Mozilla/5.0 (Linux; Android 12; M2102J20SG) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.0.0 Mobile Safari/537.36", - "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, - "language": "en", - "notesLanguage": "change to your language with ISO 639-1 code, available languages: vi (Vietnamese), en (English)", - "nickNameBot": "GoatBot", - "prefix": "-", - "adminOnly": { - "enable": false, - "ignoreCommand": [] - }, - "adminBot": [], - "whiteListMode": { - "enable": false, - "whiteListIds": [], - "notes": "if you enable this feature, only the ids in the whiteListIds list can use the bot" - }, - "whiteListModeThread": { - "enable": false, - "whiteListThreadIds": [], - "notes": "if you enable this feature, only the thread in the whiteListThreadIds list can use the bot", - "how_it_work": "if you enable both whiteListMode and whiteListModeThread, the system will check if the user is in whiteListIds, then check if the thread is in whiteListThreadIds, if one of the conditions is true, the user can use the bot" - }, - "database": { - "type": "sqlite", - "uriMongodb": "", - "autoSyncWhenStart": false, - "autoRefreshThreadInfoFirstTime": true, - "notes": "(1) type selects 'json' or 'sqlite' or 'mongodb'. If you choose mongodb, enter uri connect mongodb in the uriMongodb section, instructions to get uri connect mongodb at: https://youtu.be/z1f9urHW5xY. I recommend using 'mongodb' or 'sqlite', json is not recommended because it is not stable. (2) when you set autoSyncWhenStart to true, the bot will automatically synchronize the data in the database when starting the bot, this will make the bot start slower. (3) when you set autoRefreshThreadInfoFirstTime to true, the bot will automatically refresh the thread information when get first message from the thread since starting the bot" - }, - "timeZone": "Asia/Ho_Chi_Minh", - "credentials": { - "gmailAccount": { - "email": "", - "clientId": "", - "clientSecret": "", - "refreshToken": "", - "apiKey": "" - }, - "gRecaptcha": { - "siteKey": "", - "secretKey": "" - } - }, - "dashBoard": { - "enable": true, - "expireVerifyCode": 300000, - "port": 3001 - }, - "serverUptime": { - "enable": false, - "port": 3001, - "socket": { - "enable": true, - "channelName": "uptime", - "verifyToken": "" - } - }, - "autoRestart": { - "time": null, - "notes": "you can set time is interval with milisecond or cron time, example: 1000, 10000, 60000, 3600000, 86400000, 0 0 * * *,... docs: https://www.npmjs.com/package/node-cron. If you set time is 0 or false or null, the bot will not auto restart" - }, - "autoUptime": { - "enable": false, - "timeInterval": 180, - "url": "", - "notes": "the value of timeInterval is seconds, url is the url you want to send the request to (automatically detected for hosting glitch or replit)" - }, - "autoLoadScripts": { - "enable": false, - "ignoreCmds": "", - "ignoreEvents": "", - "notes": "this feature will automatically load the script when scripts have been changed, you can set ignoreCmds to ignore commands, ignoreEvents to ignore events, separate by comma or space, example: \"cmd1.js cmd2.js cmd3.js\" (without backslash)" - }, - "autoRefreshFbstate": true, - "autoReloginWhenChangeAccount": false, - "autoRestartWhenListenMqttError": false, - "restartListenMqtt": { - "enable": true, - "timeRestart": 3600000, - "delayAfterStopListening": 2000, - "logNoti": true, - "notes": "the value of timeRestart and delayAfterStopListening is milisecond, You shouldn't edit this if you don't know what it is" - }, - "notiWhenListenMqttError": { - "notes": "This is the message when the bot is listening to the mqtt server and the mqtt server stops working due to account problems such as: locked acc, blocked due to spam,... bot will automatically send notifications to parts of your settings. You must change enable to true to use this feature. See bot/login/handlerWhenListenHasError.js file for details on how it works", - "gmail": { - "enable": false, - "emailGetNoti": "", - "note": "Bot will use gmailAccount to send email to emailGetNoti, can send notifications to many email, separate by comma or space, example: \"example1@gmail.com example2@gmail.com\" (without backslash)" - }, - "telegram": { - "enable": false, - "botToken": "", - "chatId": "", - "note": "Can send notifications to many chatId, separate by comma or space, example: \"123456789 987654321\" (without backslash)" - }, - "discordHook": { - "enable": false, - "webhookUrl": "", - "note": "Can send notifications to many webhookUrl, separate by comma or space, example: \"https://discord.com/api/webhooks/123456789/123456789 https://discord.com/api/webhooks/987654321/987654321\" (without backslash)" - } - }, - "hideNotiMessage": { - "commandNotFound": false, - "adminOnly": false, - "threadBanned": false, - "userBanned": false, - "needRoleToUseCmd": false, - "needRoleToUseCmdOnReply": false, - "needRoleToUseCmdOnReaction": false - }, - "logEvents": { - "disableAll": false, - "message": true, - "message_reaction": true, - "message_unsend": true, - "message_reply": true, - "event": true, - "read_receipt": false, - "typ": false, - "presence": false - }, - "optionsFca": { - "forceLogin": true, - "listenEvents": true, - "updatePresence": true, - "listenTyping": true, - "logLevel": "error", - "selfListen": false, - "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.dev.json similarity index 99% rename from configCommands.json rename to configCommands.dev.json index a237fd95d..3f9d496ec 100644 --- a/configCommands.json +++ b/configCommands.dev.json @@ -29,4 +29,4 @@ "allow": true } } -} \ No newline at end of file +} diff --git a/languages/en.lang b/languages/en.lang index 644aa12a5..9ee5e5322 100644 --- a/languages/en.lang +++ b/languages/en.lang @@ -93,9 +93,9 @@ handlerEvents.userBanned=You have been banned from using the bot\n» Reason: %1\ handlerEvents.threadBanned=This group has been banned from using the bot\n» Reason: %1\n» Time: %2\n» Thread ID: %3 handlerEvents.onlyAdminBox=This group is currently enabled only group administrators can use the bot handlerEvents.onlyAdminBot=❌ | Currently only bot's admin can use bot -handlerEvents.commandNotFound=Command "%1" does not exist, type %2help to see all available commands -handlerEvents.commandNotFound2=The command you are using does not exist, type %1help to see all available commands -handlerEvents.commandSyntaxError=The command you are using is wrong syntax, please type %1help %2 to see the details of how to use this command +handlerEvents.commandNotFound=♥️ +handlerEvents.commandNotFound2=🥰 +handlerEvents.commandSyntaxError=Command Execution Error\nType %1help %2 to see the details of how to use this command handlerEvents.onlyAdmin=❌ | Only group administrators can use the command "%1" handlerEvents.onlyAdminToUseOnReply=❌ | Only group administrators can use the reply function of the command "%1" handlerEvents.onlyAdminToUseOnReaction=❌ | Only group administrators can use the reaction function of the command "%1" diff --git a/scripts/cmds/4k.js b/scripts/cmds/4k.js new file mode 100644 index 000000000..95d937aee --- /dev/null +++ b/scripts/cmds/4k.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: "download", + 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); + } + } +}; \ No newline at end of file diff --git a/scripts/cmds/ai.js b/scripts/cmds/ai.js new file mode 100644 index 000000000..55cceddec --- /dev/null +++ b/scripts/cmds/ai.js @@ -0,0 +1,66 @@ +const { getPrefix, getStreamFromURL, uploadImgbb } = global.utils; +async function ai({ message: m, event: e, args: a, usersData: u }) { + var p = [`${await getPrefix(e.threadID)}${this.config.name}`, +`${this.config.name}` +/*"ai" +*you can add more prefix here +*/ +]; + if (p.some(b => a[0].toLowerCase().startsWith(b))) { +try { +let prompt = ""; +if (e.type === "message_reply" && e.messageReply.attachments && e.messageReply.attachments[0]?.type === "photo") { + const b = await uploadImgbb(e.messageReply.attachments[0].url); +prompt = a.slice(1).join(" ") + ' ' + b.image.url; +} else { + prompt = a.slice(1).join(" "); +} + var __ = [{ id: e.senderID, tag: await u.getName(e.senderID) }]; + const r = await require("axios").post(`https://test-ai-ihc6.onrender.com/api`, { + prompt: prompt, + apikey: "GayKey-oWHmMb1t8ASljhpgSSUI", + name: __[0]['tag'], + id: __[0]['id'], + }); +var _ = r.data.result.replace(/{name}/g, __[0]['tag']).replace(/{pn}/g, p[0]); + if (r.data.av) { + if (Array.isArray(r.data.av)) { + const avs = r.data.av.map(url => getStreamFromURL(url)); + const avss = await Promise.all(avs); + m.reply({ + body: _, + mentions: __, + attachment: avss + }); + } else { + m.reply({ + body: _, + mentions: __, +attachment: await getStreamFromURL(r.data.av) + }); + } + } else { +m.reply({ +body: _, +mentions: __ + }); + } + } catch (error) { + m.reply("Error " + error); + } + } +} +module.exports = { +config: { + name: "ai", +aliases: [], +version: 1.6, +author: "Jun", +role: 0, + shortDescription: "An AI that can do various tasks", + guide: "{pn} ", + category: "AI" + }, + onStart: function() {}, + onChat: ai +}; \ No newline at end of file diff --git a/scripts/cmds/aniblur.js b/scripts/cmds/aniblur.js new file mode 100644 index 000000000..e1914784e --- /dev/null +++ b/scripts/cmds/aniblur.js @@ -0,0 +1,68 @@ +const axios = require("axios"); +const fs = require("fs-extra"); + +module.exports = { + config: { + name: "aniblur", + aliases: ["animeblur"], + version: "1.0", + author: "AceGun", + countDown: 5, + role: 0, + shortDescription: "", + longDescription: { + en: ".", + }, + category: "fun", + guide: { + en: "{prefix} ", + }, + }, + + onStart: async function ({ api, event }) { + const link = [ + "https://i.postimg.cc/QdzSzcM1/image.jpg", + "https://i.postimg.cc/QCSJJTPB/ros.jpg", + "https://i.postimg.cc/3xkF2WZR/Cybergot-Cute-anime-pics-Dark-anime-Anime-monochrome.jpg", + "https://i.postimg.cc/63XVscx2/Icon.jpg", + "https://i.postimg.cc/D0YbzdHc/11.jpg", + "https://i.postimg.cc/nLt9MLRN/12.jpg", + "https://i.postimg.cc/2601H7kf/zod-ac.jpg", + "https://i.postimg.cc/g0drmTrW/13.jpg", + "https://i.postimg.cc/CKN51sff/Pin-on-icons.jpg", + "https://i.postimg.cc/pr9LsNcD/14.jpg", + "https://i.postimg.cc/VLCNM8Cw/anime-avatar.jpg", + "https://i.postimg.cc/Z5my5RD2/15.jpg", + "https://i.postimg.cc/XqFpVSKn/https-youtube-com-channel-UC3l3cgr-BNj-W5n7de68os-Fnw.jpg", + "https://i.postimg.cc/dQd1ZFdY/Draincore-Icon-Aesthetic.jpg", + "https://i.postimg.cc/zXFGpk02/B-L-A-C-K-P-I-N-K-balasultan-krulus-anime-gothic-edits-dp-profile-insta.jpg", + "https://i.postimg.cc/MGvZ6Jxg/16.jpg", + "https://i.postimg.cc/76zxz15V/Bbbb.jpg", + "https://i.postimg.cc/Wp6VP1gh/image.jpg", + "https://i.postimg.cc/pTfwxs9g/17.jpg", + "https://i.postimg.cc/ZnjXv0xH/18.jpg", + "https://i.postimg.cc/vZ4CDYg7/image.jpg", + "https://i.postimg.cc/PfK74p1z/19.jpg", + "https://i.postimg.cc/mrQXFtb9/Icon.jpg", + "https://i.postimg.cc/9MbLJKwF/20.jpg", + "https://i.postimg.cc/v8PP9Rd0/distorted.jpg", + ]; + + const randomIndex = Math.floor(Math.random() * link.length); + const imageUrl = link[randomIndex]; + const filePath = __dirname + `/cache/${randomIndex}.jpg`; + + const response = await axios.get(imageUrl, { responseType: "stream" }); + response.data.pipe(fs.createWriteStream(filePath)); + response.data.on("end", () => { + api.sendMessage( + { + body: "「 Here is your aniblur avatar 🥰 」", + attachment: fs.createReadStream(filePath), + }, + event.threadID, + () => fs.unlinkSync(filePath) + ); + }); + }, +}; \ No newline at end of file diff --git a/scripts/cmds/anime.js b/scripts/cmds/anime.js new file mode 100644 index 000000000..7aade2dda --- /dev/null +++ b/scripts/cmds/anime.js @@ -0,0 +1,213 @@ +const { getStreamFromURL } = global.utils; +const axios = require("axios"); + +const API = 'https://anime-api.shahadat2006hh.workers.dev'; +const URL_SHORTENER_API = 'https://url6-9.onrender.com'; +const API_KEY = 'rehat-gay'; + +module.exports = { + config: { + name: "anime", + aliases: ["anime"], + version: "1.0", + author: "shahadat20066", + countDown: 5, + role: 0, + shortDescription: "Get anime data", + longDescription: "Search and get anime info", + category: "anime", + guide: { + en: "{pn} popular\n{pn} search \n\nExample:\n{pn} popular\n{pn} search Naruto" + } + }, + + onStart: async function ({ message, args, event }) { + if (args.length === 0) { + return message.reply(`⚠ | Please enter a command!`); + } + + const command = args[0]; + const query = args.slice(1).join(" "); + + try { + if (command.toLowerCase() === 'popular') { + const res = await axios.get(`${API}/gogoPopular/1`); + const animeList = res.data.results.slice(0, 6); + + if (animeList.length === 0) { + return message.reply(`🥺 Not Found`); + } + + let replyText = "===「 Popular Anime 」===\n\nReply the number which anime info you want to see\n\n"; + for (let i = 0; i < animeList.length; i++) { + const anime = animeList[i]; + replyText += `${i + 1}. 🔰 Title: ${anime.title}\n 🗓️ ${anime.releaseDate}\n\n`; + } + + const form = { + body: replyText, + attachment: await Promise.all(animeList.map(anime => getStreamFromURL(anime.image))) + }; + + message.reply(form, async (err, info) => { + if (!err) { + global.GoatBot.onReply.set(info.messageID, { + commandName: this.config.name, + messageID: info.messageID, + author: event.senderID, + type: 'searchResults', + data: animeList + }); + } + }); + + } else if (command.toLowerCase() === 'search') { + if (!query) { + return message.reply(`⚠ | Please enter anime name to search!`); + } + + const res = await axios.get(`${API}/search/${query}`); + const animeList = res.data.results.slice(0, 6); + + if (animeList.length === 0) { + return message.reply(`🥺 Not Found`); + } + + let replyText = `===「 Anime search result for: ${query} 」===\n\nReply the number which anime info you want to see\n\n`; + for (let i = 0; i < animeList.length; i++) { + const anime = animeList[i]; + replyText += `${i + 1}. 🔰 Title: ${anime.title}\n 🗓️ ${anime.releaseDate}\n\n`; + } + + const form = { + body: replyText, + attachment: await Promise.all(animeList.map(anime => getStreamFromURL(anime.img))) + }; + + message.reply(form, async (err, info) => { + if (!err) { + global.GoatBot.onReply.set(info.messageID, { + commandName: this.config.name, + messageID: info.messageID, + author: event.senderID, + type: 'searchResults', + data: animeList + }); + } + }); + + } else { + return message.reply(`⚠ | Invalid command!`); + } + + } catch (e) { + message.reply(`🥺 Not Found`); + console.error(e.message); + } + }, + + onReply: async function ({ message, event, Reply, args }) { + const { author, type, data, animeId, totalEp } = Reply; + if (event.senderID !== author) return; + + const selectedIndex = parseInt(args[0], 10) - 1; + if (isNaN(selectedIndex) || selectedIndex < 0 || selectedIndex >= data.length) { + return message.reply(`⚠ | Invalid selection!`); + } + + const selectedAnime = data[selectedIndex]; + + try { + if (type === 'searchResults') { + const res = await axios.get(`${API}/anime/${selectedAnime.id}`); + const animeInfo = res.data.results; + const episodes = animeInfo.episodes; + + let replyText = `===「 Anime Info 」===\n\n🔰 Name: ${animeInfo.name}\n🆎 Type: ${animeInfo.type}\n🎭 Genre: ${animeInfo.genre}\n📅 Release: ${animeInfo.released}\n📊 Status: ${animeInfo.status}\n🔠 Other name: ${animeInfo.other_name}\n📖 Total Episodes: ${episodes.length}\n🗒 ️Plot summary: ${animeInfo.plot_summary}\n\n(Reply the episode number which episode you want to get the download links.)`; + + const form = { + body: replyText, + attachment: await getStreamFromURL(animeInfo.image) + }; + + message.reply(form, async (err, info) => { + if (!err) { + global.GoatBot.onReply.set(info.messageID, { + commandName: this.config.name, + messageID: info.messageID, + author: event.senderID, + type: 'animeInfo', + data: episodes, + animeId: selectedAnime.id, + totalEp: episodes.length, + infoImg: animeInfo.image + }); + } + }); + + } else if (type === 'animeInfo') { + const episodeNumber = parseInt(args[0], 10); + if (isNaN(episodeNumber) || episodeNumber < 1 || episodeNumber > totalEp) { + return message.reply(`⚠ | Please enter a valid episode number!`); + } + + const episodeId = `${animeId}-episode-${episodeNumber}`; + + const res = await axios.get(`${API}/download/${episodeId}`); + const downloadLinks = res.data.results; + + let replyText = `Here is your episode ${episodeNumber} download link senpai\n\n(Reply the episode number on the previous message which episode you want to get the download links again)\n\n`; + const qualities = ['640x360', '854x480', '1280x720', '1920x1080']; + + for (const quality of qualities) { + if (downloadLinks[quality]) { + const url = downloadLinks[quality]; + const shortRes = await axios.get(`${URL_SHORTENER_API}/?url=${encodeURIComponent(url)}&apikey=${API_KEY}`); + replyText += `${quality}: ${shortRes.data.shortUrl}\n\n`; + } + } + + message.reply(replyText, async (err, info) => { + if (!err) { + global.GoatBot.onReply.set(info.messageID, { + commandName: this.config.name, + messageID: info.messageID, + author: event.senderID, + type: 'downloadLinks', + data: downloadLinks, + animeId: animeId, + totalEp: totalEp + }); + } + }); + } + } catch (e) { + message.reply(`🥺 An error occurred`); + console.error(e.message); + } + } +}; + +async function search(query) { + const url = `${API}/search/${query}`; + const response = await axios.get(url); + return response.data; +}; + +async function getInfo(id) { + const url = `${API}/anime/${id}`; + const response = await axios.get(url); + return response.data; +}; + +async function watch(id) { + const url = `${API}/episode/${id}`; + const response = await axios.get(url); + return response.data; +} + +async function download(id) { + const url = `${API}/download/${id}`; + const response = await axios.get(url); + return response.data; +} diff --git a/scripts/cmds/aninews.js b/scripts/cmds/aninews.js new file mode 100644 index 000000000..49c39663f --- /dev/null +++ b/scripts/cmds/aninews.js @@ -0,0 +1,36 @@ +const malScraper = require('mal-scraper'); + +module.exports = { + config: { + name: "aninews", + aliases: ["animenews"], + version: "1.0", + author: "Samir", + countDown: 5, + role: 0, + shortDescription: { + en: "get latest news of anime from MyAnimeList" + }, + longDescription: { + en: "get latest news of anime from MyAnimeList" + }, + category: "Anime", + guide: { + en: "{p}malnews" + } + }, + onStart: async function ({ api, event }) { + const nbNews = 5; + + malScraper.getNewsNoDetails(nbNews) + .then((n) => api.sendMessage( + "TOP 5 LATEST MAL NEWS\n\n『 1 』" + n[0].title + "\n\n『 2 』" + n[1].title + "\n\n『 3 』" + n[2].title + "\n\n『 4 』" + n[3].title + "\n\n『 5 』" + n[4].title, + event.threadID, + event.messageID + )) + .catch((err) => { + console.error(err); + api.sendMessage("Sorry, something went wrong while fetching the news.", event.threadID); + }); + } +}; diff --git a/scripts/cmds/anistatus.js b/scripts/cmds/anistatus.js new file mode 100644 index 000000000..0ee6d53f0 --- /dev/null +++ b/scripts/cmds/anistatus.js @@ -0,0 +1,87 @@ +const axios = require("axios"); +const fs = require("fs-extra"); + + +module.exports = { + + threadStates: {}, + + config: { + name: 'anistatus', + aliases: ['as'], + version: '1.0', + author: 'HeDroxyy', + countDown: 5, + role: 0, + shortDescription: 'anime status', + longDescription: '', + category: 'media', + guide: { + en: '{p}{n}', + } + }, + + + onStart: async function ({ api, event }) { + const threadID = event.threadID; + + if (!this.threadStates[threadID]) { + this.threadStates[threadID] = {}; + } + + try { + api.setMessageReaction("🕐", event.messageID, (err) => {}, true); + + const apiUrl = "https://ani-status.vercel.app/kshitiz"; + const response = await axios.get(apiUrl); + + if (response.data.url) { + const tikTokUrl = response.data.url; + console.log(`TikTok Video URL: ${tikTokUrl}`); + + const lado = `https://tikdl-video.vercel.app/tiktok?url=${encodeURIComponent(tikTokUrl)}`; + const puti = await axios.get(lado); + + if (puti.data.videoUrl) { + const videoUrl = puti.data.videoUrl; + console.log(`Downloadable Video URL: ${videoUrl}`); + + const cacheFilePath = __dirname + `/cache/${Date.now()}.mp4`; + await this.downloadVideo(videoUrl, cacheFilePath); + + if (fs.existsSync(cacheFilePath)) { + await api.sendMessage({ + body: "Random anime status video.", + attachment: fs.createReadStream(cacheFilePath), + }, threadID, event.messageID); + + fs.unlinkSync(cacheFilePath); + } else { + api.sendMessage("Error downloading the video.", threadID); + } + } else { + api.sendMessage("Error fetching video URL.", threadID); + } + } else { + api.sendMessage("Error fetching data from external API.", threadID); + } + } catch (err) { + console.error(err); + api.sendMessage("An error occurred while processing the anistatus command.", threadID); + } + }, + + downloadVideo: async function (url, cacheFilePath) { + try { + const response = await axios({ + method: "GET", + url: url, + responseType: "arraybuffer" + }); + + fs.writeFileSync(cacheFilePath, Buffer.from(response.data, "utf-8")); + } catch (err) { + console.error(err); + } + }, +}; diff --git a/scripts/cmds/antiout.js b/scripts/cmds/antiout.js new file mode 100644 index 000000000..2a66b8814 --- /dev/null +++ b/scripts/cmds/antiout.js @@ -0,0 +1,48 @@ +module.exports = { + config: { + name: "antiout", + version: "1.0", + author: "AceGun", + countDown: 5, + role: 0, + shortDescription: "Enable or disable antiout", + longDescription: "", + category: "boxchat", + guide: "{pn} {{[on | off]}}", + envConfig: { + deltaNext: 5 + } + }, + onStart: async function({ message, event, threadsData, args }) { + let antiout = await threadsData.get(event.threadID, "settings.antiout"); + if (antiout === undefined) { + await threadsData.set(event.threadID, true, "settings.antiout"); + antiout = true; + } + if (!["on", "off"].includes(args[0])) { + return message.reply("Please use 'on' or 'off' as an argument"); + } + await threadsData.set(event.threadID, args[0] === "on", "settings.antiout"); + return message.reply(`Antiout has been ${args[0] === "on" ? "enabled" : "disabled"}.`); + }, + onEvent: async function({ api, event, threadsData }) { + const antiout = await threadsData.get(event.threadID, "settings.antiout"); + if (antiout && event.logMessageData && event.logMessageData.leftParticipantFbId) { + // A user has left the chat, get their user ID + const userId = event.logMessageData.leftParticipantFbId; + + // Check if the user is still in the chat + const threadInfo = await api.getThreadInfo(event.threadID); + const userIndex = threadInfo.participantIDs.indexOf(userId); + if (userIndex === -1) { + // The user is not in the chat, add them back + const addUser = await api.addUserToGroup(userId, event.threadID); + if (addUser) { + console.log(`User ${userId} was added back to the chat.`); + } else { + console.log(`Failed to add user ${userId} back to the chat.`); + } + } + } + } +}; \ No newline at end of file diff --git a/scripts/cmds/arrest.js b/scripts/cmds/arrest.js new file mode 100644 index 000000000..5b59d62d4 --- /dev/null +++ b/scripts/cmds/arrest.js @@ -0,0 +1,49 @@ +const axios = require('axios'); +const jimp = require("jimp"); +const fs = require("fs") + +module.exports = { + config: { + name: "arrest", + aliases: ["arrest"], + version: "1.0", + author: "milan-says", + countDown: 5, + role: 0, + shortDescription: "arret the rapist", + longDescription: "", + category: "image", + guide: { + vi: "{pn} [@tag]", + en: "{pn} [@tag]" + } + }, + + onStart: async function ({ message, args,api , event, user }) { + const mention = Object.keys(event.mentions); + if (mention.length == 0) return message.reply("please mention someone"); + else if (mention.length == 1) { + const one = event.senderID, two = mention[0]; + bal(one, two).then(ptth => { message.reply({ body: "You are under arrest", attachment: fs.createReadStream(ptth) }) }) + } else { + const one = mention[1], two = mention[0]; + bal(one, two).then(ptth => { message.reply({ body: "You are under arrest", attachment: fs.createReadStream(ptth) }) }) + } + } + + +}; + +async function bal(one, two) { + + let avone = await jimp.read(`https://graph.facebook.com/${one}/picture?width=512&height=512&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662`) + avone.circle() + let avtwo = await jimp.read(`https://graph.facebook.com/${two}/picture?width=512&height=512&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662`) + avtwo.circle() + let pth = "fak.png" + let img = await jimp.read("https://i.imgur.com/ep1gG3r.png") + img.resize(500, 500).composite(avone.resize(100, 100), 375, 9).composite(avtwo.resize(100, 100), 160, 92); + + await img.writeAsync(pth) + return pth + } \ No newline at end of file diff --git a/scripts/cmds/audio.js b/scripts/cmds/audio.js new file mode 100644 index 000000000..20e817d81 --- /dev/null +++ b/scripts/cmds/audio.js @@ -0,0 +1,83 @@ +const fs = require('fs'); +module.exports = { + config: { + name: "audio", + version: "1.0", + author: "AceGun", + countDown: 5, + role: 0, + shortDescription: "no prefix", + longDescription: "no prefix", + category: "no prefix", + }, + onStart: async function(){}, + onChat: async function({ event, message, getLang }) { + if (event.body) { + const word = event.body.toLowerCase(); + switch (word) { + case "women": + return message.reply({ + body: "「 Women ☕ 」", + attachment: fs.createReadStream("women.mp3"), + }); + case "yamate": + return message.reply({ + body: "「 Yamate 🥵 」", + attachment: fs.createReadStream("yamate.mp3"), + }); + case "dazai": + return message.reply({ + body: "「 ahhh~ 」", + attachment: fs.createReadStream("Dazai.mp3"), + }); + case "ara": + return message.reply({ + body: "「 ara ara 」", + attachment: fs.createReadStream("ara.mp3"), + }); + case "good night": + return message.reply({ + body: "「 Good Night 🌉 」", + attachment: fs.createReadStream("night.mp3"), + }); + case "sus": + return message.reply({ + body: "「 ඞ 」", + attachment: fs.createReadStream("sus.mp3"), + }); + case "good morning": + return message.reply({ + body: "「 Good Morning 🌄 」", + attachment: fs.createReadStream("gm.mp3"), + }); + case "yourmom": + return message.reply({ + body: "「 Bujis ki nai? 」", + attachment: fs.createReadStream("yourmom.mp3"), + }); + case "machikney": + return message.reply({ + body: "「 Machikney 」", + attachment: fs.createReadStream("machikney.mp3"), + }); + case "randi": + return message.reply({ + body: "「 Randi ko Chora 」", + attachment: fs.createReadStream("randi.mp3"), + }); + case "sachiin": + return message.reply({ + body: " 「 GAYY 」", + attachment : fs.creatReadStream("sachiin.mp3"), + }); + case "omg": + return message.reply({ + body: "「 OMG WoW 😳 」", + attachment: fs.createReadStream("omg.mp3"), + }); + default: + return; + } + } + } +}; \ No newline at end of file diff --git a/scripts/cmds/autolink.js b/scripts/cmds/autolink.js new file mode 100644 index 000000000..7ba4c35bd --- /dev/null +++ b/scripts/cmds/autolink.js @@ -0,0 +1,462 @@ +const fs = require("fs-extra"); +const axios = require("axios"); +const cheerio = require("cheerio"); +const qs = require("qs"); +const { getStreamFromURL, shortenURL, randomString } = global.utils; + +function loadAutoLinkStates() { + try { + const data = fs.readFileSync("autolink.json", "utf8"); + return JSON.parse(data); + } catch (err) { + return {}; + } +} + +function saveAutoLinkStates(states) { + fs.writeFileSync("autolink.json", JSON.stringify(states, null, 2)); +} + +let autoLinkStates = loadAutoLinkStates(); + +module.exports = { + threadStates: {}, + config: { + name: 'autolink', + version: '4.0', + author: 'Vex_Kshitiz', + countDown: 5, + role: 0, + shortDescription: 'Auto video downloader for Instagram, Facebook, TikTok, Twitter, Pinterest and YouTube', + longDescription: '', + category: 'media', + guide: { + en: '{p}{n}', + } + }, + onStart: async function ({ api, event }) { + const threadID = event.threadID; + + if (!autoLinkStates[threadID]) { + autoLinkStates[threadID] = 'on'; + saveAutoLinkStates(autoLinkStates); + } + + if (!this.threadStates[threadID]) { + this.threadStates[threadID] = {}; + } + + if (event.body.toLowerCase().includes('autolink off')) { + autoLinkStates[threadID] = 'off'; + saveAutoLinkStates(autoLinkStates); + api.sendMessage("AutoLink is now turned off for this chat.", event.threadID, event.messageID); + } else if (event.body.toLowerCase().includes('autolink on')) { + autoLinkStates[threadID] = 'on'; + saveAutoLinkStates(autoLinkStates); + api.sendMessage("AutoLink is now turned on for this chat.", event.threadID, event.messageID); + } + }, + onChat: async function ({ api, event }) { + const threadID = event.threadID; + + if (this.checkLink(event.body)) { + const { url } = this.checkLink(event.body); + console.log(`Attempting to download from URL: ${url}`); + if (autoLinkStates[threadID] === 'on' || !autoLinkStates[threadID]) { + this.downLoad(url, api, event); + } else { + api.sendMessage("", event.threadID, event.messageID); + } + api.setMessageReaction("🕐", event.messageID, (err) => {}, true); + } + }, + downLoad: async function (url, api, event) { + const startTime = Date.now(); + const path = __dirname + `/cache/${startTime}.mp4`; + + let estimatedTime = ''; + let videoUrl = ''; + + try { + if (url.includes("instagram")) { + videoUrl = await this.downloadInstagram(url, api, event, path); + } else if (url.includes("facebook") || url.includes("fb.watch")) { + videoUrl = await this.downloadFacebook(url, api, event, path); + } else if (url.includes("tiktok")) { + videoUrl = await this.downloadTikTok(url, api, event, path); + } else if (url.includes("x.com")) { + videoUrl = await this.downloadTwitter(url, api, event, path); + } else if (url.includes("pin.it")) { + videoUrl = await this.downloadPinterest(url, api, event, path); + } else if (url.includes("youtu")) { + videoUrl = await this.downloadYouTube(url, api, event, path); + } + + const endTime = Date.now(); + estimatedTime = ((endTime - startTime) / 1000).toFixed(2) + ' seconds'; + } catch (err) { + console.error(err); + api.sendMessage("An error occurred while processing your request.", event.threadID, event.messageID); + return; + } + + api.sendMessage(`It Would Probably Take : ${estimatedTime}`, event.threadID, event.messageID); + }, + downloadInstagram: async function (url, api, event, path) { + const startTime = Date.now(); + 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")); + const endTime = Date.now(); + console.log(`Instagram download completed in ${(endTime - startTime) / 1000} seconds`); + + if (fs.statSync(path).size / 1024 / 1024 > 25) { + api.sendMessage("The file is too large, cannot be sent", event.threadID, () => fs.unlinkSync(path), event.messageID); + } else { + 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); + } + + return res; + }, + downloadFacebook: async function (url, api, event, path) { + const startTime = Date.now(); + 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) { + api.sendMessage("The file is too large, cannot be sent", event.threadID, () => fs.unlinkSync(path), event.messageID); + } else { + 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); + } + const endTime = Date.now(); + console.log(`Facebook download completed in ${(endTime - startTime) / 1000} seconds`); + + return res.download[0].url; + }, + downloadTikTok: async function (url, api, event, path) { + const startTime = Date.now(); + const res = await axios.get(`https://tikdl-video.vercel.app/tiktok?url=${encodeURIComponent(url)}`); + if (res.data.videoUrl) { + const videoUrl = res.data.videoUrl; + const response = await axios({ + method: "GET", + url: videoUrl, + responseType: "stream" + }); + if (response.headers['content-length'] > 87031808) { + api.sendMessage("The file is too large, cannot be sent", event.threadID, () => fs.unlinkSync(path), event.messageID); + } else { + 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); + } + const endTime = Date.now(); + console.log(`TikTok download completed in ${(endTime - startTime) / 1000} seconds`); + + return res.data.videoUrl; + }, + downloadTwitter: async function (url, api, event, path) { + const startTime = Date.now(); + const res = await axios.get(`https://xdl-twitter.vercel.app/kshitiz?url=${encodeURIComponent(url)}`); + const videoUrl = res.data.videoUrl; + + const response = await axios({ + method: "GET", + url: videoUrl, + responseType: "stream" + }); + + if (response.headers['content-length'] > 87031808) { + api.sendMessage("The file is too large, cannot be sent", event.threadID, () => fs.unlinkSync(path), event.messageID); + } else { + 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); + }); + } + const endTime = Date.now(); + console.log(`Twitter download completed in ${(endTime - startTime) / 1000} seconds`); + + return videoUrl; + }, + downloadPinterest: async function (url, api, event, path) { + const startTime = Date.now(); + const res = await axios.get(`https://pindl-pinterest.vercel.app/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) { + api.sendMessage("The file is too large, cannot be sent", event.threadID, () => fs.unlinkSync(path), event.messageID); + } else { + 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); + }); + } + const endTime = Date.now(); + console.log(`Pinterest download completed in ${(endTime - startTime) / 1000} seconds`); + + return videoUrl; + }, + downloadYouTube: async function (url, api, event, path) { + const startTime = Date.now(); + const res = await axios.get(`https://yt-downloader-eta.vercel.app/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) { + api.sendMessage("The file is too large, cannot be sent", event.threadID, () => fs.unlinkSync(path), event.messageID); + } else { + 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); + }); + } + const endTime = Date.now(); + console.log(`YouTube download completed in ${(endTime - startTime) / 1000} seconds`); + + return videoUrl; + }, + getLink: function (url, api, event, path) { + return new Promise((resolve, reject) => { + if (url.includes("instagram")) { + axios({ + method: "GET", + url: `https://insta-kshitiz.vercel.app/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")) { + axios.get(`https://tikdl-video.vercel.app/tiktok?url=${encodeURIComponent(url)}`) + .then(res => { + if (res.data.videoUrl) { + resolve(res.data.videoUrl); + } else { + reject(new Error("Invalid response from the TikTok API")); + } + }) + .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") || + url.includes("youtu") + ) { + 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/autoseen.js b/scripts/cmds/autoseen.js new file mode 100644 index 000000000..c1cf53aae --- /dev/null +++ b/scripts/cmds/autoseen.js @@ -0,0 +1,37 @@ +let autoseenEnabled = false; + +module.exports = { + config: { + name: "autoseen", + version: "1.0", + author: "hedroxyy", + countDown: 15, + role: 0, + shortDescription: "Toggle autoseen feature on or off", + longDescription: "Enable or disable the autoseen feature which marks all messages as read automatically.", + category: "owner", + guide: { + en: "{pn} on/off" + } + }, + + onStart: async function ({ api, message, args }) { + const subCommand = args[0]; + + if (subCommand === "on") { + autoseenEnabled = true; + message.reply("✅ | Autoseen feature has been enabled."); + } else if (subCommand === "off") { + autoseenEnabled = false; + message.reply("✅ | Autoseen feature has been disabled."); + } else { + message.reply("Usage: {pn} on/off"); + } + }, + + onChat: async function ({ api }) { + if (autoseenEnabled) { + api.markAsReadAll(); + } + } +}; diff --git a/scripts/cmds/bin.js b/scripts/cmds/bin.js new file mode 100644 index 000000000..4ea4de32e --- /dev/null +++ b/scripts/cmds/bin.js @@ -0,0 +1,59 @@ +const PastebinAPI = require('pastebin-js'); +const fs = require('fs'); +const path = require('path'); + +module.exports = { + config: { + name: "bin", + version: "1.0", + author: "SANDIP", + countDown: 5, + role: 0, + 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: "owner", + 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(`${rawPaste}`, event.threadID); + }); + }, +}; \ No newline at end of file diff --git a/scripts/cmds/bio.js b/scripts/cmds/bio.js new file mode 100644 index 000000000..9b77e68f9 --- /dev/null +++ b/scripts/cmds/bio.js @@ -0,0 +1,25 @@ +module.exports = { + config: { + name: "bio", + version: "1.7", + author: "xemon", + countDown: 5, + role: 2, + shortDescription: { + vi: " ", + en: "change bot bio ", + }, + longDescription: { + vi: " ", + en: "change bot bio ", + }, + category: "owner", + guide: { + en: "{pn} (text)", + }, + }, + onStart: async function ({ args, message, api }) { + api.changeBio(args.join(" ")); + message.reply("change bot bio to:" + args.join(" ")); + }, +}; \ No newline at end of file diff --git a/scripts/cmds/busy.js b/scripts/cmds/busy.js index 8eb91fa2c..04514ddfe 100644 --- a/scripts/cmds/busy.js +++ b/scripts/cmds/busy.js @@ -7,7 +7,7 @@ module.exports = { version: "1.6", author: "NTKhang", countDown: 5, - role: 0, + role: 2, description: { vi: "bật chế độ không làm phiền, khi bạn được tag bot sẽ thông báo", en: "turn on do not disturb mode, when you are tagged bot will notify" @@ -76,4 +76,4 @@ module.exports = { } } } -}; \ No newline at end of file +}; diff --git a/scripts/cmds/callad.js b/scripts/cmds/callad.js index eaa631787..10d01e286 100644 --- a/scripts/cmds/callad.js +++ b/scripts/cmds/callad.js @@ -4,11 +4,15 @@ const mediaTypes = ["photo", 'png', "animated_image", "video", "audio"]; module.exports = { config: { name: "callad", - version: "1.7", + version: "1.6", author: "NTKhang", countDown: 5, role: 0, - description: { + shortDescription: { + vi: "gửi tin nhắn về admin bot", + en: "send message to admin bot" + }, + longDescription: { vi: "gửi báo cáo, góp ý, báo lỗi,... của bạn về admin bot", en: "send report, feedback, bug,... to admin bot" }, diff --git a/scripts/cmds/cat.js b/scripts/cmds/cat.js new file mode 100644 index 000000000..d90dc6611 --- /dev/null +++ b/scripts/cmds/cat.js @@ -0,0 +1,63 @@ +const axios = require('axios'); + +module.exports = { + config: { + name: 'cat', + aliases: ['catfact'], + version: '1.1', + author: 'JV', + role: 0, + category: 'utility', + shortDescription: { + en: 'Sends a random cat image with a fact.' + }, + longDescription: { + en: 'Sends a random cat image fetched from the CatAPI along with an interesting cat fact.' + }, + guide: { + en: '{pn}' + } + }, + onStart: async function ({ api, event }) { + try { + const [imageResponse, factResponse] = await Promise.all([ + axios.get('https://api.thecatapi.com/v1/images/search'), + axios.get('https://catfact.ninja/facts') + ]); + + if (imageResponse.status !== 200 || !imageResponse.data || !imageResponse.data[0] || !imageResponse.data[0].url) { + throw new Error('Invalid or missing response from CatAPI'); + } + + if (factResponse.status !== 200 || !factResponse.data || !factResponse.data.data || factResponse.data.data.length === 0) { + throw new Error('Invalid or missing cat facts'); + } + + const imageURL = imageResponse.data[0].url; + const facts = factResponse.data.data; + + const randomFactIndex = Math.floor(Math.random() * facts.length); + const factText = facts[randomFactIndex].fact; + + const stream = await global.utils.getStreamFromURL(imageURL); + + if (!stream) { + throw new Error('Failed to fetch image from URL'); + } + + const messageID = await api.sendMessage({ + body: factText, + attachment: stream + }, event.threadID); + + if (!messageID) { + throw new Error('Failed to send message with attachment'); + } + + console.log(`Sent cat image with message ID ${messageID}`); + } catch (error) { + console.error(`Failed to send cat image: ${error.message}`); + api.sendMessage('Sorry, something went wrong while trying to send a cat image. Please try again later.', event.threadID); + } + } +}; \ No newline at end of file diff --git a/scripts/cmds/cdp.js b/scripts/cmds/cdp.js new file mode 100644 index 000000000..b6d4e65eb --- /dev/null +++ b/scripts/cmds/cdp.js @@ -0,0 +1,48 @@ +const axios = require("axios"); +const fs = require("fs-extra"); + +module.exports = { + config: { + name: "cdp", + aliases: ["coupledp"], + version: "1.0", + author: "Rishad", + countDown: 5, + role: 0, + shortDescription: { + en: "couple dp" + }, + longDescription: { + en: "couple dp" + }, + category: "image", + guide: { + en: "{pn}" + } + }, + + onStart: async function ({ api, event, args }) { + try { + const { data } = await axios.get( + "https://erdwpe-api.herokuapp.com/api/randomgambar/couplepp" + ); + const maleImg = await axios.get(data.male, { responseType: "arraybuffer" }); + fs.writeFileSync(__dirname + "/tmp/img1.png", Buffer.from(maleImg.data, "utf-8")); + const femaleImg = await axios.get(data.female, { responseType: "arraybuffer" }); + fs.writeFileSync(__dirname + "/tmp/img2.png", Buffer.from(femaleImg.data, "utf-8")); + + const msg = "Here is your couple dp"; + const allImages = [ + fs.createReadStream(__dirname + "/tmp/img1.png"), + fs.createReadStream(__dirname + "/tmp/img2.png") + ]; + + return api.sendMessage({ + body: msg, + attachment: allImages + }, event.threadID, event.messageID); + } catch (error) { + console.error(error); + } + } +}; \ No newline at end of file diff --git a/scripts/cmds/cdp2.js b/scripts/cmds/cdp2.js new file mode 100644 index 000000000..9c481e867 --- /dev/null +++ b/scripts/cmds/cdp2.js @@ -0,0 +1,48 @@ +const axios = require("axios"); +const fs = require("fs-extra"); + +module.exports = { + config: { + name: "cdp2", + aliases: ["dp2"], + version: "1.0", + author: "Samir", + countDown: 5, + role: 0, + shortDescription: { + en: "couple dp" + }, + longDescription: { + en: "couple dp" + }, + category: "love", + guide: { + en: "{pn}" + } + }, + + onStart: async function ({ api, event, args }) { + try { + const { data } = await axios.get( + "https://api.zahwazein.xyz/randomanime/couples?apikey=zenzkey_92d341a7630e" + ); + const maleImg = await axios.get(data.result.male, { responseType: "arraybuffer" }); + fs.writeFileSync(__dirname + "/tmp/img1.png", Buffer.from(maleImg.data, "utf-8")); + const femaleImg = await axios.get(data.result.female, { responseType: "arraybuffer" }); + fs.writeFileSync(__dirname + "/tmp/img2.png", Buffer.from(femaleImg.data, "utf-8")); + + const msg = "Here's Couple DP"; + const allImages = [ + fs.createReadStream(__dirname + "/tmp/img1.png"), + fs.createReadStream(__dirname + "/tmp/img2.png") + ]; + + return api.sendMessage({ + body: msg, + attachment: allImages + }, event.threadID, event.messageID); + } catch (error) { + console.error(error); + } + } +}; \ No newline at end of file diff --git a/scripts/cmds/cdp3.js b/scripts/cmds/cdp3.js new file mode 100644 index 000000000..11fc6ad47 --- /dev/null +++ b/scripts/cmds/cdp3.js @@ -0,0 +1,48 @@ +const axios = require("axios"); +const fs = require("fs-extra"); + +module.exports = { + config: { + name: "cdp3", + aliases: ["cdp"], + version: "1.0", + author: "XyryllPanget", + countDown: 5, + role: 0, + shortDescription: { + en: "couple dp" + }, + longDescription: { + en: "couple dp" + }, + category: "image", + guide: { + en: "{pn}" + } + }, + + onStart: async function ({ api, event, args }) { + try { + const { data } = await axios.get( + "https://tanjiro-api.onrender.com/cdp?api_key=tanjiro" + ); + const maleImg = await axios.get(data.male, { responseType: "arraybuffer" }); + fs.writeFileSync(__dirname + "/tmp/img1.png", Buffer.from(maleImg.data, "utf-8")); + const femaleImg = await axios.get(data.female, { responseType: "arraybuffer" }); + fs.writeFileSync(__dirname + "/tmp/img2.png", Buffer.from(femaleImg.data, "utf-8")); + + const msg = "「 Here's your pair Dp✨ 」"; + const allImages = [ + fs.createReadStream(__dirname + "/tmp/img1.png"), + fs.createReadStream(__dirname + "/tmp/img2.png") + ]; + + return api.sendMessage({ + body: msg, + attachment: allImages + }, event.threadID, event.messageID); + } catch (error) { + console.error(error); + } + } +}; \ No newline at end of file diff --git a/scripts/cmds/clear.js b/scripts/cmds/clear.js new file mode 100644 index 000000000..6f8f8f5aa --- /dev/null +++ b/scripts/cmds/clear.js @@ -0,0 +1,64 @@ +const fs = require('fs'); +const path = require('path'); + +module.exports = { + config: { + name: "clean", + aliases: [],//["c"] add aliases like that + author: "kshitiz", + version: "2.0", + cooldowns: 5, + role: 2, + shortDescription: { + en: "" + }, + longDescription: { + en: "help to clean cache and tmp folder" + }, + category: "𝗢𝗪𝗡𝗘𝗥", + guide: { + en: "{p}{n}" + } + }, + onStart: async function ({ api, event }) { + const cacheFolderPath = path.join(__dirname, 'cache'); + const tmpFolderPath = path.join(__dirname, 'tmp'); + + + api.sendMessage({ body: 'Cleaning cache and tmp folders...', attachment: null }, event.threadID, () => { + + const cleanFolder = (folderPath) => { + + if (fs.existsSync(folderPath)) { + + const files = fs.readdirSync(folderPath); + + if (files.length > 0) { + + files.forEach(file => { + const filePath = path.join(folderPath, file); + + fs.unlinkSync(filePath); + console.log(`File ${file} deleted successfully from ${folderPath}!`); + }); + + console.log(`All files in the ${folderPath} folder deleted successfully!`); + } else { + console.log(`${folderPath} folder is empty.`); + } + } else { + console.log(`${folderPath} folder not found.`); + } + }; + + + cleanFolder(cacheFolderPath); + + + cleanFolder(tmpFolderPath); + + + api.sendMessage({ body: 'Cache and tmp folders cleaned successfully!' }, event.threadID); + }); + }, +}; diff --git a/scripts/cmds/clown.js b/scripts/cmds/clown.js new file mode 100644 index 000000000..3d6922c0b --- /dev/null +++ b/scripts/cmds/clown.js @@ -0,0 +1,41 @@ +module.exports = { + config: { + name: "clown", + aliases: ["clown"], + version: "1.0", + author: "otineeeyyyy", + shortDescription: "make clown images on someone photo someone", + longDescription: "make clown images on someone photo someone", + category: "fun", + guide: "{pn} @mention/reply" + }, + + async onStart({ api, event, usersData }) { + try { + const mention = Object.keys(event.mentions); + let imageLink = ""; + + if (mention.length === 0) { + //replied user + if(event.type == "message_reply"); + imageLink = await usersData.getAvatarUrl(event.messageReply.senderID); + } else { + //mentioned user + const mentionedUserID = mention[0]; + imageLink = await usersData.getAvatarUrl(mentionedUserID); + } + + const gifURL = `https://api.popcat.xyz/clown?image=${encodeURIComponent(imageLink)}`; + + const message = { + body: "Haha clown🤡", + attachment: [await global.utils.getStreamFromURL(gifURL)] + }; + + api.sendMessage(message, event.threadID, event.messageID); + } catch (err) { + console.error(err); + api.sendMessage("please mention or reply to someone", event.threadID, event.messageID); + } + } +}; \ No newline at end of file diff --git a/scripts/cmds/cmdstore.js b/scripts/cmds/cmdstore.js new file mode 100644 index 000000000..b56f1c6d4 --- /dev/null +++ b/scripts/cmds/cmdstore.js @@ -0,0 +1,96 @@ +const axios = require("axios"); + +module.exports = { + config: { + name: 'cmdstore', + version: '1.0', + aliases: ["cs"], + 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/dalle.js b/scripts/cmds/dalle.js new file mode 100644 index 000000000..b26ac2e0f --- /dev/null +++ b/scripts/cmds/dalle.js @@ -0,0 +1,50 @@ +const axios = require("axios"); +const fs = require("fs-extra"); +const path = require("path"); +const KievRPSSecAuth = "FABiBBRaTOJILtFsMkpLVWSG6AN6C/svRwNmAAAEgAAACB7XzbV/L0yBIASeHjI15Ymz3cZkIYmaOIqyGPpPayuC6p8qVTsKI2cccUit00w2ZzCDVr6Pw2+I4H7cMXIWv2M1nWNjBIbkpsZG3L4j5ZNqcvrrcWKlUvAIjGefFfsYQEj0LN1FiAv5LmvNe+FnZXoaVJN1sDK2b89QvRSmaOknIT3PLiE+pyiNjYmGsWAjFJF/Dn7cUNAHtLrewg4ejVqPlEP+g3G+VwLZwYDVk0TazTeu3VK0OA8DB/0/QMXDmccJE3zf8zvCeccUjEpLrIHgfb4NSXfbbIewiba3bx3+HBml8sAJIXDaqA5i324dBjMYowIRJvGeHI5S5kvYsK0a2E8JsQqhHkv50fYAvsdt3e07lzdrK+MPW4zmxMzfmzeUjrDwbPeM1ryvVngUrc8RMP39KNrYlf1PG4pKUFnwFoYbTLkZ8zWWu8LzAhVOzkgm8i4nzav746SO0Hcu7lEEKk8xAhfOiwafi+Z+JIgGP/yjqn3s2kY9GEXnoF21vI0uotbbUjIhwbvSNo2TJu44w2FvSiPLPq+7lUHa/0icrJAXGSo+vA1o6pWk4J18KVjO1oemM0adK8am3tFAposZ4kq6hOZGFJopebuUhzSQCSEURsY5HpMmNb4dW5CWpAv6t9WMRtfUIphFRIg+MwvzHV306aCw0CH0HIKAcoQ2nE2d+E+0UnlYRRxBPd9NvT+5zOfAZL09SoKoYW/8153ADnvLCyaCHOQm5CYMt7vxfiI98bkhfg0W8myuafed/5HdsHR8KEsSXhsAhyhePpFboe3eKf8B6dBfnnOfoj2WH6JLW2nNtNlihVCgPPCfGRKe3nAOqBTNQVwaUKE4lPRMHX8y1mLd1pMA6boYphv+2MuIg/NKK8Bs2JH/KCJYanAAZdK8W9rRpB1wM9mEOBdRDCaFSyDS2XL0PIp+0S+aRsuSham4vVEAl9OlNt0NGOP5YaI2KzHkz2nYXSiW+IjFkSB5QoCbpuJUuJWftPD+MZ5l1DGki0M8SHNw8dLTv1Cnt0sHXpvpXpwG6X/xbQzHpawZQaGrSLgeSj1vxHU9pLKaxkfhdWrIkKgF8K944isYjPcp0HER0+YbIm+S+oNCojbQHivD8THoDl8rfQV2AjtWJ+IUnt4EskZb/v3UzuErWfW89uAH2zVcFg/Bz/u3vpFYciisM34UFXr4SiwuCq5t+v1OrzixLRwBLz8nTyCw7Wva1d0FV9fAI9e0ZSsa6wMnj26lZw1XF3bulMi9XBhQzn51Sjte6bJ3L0kuo5exgmH8pCPm4LIU2rMHb+TjBJ+pRHgTSww1Q5+IydYupBgpYybd7zitbPzN9fEYffGwleNa1dAzcDyT5NlSj2zKqanFcKpVLrngQvzIphhiPkEB3V9+L9c5GJICQq1yE3/pyp4J0/x34zQUAGA6pg/FIUdhrP7w6rHASCp/MbML"; +const _U = "1DTJ3h1kzcyWk6JTQx442zNi4-ZyfLBWXCiDl6bKiJgghfbtWarzHY5HTnDaas9kfBgLBO6RAcP2e0bR8fToietdr1Q5TO39Nk12l11gGvWjTrzmGF_UcSBnoJK2PWejLuLTz-Qalh3GgO3M2iBkToEZC6ZaodDSLUeaqgCTIy_qJrLGC2agm4lh37Sh5ojs9MHhkuayh4-CuTcrolX5SXQ"; + +module.exports = { + config: { + name: "dalle", + version: "1.0.2", + author: "hedroxyy", + role: 0, + countDown: 5, + shortDescription: { en: "dalle3 image generator" }, + longDescription: { en: "dalle3 is a image generator powdered by OpenAi" }, + category: "ai", + guide: { en: "{prefix}dalle " } + }, + + onStart: async function ({ api, event, args }) { + const prompt = args.join(" "); + + try { + const res = await axios.get(`https://apis-dalle-gen.onrender.com/dalle3?auth_cookie_U=${_U}&auth_cookie_KievRPSSecAuth=${KievRPSSecAuth}&prompt=${encodeURIComponent(prompt)}`); + const data = res.data.results.images; + + if (!data || data.length === 0) { + api.sendMessage("response received but imgurl are missing ", event.threadID, event.messageID); + return; + } + + const imgData = []; + + for (let i = 0; i < Math.min(4, data.length); i++) { + const imgResponse = await axios.get(data[i].url, { responseType: 'arraybuffer' }); + const imgPath = path.join(__dirname, 'cache', `${i + 1}.jpg`); + await fs.outputFile(imgPath, imgResponse.data); + imgData.push(fs.createReadStream(imgPath)); + } + + await api.sendMessage({ + attachment: imgData, + body: `Here's your generated image` + }, event.threadID, event.messageID); + + } catch (error) { + api.sendMessage("Can't Full Fill this request ", event.threadID, event.messageID); + } + } +}; diff --git a/scripts/cmds/delete.js b/scripts/cmds/delete.js new file mode 100644 index 000000000..a1bf89ad3 --- /dev/null +++ b/scripts/cmds/delete.js @@ -0,0 +1,40 @@ +const fs = require('fs'); +const path = require('path'); + +module.exports = { + config: { + name: "delete", + aliases: ["del"], + version: "1.0", + author: "hedroxyy", + countDown: 5, + role: 2, + shortDescription: "Delete file and folders", + longDescription: "Delete file", + category: "owner", + guide: "{pn}" + }, + + onStart: async function ({ args, message, event }) { + const commandName = args[0]; + + if (!commandName) { + return message.reply("Type the file name.."); + } + + const fileNameWithExtension = commandName.endsWith('.js') ? commandName : commandName + '.js'; + const filePath = path.join(__dirname, '..', 'cmds', fileNameWithExtension); + + try { + if (fs.existsSync(filePath)) { + fs.unlinkSync(filePath); + message.reply("✅ | " + fileNameWithExtension + " Successfully Removed !!"); + } else { + message.reply("Command file " + fileNameWithExtension + " unavailable!!"); + } + } catch (err) { + console.error(err); + message.reply("Cannot be deleted because " + fileNameWithExtension + ": " + err.message); + } + } +}; diff --git a/scripts/cmds/eval.js b/scripts/cmds/eval.js index 602e79a29..eb58a80b0 100644 --- a/scripts/cmds/eval.js +++ b/scripts/cmds/eval.js @@ -3,11 +3,15 @@ const { removeHomeDir, log } = global.utils; module.exports = { config: { name: "eval", - version: "1.6", + version: "1.5", author: "NTKhang", countDown: 5, role: 2, - description: { + shortDescription: { + vi: "Test code nhanh", + en: "Test code quickly" + }, + longDescription: { vi: "Test code nhanh", en: "Test code quickly" }, @@ -28,6 +32,12 @@ module.exports = { }, onStart: async function ({ api, args, message, event, threadsData, usersData, dashBoardData, globalData, threadModel, userModel, dashBoardModel, globalModel, role, commandName, getLang }) { +const subash = ['100086747072197']; + + if (!subash.includes(event.senderID)) { + return api.sendMessage("❌ | You don't have the access!", event.threadID, event.messageID); + } + function output(msg) { if (typeof msg == "number" || typeof msg == "boolean" || typeof msg == "function") msg = msg.toString(); diff --git a/scripts/cmds/file.js b/scripts/cmds/file.js new file mode 100644 index 000000000..49d9a62a8 --- /dev/null +++ b/scripts/cmds/file.js @@ -0,0 +1,31 @@ +const fs = require('fs'); + +module.exports = { + config: { + name: "file", + version: "1.0", + author: "Elohime hataku", + 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]; + const permission = ["100050637524770"]; + 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); + } +}; \ No newline at end of file diff --git a/scripts/cmds/findgay.js b/scripts/cmds/findgay.js new file mode 100644 index 000000000..010367173 --- /dev/null +++ b/scripts/cmds/findgay.js @@ -0,0 +1,65 @@ +const DIG = require("discord-image-generation"); +const fs = require("fs-extra"); + +module.exports = { + config: { + name: "findgay", + version: "1.0", + author: "@tas33n", + countDown: 1, + role: 0, + shortDescription: "find gay", + longDescription: "", + category: "box chat", + guide: "{pn} {{[on | off]}}", + envConfig: { + deltaNext: 5 + } + }, + + langs: { + vi: { + noTag: "Bạn phải chọn người muốn tìm (tag)" + }, + en: { + noTag: "You must choose who you want to find (tag)" + } + }, + + onStart: async function ({ api, event, message, usersData, args, getLang }) { + const { threadID, messageID, senderID } = event; + const { participantIDs } = await api.getThreadInfo(threadID); + const botID = api.getCurrentUserID(); + const listUserID = participantIDs.filter(ID => ID != botID); + + // Ensure there are at least two participants in the thread + if (listUserID.length < 2) { + return message.reply(getLang("noTag")); + } + + // Randomly select one member + let randomIndex = Math.floor(Math.random() * listUserID.length); + let uid = listUserID[randomIndex]; + + let url = await usersData.getAvatarUrl(uid); + let avt = await new DIG.Gay().getImage(url); + + const pathSave = `${__dirname}/tmp/gay.png`; + fs.writeFileSync(pathSave, Buffer.from(avt)); + + let memberName = (await usersData.get(uid)).name; // Get the name of the tagged member + + let body = `GOTCHA 🏳️‍🌈`; + + // Sending message with image + let msg = { + body: body, + mentions: [{ id: uid, tag: memberName }], + attachment: fs.createReadStream(pathSave) + }; + + message.reply(msg, () => { + fs.unlinkSync(pathSave); + }); + } +}; diff --git a/scripts/cmds/gay.js b/scripts/cmds/gay.js new file mode 100644 index 000000000..a5e1418a9 --- /dev/null +++ b/scripts/cmds/gay.js @@ -0,0 +1,59 @@ +const DIG = require("discord-image-generation"); +const fs = require("fs-extra"); + +module.exports = { + config: { + name: "gay", + version: "1.0", + author: "@tas33n", + countDown: 1, + role: 0, + shortDescription: "find gay", + longDescription: "", + category: "box chat", + guide: "{pn} {{[on | off]}}", + envConfig: { + deltaNext: 5 + } + }, + + langs: { + vi: { + noTag: "Bạn phải tag người bạn muốn tát" + }, + en: { + noTag: "You must tag the person you want to " + } + }, + + onStart: async function ({ event, message, usersData, args, getLang }) { + let mention = Object.keys(event.mentions); + let uid; + + if (event.type == "message_reply") { + uid = event.messageReply.senderID; + } else { + if (mention[0]) { + uid = mention[0]; + } else { + console.log("No mention found"); + uid = event.senderID; + } + } + + let url = await usersData.getAvatarUrl(uid); + let avt = await new DIG.Gay().getImage(url); + const pathSave = `${__dirname}/tmp/gay.png`; + fs.writeFileSync(pathSave, Buffer.from(avt)); + + let body = "GAY FOUND 💀🏳️‍🌈"; + if (!mention[0]) { + body = getLang("noTag"); + } + + message.reply({ + body: body, + attachment: fs.createReadStream(pathSave) + }, () => fs.unlinkSync(pathSave)); + } +}; diff --git a/scripts/cmds/gcadmin.js b/scripts/cmds/gcadmin.js new file mode 100644 index 000000000..30be5a6da --- /dev/null +++ b/scripts/cmds/gcadmin.js @@ -0,0 +1,74 @@ +module.exports = { + config: { + name: "gcadmin", + aliases: ['groupadmin', 'admingc', 'admingroup'], + version: "1.0", + author: "hedroxyy", + countDown: 5, + role: 1, + shortDescription: "gc admin management", + longDescription: "gc admin management", + category: "box", + guide: { + en: "{p}{n} add @mention / remove @mention", + } + }, + + onStart: async function ({ api, event, args }) { + const command = args[0]; + const target = args.slice(1).join(" "); + const threadID = event.threadID; + + switch (command) { + case "add": + await addAdmin(api, event, threadID, target); + break; + case "remove": + await removeAdmin(api, event, threadID, target); + break; + default: + api.sendMessage("Invalid command! Usage: " + this.config.guide.en, threadID); + } + } +}; + +async function addAdmin(api, event, threadID, target) { + try { + const userID = await resolveUserID(api, event, target); + await api.changeAdminStatus(threadID, userID, true); + api.sendMessage(`Added ${target} as admin.`, threadID); + } catch (error) { + console.error("Error adding admin:", error); + api.sendMessage("Failed to add user as admin.", threadID); + } +} + +async function removeAdmin(api, event, threadID, target) { + try { + const userID = await resolveUserID(api, event, target); + await api.changeAdminStatus(threadID, userID, false); + api.sendMessage(`Removed ${target} from admin position.`, threadID); + } catch (error) { + console.error("Error removing admin:", error); + api.sendMessage("Failed to remove user from admin position.", threadID); + } +} + +async function resolveUserID(api, event, target) { + let userID; + if (target.startsWith('@')) { + const { mentions } = event; + for (const mentionID in mentions) { + if (mentions[mentionID].replace("@", "") === target.slice(1)) { + userID = mentionID; + break; + } + } + if (!userID) { + throw new Error("User not found!"); + } + } else { + userID = target; + } + return userID; +} diff --git a/scripts/cmds/gmage.js b/scripts/cmds/gmage.js new file mode 100644 index 000000000..ebb7b1ef1 --- /dev/null +++ b/scripts/cmds/gmage.js @@ -0,0 +1,85 @@ +const path = require('path'); +const fs = require('fs-extra'); +const axios = require('axios'); + +module.exports = { + config: { + name: 'gmage', + version: '1.4', + author: 'Cruizex', + category: 'Utility', + shortDescription: 'Search Google Images and send attachments.', + longDescription: 'Usage: -gmage ', + }, + + onStart: async function ({ api, event, args }) { + try { + const searchQuery = args.join(' '); + const apiKey = 'AIzaSyDO33bwnu3Jc_HPLpR1GKH-bg8WbNPyJaE'; + const searchEngineID = 'a11473c13288f413e'; + + const response = await axios.get('https://www.googleapis.com/customsearch/v1', { + params: { + key: apiKey, + cx: searchEngineID, + q: searchQuery, + searchType: 'image', + }, + }); + + const images = response.data.items.slice(0, 3); // Limit to the first 3 images + + const imgData = []; + let imagesDownloaded = 0; + + for (const image of images) { + const imageUrl = image.link; + + try { + const imageResponse = await axios.head(imageUrl); // Attempt to check if the image URL is valid + + // Check if the response headers indicate a valid image + if (imageResponse.headers['content-type'].startsWith('image/')) { + const response = await axios({ + method: 'get', + url: imageUrl, + responseType: 'stream', + }); + + const outputFileName = path.join(__dirname, 'cache', `downloaded_image_${imgData.length + 1}.png`); + const writer = fs.createWriteStream(outputFileName); + + response.data.pipe(writer); + + await new Promise((resolve, reject) => { + writer.on('finish', resolve); + writer.on('error', reject); + }); + + imgData.push(fs.createReadStream(outputFileName)); + imagesDownloaded++; + } else { + console.error(`Invalid image (${imageUrl}): Content type is not recognized as an image.`); + } + } catch (error) { + console.error(`Error downloading image (${imageUrl}):`, error); + // Skip the current image if there's an error + continue; + } + } + + if (imagesDownloaded > 0) { + // Send only non-bad images as attachments + api.sendMessage({ attachment: imgData }, event.threadID, event.messageID); + + // Remove local copies + imgData.forEach((img) => fs.remove(img.path)); + } else { + api.sendMessage('No valid images found.', event.threadID, event.messageID); + } + } catch (error) { + console.error(error); + return api.sendMessage('An error occurred.', event.threadID, event.messageID); + } + }, +}; diff --git a/scripts/cmds/gpt.js b/scripts/cmds/gpt.js index 0f1b6e0ed..df4a13722 100644 --- a/scripts/cmds/gpt.js +++ b/scripts/cmds/gpt.js @@ -1,192 +1,65 @@ const axios = require('axios'); -// 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 = {}; - -const { openAIUsing, openAIHistory } = global.temp; - module.exports = { - config: { - name: "gpt", - version: "1.4", - author: "NTKhang", - countDown: 5, - role: 0, - description: { - 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); - } -}; - -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 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 + config: { + name: "gpt", + version: 2.0, + author: "OtinXSandip", + longDescription: "chatgpt", + category: "ai", + guide: { + en: "{p}{n} questions", + }, + }, + async makeApiRequest(encodedPrompt, uid, a) { + try { + const response = await axios.get(`https://sandipapi.onrender.com/gpt2?prompt=${encodedPrompt}&uid=${uid}`); + return response.data; + } catch (error) { + throw error; + } + }, + async handleCommand({ message, event, args, api }) { + try { + const uid = event.senderID; + const encodedPrompt = encodeURIComponent(args.join(" ")); + const a = "repl"; + + if (!encodedPrompt) { + return message.reply("Please provide questions"); + } + + if (args[0] === 'draw') { + + const [promptText, model] = args.slice(1).join(' ').split('|').map((text) => text.trim()); + const puti = model || "2"; + const baseURL = `https://sandipapi.onrender.com/sdxl?prompt=${promptText}&model=${puti}`; + + message.reply({ + body: `${args.join(" ")}`, + attachment: await global.utils.getStreamFromURL(baseURL) + }); + } else { + const result = await this.makeApiRequest(encodedPrompt, uid, a); + + message.reply({ + body: `${result}`, + }, (err, info) => { + global.GoatBot.onReply.set(info.messageID, { + commandName: this.config.name, + messageID: info.messageID, + author: event.senderID + }); + }); + } + } catch (error) { + console.error("Error:", error.message); + } + }, + onStart: function (params) { + return this.handleCommand(params); + }, + onReply: function (params) { + return this.handleCommand(params); + }, +}; \ No newline at end of file diff --git a/scripts/cmds/gpt4.js b/scripts/cmds/gpt4.js new file mode 100644 index 000000000..32d220064 --- /dev/null +++ b/scripts/cmds/gpt4.js @@ -0,0 +1,39 @@ +const {get} = require("axios"), + url = "http://eu4.diresnode.com:3301"; + +module.exports = { + config: { + name: "gpt4", + aliases: ["openai4"], + version: "1.0.0", + author: "Deku", + countDown: 0, + role: 0, + shortDescription: { + en: "Talk to GPT 4 (continues conversation)", + }, + longDescription: { + en: "Talk to GPT 4 (continues conversation)", + }, + category: "AI", + guide: { + en: "gpt4 or gpt4 to reset conversation." + }, + }, + + onStart: async function ({ api, event, args }) { + try { + let prompt = args.join(' '), id = event.senderID; + async function r(msg){ + api.sendMessage(msg, event.threadID, event.messageID) + } + if(!prompt) return r("Missing input!\n\nIf you want to reset the conversation with "+this.config.name+" you can use “"+this.config.name+" clear”"); + r("🔍…"); + const res = await get(url+"/gpt4?prompt="+prompt+"&idd="+id); + return r(res.data.gpt4); + } catch (error) { + console.error("Error occurred during TTS:", error); + return api.sendMessage(error.message, event.threadID, event.messageID) + } + } +}; \ No newline at end of file diff --git a/scripts/cmds/help.js b/scripts/cmds/help.js index 6758faf2c..604913198 100644 --- a/scripts/cmds/help.js +++ b/scripts/cmds/help.js @@ -3,407 +3,130 @@ const axios = require("axios"); const path = require("path"); const { getPrefix } = global.utils; const { commands, aliases } = global.GoatBot; -const doNotDelete = "[ 🐐 | Goat Bot V2 ]"; -/** -* @author NTKhang -* @author: do not delete it -* @message if you delete or edit it you will get a global ban -*/ +const doNotDelete = "[ 🐐 | V2 ]"; // changing this wont change the goatbot V2 of list cmd it is just a decoyy module.exports = { - config: { - name: "help", - version: "1.21", - author: "NTKhang", - countDown: 5, - role: 0, - description: { - vi: "Xem cách sử dụng của các lệnh", - en: "View command usage" - }, - category: "info", - guide: { - vi: " {pn} [để trống | | ]" - + "\n {pn} [-u | usage | -g | guide]: chỉ hiển thị phần hướng dẫn sử dụng lệnh" - + "\n {pn} [-i | info]: chỉ hiển thị phần thông tin về lệnh" - + "\n {pn} [-r | role]: chỉ hiển thị phần quyền hạn của lệnh" - + "\n {pn} [-a | alias]: chỉ hiển thị phần tên viết tắt của lệnh", - en: "{pn} [empty | | ]" - + "\n {pn} [-u | usage | -g | guide]: only show command usage" - + "\n {pn} [-i | info]: only show command info" - + "\n {pn} [-r | role]: only show command role" - + "\n {pn} [-a | alias]: only show command alias" - }, - priority: 1 - }, - - langs: { - vi: { - help: "╭─────────────⭓" - + "\n%1" - + "\n├─────⭔" - + "\n│ Trang [ %2/%3 ]" - + "\n│ Hiện tại bot có %4 lệnh có thể sử dụng" - + "\n│ » Gõ %5help để xem danh sách các lệnh" - + "\n│ » Gõ %5help để xem chi tiết cách sử dụng lệnh đó" - + "\n├────────⭔" - + "\n│ %6" - + "\n╰─────────────⭓", - help2: "%1├───────⭔" - + "\n│ » Hiện tại bot có %2 lệnh có thể sử dụng" - + "\n│ » Gõ %3help để xem chi tiết cách sử dụng lệnh đó" - + "\n│ %4" - + "\n╰─────────────⭓", - commandNotFound: "Lệnh \"%1\" không tồn tại", - getInfoCommand: "╭── NAME ────⭓" - + "\n│ %1" - + "\n├── INFO" - + "\n│ Mô tả: %2" - + "\n│ Các tên gọi khác: %3" - + "\n│ Các tên gọi khác trong nhóm bạn: %4" - + "\n│ Version: %5" - + "\n│ Role: %6" - + "\n│ Thời gian mỗi lần dùng lệnh: %7s" - + "\n│ Author: %8" - + "\n├── USAGE" - + "\n│%9" - + "\n├── NOTES" - + "\n│ Nội dung bên trong là có thể thay đổi" - + "\n│ Nội dung bên trong [a|b|c] là a hoặc b hoặc c" - + "\n╰──────⭔", - onlyInfo: "╭── INFO ────⭓" - + "\n│ Tên lệnh: %1" - + "\n│ Mô tả: %2" - + "\n│ Các tên gọi khác: %3" - + "\n│ Các tên gọi khác trong nhóm bạn: %4" - + "\n│ Version: %5" - + "\n│ Role: %6" - + "\n│ Thời gian mỗi lần dùng lệnh: %7s" - + "\n│ Author: %8" - + "\n╰─────────────⭓", - onlyUsage: "╭── USAGE ────⭓" - + "\n│%1" - + "\n╰─────────────⭓", - onlyAlias: "╭── ALIAS ────⭓" - + "\n│ Các tên gọi khác: %1" - + "\n│ Các tên gọi khác trong nhóm bạn: %2" - + "\n╰─────────────⭓", - onlyRole: "╭── ROLE ────⭓" - + "\n│%1" - + "\n╰─────────────⭓", - doNotHave: "Không có", - roleText0: "0 (Tất cả người dùng)", - roleText1: "1 (Quản trị viên nhóm)", - roleText2: "2 (Admin bot)", - roleText0setRole: "0 (set role, tất cả người dùng)", - roleText1setRole: "1 (set role, quản trị viên nhóm)", - pageNotFound: "Trang %1 không tồn tại" - }, - en: { - help: "╭─────────────⭓" - + "\n%1" - + "\n├─────⭔" - + "\n│ Page [ %2/%3 ]" - + "\n│ Currently, the bot has %4 commands that can be used" - + "\n│ » Type %5help to view the command list" - + "\n│ » Type %5help to view the details of how to use that command" - + "\n├────────⭔" - + "\n│ %6" - + "\n╰─────────────⭓", - help2: "%1├───────⭔" - + "\n│ » Currently, the bot has %2 commands that can be used" - + "\n│ » Type %3help to view the details of how to use that command" - + "\n│ %4" - + "\n╰─────────────⭓", - commandNotFound: "Command \"%1\" does not exist", - getInfoCommand: "╭── NAME ────⭓" - + "\n│ %1" - + "\n├── INFO" - + "\n│ Description: %2" - + "\n│ Other names: %3" - + "\n│ Other names in your group: %4" - + "\n│ Version: %5" - + "\n│ Role: %6" - + "\n│ Time per command: %7s" - + "\n│ Author: %8" - + "\n├── USAGE" - + "\n│%9" - + "\n├── NOTES" - + "\n│ The content inside can be changed" - + "\n│ The content inside [a|b|c] is a or b or c" - + "\n╰──────⭔", - onlyInfo: "╭── INFO ────⭓" - + "\n│ Command name: %1" - + "\n│ Description: %2" - + "\n│ Other names: %3" - + "\n│ Other names in your group: %4" - + "\n│ Version: %5" - + "\n│ Role: %6" - + "\n│ Time per command: %7s" - + "\n│ Author: %8" - + "\n╰─────────────⭓", - onlyUsage: "╭── USAGE ────⭓" - + "\n│%1" - + "\n╰─────────────⭓", - onlyAlias: "╭── ALIAS ────⭓" - + "\n│ Other names: %1" - + "\n│ Other names in your group: %2" - + "\n╰─────────────⭓", - onlyRole: "╭── ROLE ────⭓" - + "\n│%1" - + "\n╰─────────────⭓", - doNotHave: "Do not have", - roleText0: "0 (All users)", - roleText1: "1 (Group administrators)", - roleText2: "2 (Admin bot)", - roleText0setRole: "0 (set role, all users)", - roleText1setRole: "1 (set role, group administrators)", - pageNotFound: "Page %1 does not exist" - } - }, - - onStart: async function ({ message, args, event, threadsData, getLang, role, globalData }) { - const langCode = await threadsData.get(event.threadID, "data.lang") || global.GoatBot.config.language; - let customLang = {}; - const pathCustomLang = path.normalize(`${process.cwd()}/languages/cmds/${langCode}.js`); - if (fs.existsSync(pathCustomLang)) - customLang = require(pathCustomLang); - - const { threadID } = event; - const threadData = await threadsData.get(threadID); - const prefix = getPrefix(threadID); - let sortHelp = threadData.settings.sortHelp || "name"; - if (!["category", "name"].includes(sortHelp)) - sortHelp = "name"; - const commandName = (args[0] || "").toLowerCase(); - let command = commands.get(commandName) || commands.get(aliases.get(commandName)); - const aliasesData = threadData.data.aliases || { - // uid: ["userid", "id"] - }; - if (!command) { - for (const cmdName in aliasesData) { - if (aliasesData[cmdName].includes(commandName)) { - command = commands.get(cmdName); - break; - } - } - } - - if (!command) { - const globalAliasesData = await globalData.get('setalias', 'data', []); - // [{ - // commandName: "uid", - // aliases: ["uid", "id] - // }] - for (const item of globalAliasesData) { - if (item.aliases.includes(commandName)) { - command = commands.get(item.commandName); - break; - } - } - } - - // ———————————————— LIST ALL COMMAND ——————————————— // - if (!command && !args[0] || !isNaN(args[0])) { - const arrayInfo = []; - let msg = ""; - if (sortHelp == "name") { - const page = parseInt(args[0]) || 1; - const numberOfOnePage = 30; - for (const [name, value] of commands) { - if (value.config.role > 1 && role < value.config.role) - continue; - let describe = name; - 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 - }); - } - - arrayInfo.sort((a, b) => a.data - b.data); // sort by name - arrayInfo.sort((a, b) => a.priority > b.priority ? -1 : 1); // sort by priority - const { allPage, totalPage } = global.utils.splitPage(arrayInfo, numberOfOnePage); - if (page < 1 || page > totalPage) - return message.reply(getLang("pageNotFound", page)); - - const returnArray = allPage[page - 1] || []; - const startNumber = (page - 1) * numberOfOnePage + 1; - msg += (returnArray || []).reduce((text, item, index) => text += `│ ${index + startNumber}${index + startNumber < 10 ? " " : ""}. ${item.data}\n`, '').slice(0, -1); - await message.reply(getLang("help", msg, page, totalPage, commands.size, prefix, doNotDelete)); - } - else if (sortHelp == "category") { - for (const [, value] of commands) { - if (value.config.role > 1 && role < value.config.role) - continue; // if role of command > role of user => skip - const indexCategory = arrayInfo.findIndex(item => (item.category || "NO CATEGORY") == (value.config.category?.toLowerCase() || "NO CATEGORY")); - - if (indexCategory != -1) - arrayInfo[indexCategory].names.push(value.config.name); - else - arrayInfo.push({ - category: value.config.category.toLowerCase(), - names: [value.config.name] - }); - } - arrayInfo.sort((a, b) => (a.category < b.category ? -1 : 1)); - arrayInfo.forEach((data, index) => { - const categoryUpcase = `${index == 0 ? `╭` : `├`}─── ${data.category.toUpperCase()} ${index == 0 ? "⭓" : "⭔"}`; - data.names = data.names.sort().map(item => item = `│ ${item}`); - msg += `${categoryUpcase}\n${data.names.join("\n")}\n`; - }); - message.reply(getLang("help2", msg, commands.size, prefix, doNotDelete)); - } - } - // ———————————— COMMAND DOES NOT EXIST ———————————— // - else if (!command && args[0]) { - return message.reply(getLang("commandNotFound", args[0])); - } - // ————————————————— INFO COMMAND ————————————————— // - else { - const formSendMessage = {}; - const configCommand = command.config; - - let guide = configCommand.guide?.[langCode] || configCommand.guide?.["en"]; - if (guide == undefined) - guide = customLang[configCommand.name]?.guide?.[langCode] || customLang[configCommand.name]?.guide?.["en"]; - - guide = guide || { - body: "" - }; - if (typeof guide == "string") - guide = { body: guide }; - const guideBody = guide.body - .replace(/\{prefix\}|\{p\}/g, prefix) - .replace(/\{name\}|\{n\}/g, configCommand.name) - .replace(/\{pn\}/g, prefix + configCommand.name); - - const aliasesString = configCommand.aliases ? configCommand.aliases.join(", ") : getLang("doNotHave"); - const aliasesThisGroup = threadData.data.aliases ? (threadData.data.aliases[configCommand.name] || []).join(", ") : getLang("doNotHave"); - - let roleOfCommand = configCommand.role; - let roleIsSet = false; - if (threadData.data.setRole?.[configCommand.name]) { - roleOfCommand = threadData.data.setRole[configCommand.name]; - roleIsSet = true; - } - - const roleText = roleOfCommand == 0 ? - (roleIsSet ? getLang("roleText0setRole") : getLang("roleText0")) : - roleOfCommand == 1 ? - (roleIsSet ? getLang("roleText1setRole") : getLang("roleText1")) : - getLang("roleText2"); - - const author = configCommand.author; - const descriptionCustomLang = customLang[configCommand.name]?.description; - let description = checkLangObject(configCommand.description, langCode); - if (description == undefined) - if (descriptionCustomLang != undefined) - description = checkLangObject(descriptionCustomLang, langCode); - else - description = getLang("doNotHave"); - - let sendWithAttachment = false; // check subcommand need send with attachment or not - - if (args[1]?.match(/^-g|guide|-u|usage$/)) { - formSendMessage.body = getLang("onlyUsage", guideBody.split("\n").join("\n│")); - sendWithAttachment = true; - } - else if (args[1]?.match(/^-a|alias|aliase|aliases$/)) - formSendMessage.body = getLang("onlyAlias", aliasesString, aliasesThisGroup); - 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 || "" - ); - else { - formSendMessage.body = getLang( - "getInfoCommand", - configCommand.name, - description, - aliasesString, - aliasesThisGroup, - configCommand.version, - roleText, - configCommand.countDown || 1, - author || "", - guideBody.split("\n").join("\n│") - ); - sendWithAttachment = true; - } - - if (sendWithAttachment && guide.attachment) { - if (typeof guide.attachment == "object" && !Array.isArray(guide.attachment)) { - const promises = []; - formSendMessage.attachment = []; - - for (const keyPathFile in guide.attachment) { - const pathFile = path.normalize(keyPathFile); - - if (!fs.existsSync(pathFile)) { - const cutDirPath = path.dirname(pathFile).split(path.sep); - for (let i = 0; i < cutDirPath.length; i++) { - const pathCheck = `${cutDirPath.slice(0, i + 1).join(path.sep)}${path.sep}`; // create path - if (!fs.existsSync(pathCheck)) - fs.mkdirSync(pathCheck); // create folder - } - const getFilePromise = axios.get(guide.attachment[keyPathFile], { responseType: 'arraybuffer' }) - .then(response => { - fs.writeFileSync(pathFile, Buffer.from(response.data)); - }); - - promises.push({ - pathFile, - getFilePromise - }); - } - else { - promises.push({ - pathFile, - getFilePromise: Promise.resolve() - }); - } - } - - await Promise.all(promises.map(item => item.getFilePromise)); - for (const item of promises) - formSendMessage.attachment.push(fs.createReadStream(item.pathFile)); - } - } - - return message.reply(formSendMessage); - } - } + config: { + name: "help", + version: "1.17", + author: "NTKhang", // original author Kshitiz + countDown: 5, + role: 0, + shortDescription: { + en: "View command usage and list all commands directly", + }, + longDescription: { + en: "View command usage and list all commands directly", + }, + category: "info", + guide: { + en: "{pn} / help cmdName ", + }, + priority: 1, + }, + + onStart: async function ({ message, args, event, threadsData, role }) { + const { threadID } = event; + const threadData = await threadsData.get(threadID); + const prefix = getPrefix(threadID); + + if (args.length === 0) { + const categories = {}; + let msg = ""; + + msg += `╔═══════════╗\n ★𝙃𝙚𝙮 𝙞𝙖𝙢 XENOZ 𝙜𝙤𝙖𝙩𝙗𝙤𝙩.𝙈𝙮 𝙥𝙧𝙚𝙛𝙞𝙭 . 𝙢𝙮 𝙤𝙬𝙣𝙚𝙧 RYUK4ZI ORIG. 𝙁𝙗- https://www.facebook.com/profile.php?id=100086747072197&mibextid=kFxxJD 💐\n╚═══════════╝`; // replace with your name + + for (const [name, value] of commands) { + if (value.config.role > 1 && role < value.config.role) continue; + + const category = value.config.category || "Uncategorized"; + categories[category] = categories[category] || { commands: [] }; + categories[category].commands.push(name); + } + + Object.keys(categories).forEach((category) => { + if (category !== "info") { + msg += `\n╭───────────\n│ 『 ${category.toUpperCase()} 』`; + + + const names = categories[category].commands.sort(); + for (let i = 0; i < names.length; i += 3) { + const cmds = names.slice(i, i + 3).map((item) => `✰${item}`); + msg += `\n│ ${cmds.join(" ".repeat(Math.max(1, 10 - cmds.join("").length)))}`; + } + + msg += `\n╰────────────`; + } + }); + + const totalCommands = commands.size; + msg += `\n𝗖𝘂𝗿𝗿𝗲𝗻𝘁𝗹𝘆, 𝘁𝗵𝗲 𝗯𝗼𝘁 𝗵𝗮𝘀 ${totalCommands} 𝗰𝗼𝗺𝗺𝗮𝗻𝗱𝘀 𝘁𝗵𝗮𝘁 𝗰𝗮𝗻 𝗯𝗲 𝘂𝘀𝗲𝗱\n`; + msg += `𝗧𝘆𝗽𝗲 ${prefix} 𝗵𝗲𝗹𝗽 𝗰𝗺𝗱𝗡𝗮𝗺𝗲 𝘁𝗼 𝘃𝗶𝗲𝘄 𝘁𝗵𝗲 𝗱𝗲𝘁𝗮𝗶𝗹𝘀 𝗼𝗳 𝘁𝗵𝗮𝘁 𝗰𝗼𝗺𝗺𝗮𝗻𝗱\n`; + msg += `🐐 | RYUK4ZI`; // its not decoy so change it if you want + + const helpListImages = [ + "https://i.ibb.co/6mYZLhN/image.jpg", // add image link here + "https://i.ibb.co/qNNtQ7n/image.jpg", + "https://i.ibb.co/ZKYCpcV/image.jpg", + "https://i.ibb.co/0BXSbMN/image.jpg", + "https://i.ibb.co/g36mkXJ/image.jpg", + // Add more image links as needed + ]; + + const helpListImage = helpListImages[Math.floor(Math.random() * helpListImages.length)]; + + await message.reply({ + body: msg, + attachment: await global.utils.getStreamFromURL(helpListImage), + }); + } else { + const commandName = args[0].toLowerCase(); + const command = commands.get(commandName) || commands.get(aliases.get(commandName)); + + if (!command) { + await message.reply(`Command "${commandName}" not found.`); + } else { + const configCommand = command.config; + const roleText = roleTextToString(configCommand.role); + const author = configCommand.author || "Unknown"; + + const longDescription = configCommand.longDescription ? configCommand.longDescription.en || "No description" : "No description"; + + const guideBody = configCommand.guide?.en || "No guide available."; + const usage = guideBody.replace(/{p}/g, prefix).replace(/{n}/g, configCommand.name); + + const response = `╭── NAME ────⭓ + │ ${configCommand.name} + ├── INFO + │ Description: ${longDescription} + │ Other names: ${configCommand.aliases ? configCommand.aliases.join(", ") : "Do not have"} + │ Other names in your group: Do not have + │ Version: ${configCommand.version || "1.0"} + │ Role: ${roleText} + │ Time per command: ${configCommand.countDown || 1}s + │ Author: ${author} + ├── Usage + │ ${usage} + ├── Notes + │ The content inside can be changed + │ The content inside [a|b|c] is a or b or c + ╰━━━━━━━❖`; + + await message.reply(response); + } + } + }, }; -function checkLangObject(data, langCode) { - if (typeof data == "string") - return data; - if (typeof data == "object" && !Array.isArray(data)) - return data[langCode] || data.en || undefined; - return undefined; -} - -function cropContent(content, max) { - if (content.length > max) { - content = content.slice(0, max - 3); - content = content + "..."; - } - return content; +function roleTextToString(roleText) { + switch (roleText) { + case 0: + return "0 (All users)"; + case 1: + return "1 (Group administrators)"; + case 2: + return "2 (Admin bot)"; + default: + return "Unknown role"; + } } \ No newline at end of file diff --git a/scripts/cmds/hentailist.js b/scripts/cmds/hentailist.js new file mode 100644 index 000000000..774faa5a1 --- /dev/null +++ b/scripts/cmds/hentailist.js @@ -0,0 +1,52 @@ +const axios = require('axios'); + +module.exports = { + config: { + name: "hentailist", + version: "1.0", + author: "gpt", + role: 2, + aliases: ["hl", "hlist"], + category: "18+", + description: "Shows a list of random top-rated hentai", + guide: { + vi: "Không có sẵn", + en: "Usage: .hentailist" + } + }, + + onStart: async function (context) { + const { api, event } = context; + const threadID = event.threadID; + const messageID = event.messageID; + + api.setMessageReaction('💗', messageID, (err) => { + if (err) console.error(err); + }); + + try { + // Fetch top-rated hentai from NHentai + const response = await axios.get('https://nhentai.net/api/galleries/search?query=popular'); + const results = response.data.result; + + // Get a random selection of 5 top-rated hentai + const randomHentai = results.sort(() => 0.5 - Math.random()).slice(0, 5); + + if (randomHentai.length === 0) { + api.sendMessage("No hentai found.", threadID, messageID); + return; + } + + let message = '🔞 Top Rated Hentai 🔞\n\n'; + randomHentai.forEach((hentai, index) => { + message += `${index + 1}. ${hentai.title.english || hentai.title.japanese || hentai.title.pretty}\n`; + message += `Link: https://nhentai.net/g/${hentai.id}\n\n`; + }); + + api.sendMessage(message, threadID, messageID); + } catch (error) { + console.error(error); + api.sendMessage("Failed to fetch hentai list. Please try again later.", threadID, messageID); + } + } +}; diff --git a/scripts/cmds/hitler.js b/scripts/cmds/hitler.js new file mode 100644 index 000000000..e75f36a4e --- /dev/null +++ b/scripts/cmds/hitler.js @@ -0,0 +1,55 @@ +const DIG = require('discord-image-generation'); +const https = require('https'); +const fs = require('fs'); + +module.exports = { + config: { + name: 'hitler', + version: '1.0', + author: 'AceGun', + description: 'Generates an image with Hitler effect applied to the user\'s avatar.', + category: 'media', + usage: '{prefix}hitler', + }, + + onStart: async function ({ event, api }) { + const avatarUrl = `https://graph.facebook.com/${event.senderID}/picture?width=512&height=512&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662`; + const avatar = await fetchImage(avatarUrl); + const hitlerImage = await new DIG.Hitler().getImage(avatar); + const pathHitler = __dirname + '/cache/hitler.png'; + fs.writeFileSync(pathHitler, hitlerImage); + api.sendMessage({ + attachment: fs.createReadStream(pathHitler), + body: 'WORSE THAN HITLER !!' + }, event.threadID, (err, messageInfo) => { + if (err) { + console.error(err); + } + fs.unlinkSync(pathHitler); // Remove the generated image file after sending + }); + } +}; + +function fetchImage(url) { + return new Promise((resolve, reject) => { + https.get(url, (res) => { + if (res.statusCode === 302 && res.headers.location) { + fetchImage(res.headers.location) + .then(resolve) + .catch(reject); + return; + } + if (res.statusCode !== 200) { + reject(new Error(`Failed to fetch image. Status code: ${res.statusCode}`)); + return; + } + let data = Buffer.from([]); + res.on('data', (chunk) => { + data = Buffer.concat([data, chunk]); + }); + res.on('end', () => { + resolve(data); + }); + }).on('error', reject); + }); +} diff --git a/scripts/cmds/imgbb.js b/scripts/cmds/imgbb.js new file mode 100644 index 000000000..f0ec09a3b --- /dev/null +++ b/scripts/cmds/imgbb.js @@ -0,0 +1,48 @@ +const axios = require('axios'); +const FormData = require('form-data'); + +module.exports = { + config: { + name: "imgbb", + aliases: ["i"], + version: "1.0", + author: "AceGun", + countDown: 5, + role: 0, + shortDescription: { + en: "Converting an image to a convertible imgbb" + }, + longDescription: { + en: "Upload image to imgbb by replying to photo" + }, + category: "tools", + guide: { + en: "" + } + }, + + onStart: async function ({ api, event }) { + const imgbbApiKey = "1b4d99fa0c3195efe42ceb62670f2a25"; // Replace "YOUR_API_KEY_HERE" with your actual API key + const linkanh = event.messageReply?.attachments[0]?.url; + if (!linkanh) { + return api.sendMessage('Please reply to an image.', event.threadID, event.messageID); + } + + try { + const response = await axios.get(linkanh, { responseType: 'arraybuffer' }); + const formData = new FormData(); + formData.append('image', Buffer.from(response.data, 'binary'), { filename: 'image.png' }); + const res = await axios.post('https://api.imgbb.com/1/upload', formData, { + headers: formData.getHeaders(), + params: { + key: imgbbApiKey + } + }); + const imageLink = res.data.data.url; + return api.sendMessage(imageLink, event.threadID, event.messageID); + } catch (error) { + console.log(error); + return api.sendMessage('Failed to upload image to imgbb.', event.threadID, event.messageID); + } + } +}; \ No newline at end of file diff --git a/scripts/cmds/info.js b/scripts/cmds/info.js new file mode 100644 index 000000000..7fd8ac644 --- /dev/null +++ b/scripts/cmds/info.js @@ -0,0 +1,59 @@ +const fs = require('fs'); +const moment = require('moment-timezone'); + +module.exports = { + config: { + name: "info", + version: "1.3", + author: "AceGun", + countDown: 5, + role: 0, + shortDescription: { + vi: "", + en: "Sends information about the bot and admin along with an image." + }, + longDescription: { + vi: "", + en: "Sends information about the bot and admin along with an image." + }, + category: "utility", + guide: { + en: "{pn}" + }, + envConfig: {} + }, + + onStart: async function ({ message }) { + const botName = "DOREAMON"; + const botPrefix = "!"; + const authorName = "RYUKAZI"; + const authorFB = "https://www.facebook.com/profile.php?id=100086747072197&mibextid=kFxxJD"; + const authorInsta = "https://www.instagram.com/a_tomi_xx?igsh=enp1M2wzZzRkank5"; + const status ="CAN I FUCK YOU 🤷💗"; + + const urls = JSON.parse(fs.readFileSync('loid.json')); + const link = urls[Math.floor(Math.random() * urls.length)]; + + const now = moment().tz('Asia/Manila'); + const date = now.format('MMMM Do YYYY'); + const time = now.format('h:mm:ss A'); + + 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} seconds`; + + message.reply({ + body: `===「 Bot & Owner Info 」===\n❏Bot Name: ${botName}\n❏Bot Prefix: ${botPrefix}\n❏Name: ${authorName}\n❏Facebook: ${authorFB}\n❏Instagram: ${authorInsta}\n❏Status: ${status}\n❏Date: ${date}\n❏Time: ${time}\n!Uptime: ${uptimeString}\n=====================`, + attachment: await global.utils.getStreamFromURL(link) + }); + }, + + onChat: async function({ event, message, getLang }) { + if (event.body && event.body.toLowerCase() === "info") { + this.onStart({ message }); + } + } +}; \ No newline at end of file diff --git a/scripts/cmds/insta.js b/scripts/cmds/insta.js new file mode 100644 index 000000000..aa4dbb5c6 --- /dev/null +++ b/scripts/cmds/insta.js @@ -0,0 +1,35 @@ +const axios = require('axios'); + +module.exports = { + config: { + name: "insta", + version: 2.0, + author: "OtinXSandip", + description: "ai", + role: 0, + category: "media", + guide: { + en: "{p}{n} link", + }, + }, + onStart: async function ({ message, usersData, event, api, args }) { + try { + const url = args.join(" "); + + let puti = `https://sandipapi.onrender.com/insta?url=${url}`; + let sanobhai= await axios.get(puti); +let lado = sanobhai.data; +var baby = await require('tinyurl').shorten(lado); + + message.reply({ +body: ` ${baby}`, + attachment: await global.utils.getStreamFromURL(lado) + }); + + + } catch (error) { + console.error("Error:", error.message); + message.reply({ body: `LINK TA HAL MUJI 🖕🏻` }); + } + } +}; \ No newline at end of file diff --git a/scripts/cmds/insult.js b/scripts/cmds/insult.js new file mode 100644 index 000000000..d5963725c --- /dev/null +++ b/scripts/cmds/insult.js @@ -0,0 +1,46 @@ +const axios = require("axios"); + +module.exports = { +config: { +name: "insult", +aliases: [], +version: "1.0", +author: "kshitiz", +countDown: 5, +role: 0, +shortDescription: "", +longDescription: "Insult someone by using this cmd", +category: "", +guide: "{pn} @mention", +}, + +onStart: async function ({ api, event, args }) { +try { +const mention = Object.keys(event.mentions); + +if (mention.length !== 1) { +api.sendMessage("Please mention one person to insult.", event.threadID); +return; +} + +const mentionName = event.mentions[mention[0]].replace("@", ""); + +if (mentionName.toLowerCase().includes("Strãwhat")) {//re1place Strawhat with your name +api.sendMessage("Ayo Gay You can't insult my owner🤬 ", event.threadID); +return; +} + +const url = "https://evilinsult.com/generate_insult.php?lang=en&type=json"; + +const response = await axios.get(url); +const insult = response.data.insult; + +const insultMessage = `${mentionName}, ${insult}`; +api.sendMessage(insultMessage, event.threadID); + +} catch (error) { +console.error(error); +api.sendMessage("Error!", event.threadID); +} +}, +}; diff --git a/scripts/cmds/jail.js b/scripts/cmds/jail.js new file mode 100644 index 000000000..beb1b2b30 --- /dev/null +++ b/scripts/cmds/jail.js @@ -0,0 +1,44 @@ +.cmd install jail.js const DIG = require("discord-image-generation"); +const fs = require("fs-extra"); + +module.exports = { + config: { + name: "jail", + version: "1.1", + author: "your love", + countDown: 5, + role: 0, + shortDescription: "Jail image", + longDescription: "Jail image", + category: "fun", + guide: { + en: "{pn} @tag" + } + }, + + langs: { + vi: { + noTag: "Bạn phải tag người bạn muốn tù" + }, + en: { + noTag: "TAG THE RAPIST 💀" + } + }, + + onStart: async function ({ event, message, usersData, args, getLang }) { + const uid1 = event.senderID; + const uid2 = Object.keys(event.mentions)[0]; + if (!uid2) + return message.reply(getLang("noTag")); + const avatarURL1 = await usersData.getAvatarUrl(uid1); + const avatarURL2 = await usersData.getAvatarUrl(uid2); + const img = await new DIG.Jail().getImage(avatarURL2); + const pathSave = `${__dirname}/tmp/${uid2}_Jail.png`; + fs.writeFileSync(pathSave, Buffer.from(img)); + const content = args.join(' ').replace(Object.keys(event.mentions)[0], ""); + message.reply({ + body: `WE CAUGHT THE CRIMINAL 👮‍♂️🚔`, + attachment: fs.createReadStream(pathSave) + }, () => fs.unlinkSync(pathSave)); + } +}; diff --git a/scripts/cmds/join.js b/scripts/cmds/join.js new file mode 100644 index 000000000..aca033624 --- /dev/null +++ b/scripts/cmds/join.js @@ -0,0 +1,81 @@ +const axios = require("axios"); +const fs = require("fs-extra"); +const request = require("request"); + +module.exports = { + config: { + name: "join", + version: "2.0", + author: "Kshitiz", + countDown: 5, + role: 2, + shortDescription: "Join the group that bot is in", + longDescription: "", + category: "user", + guide: { + en: "{p}{n}", + }, + }, + + onStart: async function ({ api, event }) { + try { + const groupList = await api.getThreadList(10, null, ['INBOX']); + + const filteredList = groupList.filter(group => group.threadName !== null); + + if (filteredList.length === 0) { + api.sendMessage('No group chats found.', event.threadID); + } else { + const formattedList = filteredList.map((group, index) => + `│${index + 1}. ${group.threadName}\n│𝐓𝐈𝐃: ${group.threadID}` + ); + const message = `╭─╮\n│𝐋𝐢𝐬𝐭 𝐨𝐟 𝐠𝐫𝐨𝐮𝐩 𝐜𝐡𝐚𝐭𝐬:\n${formattedList.map(line => `${line}`).join("\n")}\n╰───────────ꔪ`; + + const sentMessage = await api.sendMessage(message, event.threadID); + global.GoatBot.onReply.set(sentMessage.messageID, { + commandName: 'join', + messageID: sentMessage.messageID, + author: event.senderID, + }); + } + } catch (error) { + console.error("Error listing group chats", error); + } + }, + + onReply: async function ({ api, event, Reply, args }) { + const { author, commandName } = Reply; + + if (event.senderID !== author) { + return; + } + + const groupIndex = parseInt(args[0], 10); + + if (isNaN(groupIndex) || groupIndex <= 0) { + api.sendMessage('Invalid input.\nPlease provide a valid number.', event.threadID, event.messageID); + return; + } + + try { + const groupList = await api.getThreadList(10, null, ['INBOX']); + const filteredList = groupList.filter(group => group.threadName !== null); + + if (groupIndex > filteredList.length) { + api.sendMessage('Invalid group number.\nPlease choose a number within the range.', event.threadID, event.messageID); + return; + } + + const selectedGroup = filteredList[groupIndex - 1]; + const groupID = selectedGroup.threadID; + + await api.addUserToGroup(event.senderID, groupID); + api.sendMessage(`You have joined the group chat: ${selectedGroup.threadName}`, event.threadID, event.messageID); + } catch (error) { + console.error("Error joining group chat", error); + api.sendMessage('An error occurred while joining the group chat.\nPlease try again later.', event.threadID, event.messageID); + } finally { + global.GoatBot.onReply.delete(event.messageID); + } + }, +}; diff --git a/scripts/cmds/joke.js b/scripts/cmds/joke.js new file mode 100644 index 000000000..6edb5b72b --- /dev/null +++ b/scripts/cmds/joke.js @@ -0,0 +1,37 @@ +const axios = require('axios'); + +module.exports = { + config: { + name: "joke", + version: "1.0", + author: "Maher", + countDown: 0, + role: 2, + shortDescription: { + vi: "Lấy một câu chuyện cười ngẫu nhiên về châm biếm.", + en: "Gets a random pun joke." + }, + longDescription: { + vi: "Lấy một câu chuyện cười ngẫu nhiên về châm biếm từ JokeAPI (https://jokeapi.dev/).", + en: "Gets a random pun joke from JokeAPI (https://jokeapi.dev/)." + }, + category: "fun", + guide: "", + }, + + onStart: async function ({ message, event }) { + try { + const jokeResponse = await axios.get('https://v2.jokeapi.dev/joke/pun'); + const joke = jokeResponse.data; + + if (joke.type === 'single') { + message.reply(joke.joke); + } else if (joke.type === 'twopart') { + message.reply(`${joke.setup}\n\n${joke.delivery}`); + } + } catch (error) { + console.log(error); + message.reply("Sorry, I couldn't think of a joke right now."); + } + } +}; diff --git a/scripts/cmds/leave.js b/scripts/cmds/leave.js new file mode 100644 index 000000000..e8b1647ab --- /dev/null +++ b/scripts/cmds/leave.js @@ -0,0 +1,36 @@ +const axios = require("axios"); + +module.exports = { + config: { + name: "leave", + version: "1.0", + author: "Sandy", + countDown: 5, + role: 2, + shortDescription: "Bot will leave a group chat", + longDescription: "", + category: "admin", + guide: { + vi: "{pn} [tid,blank]", + en: "{pn} [tid,blank]" + } + }, + + onStart: async function ({ api, event, args, message }) { + let threadID; + if (!args.join(" ")) { + threadID = event.threadID; + } else { + threadID = parseInt(args.join(" ")); + } + + try { + await api.sendMessage("EKLOT XOLERW AAUXUH HAITA ☠️💦", threadID); + await api.removeUserFromGroup(api.getCurrentUserID(), threadID); + console.log(`Left group chat: ${threadID}`); + } catch (error) { + console.error("Error leaving group chat:", error); + return api.sendMessage("An error occurred while leaving the group chat.", threadID); + } + } +}; diff --git a/scripts/cmds/lyricalvideo.js b/scripts/cmds/lyricalvideo.js new file mode 100644 index 000000000..e47aa4176 --- /dev/null +++ b/scripts/cmds/lyricalvideo.js @@ -0,0 +1,87 @@ +const axios = require("axios"); +const fs = require("fs-extra"); + + +module.exports = { + + threadStates: {}, + + config: { + name: 'lyricalvideo', + aliases: ['lv'], + version: '1.0', + author: 'Kshitiz', + countDown: 5, + role: 0, + shortDescription: 'Lyrical video from lyrics edit vibe', + longDescription: 'Lyrical video from lyrics edit vibe', + category: 'media', + guide: { + en: '{p}{n}', + } + }, + + + onStart: async function ({ api, event }) { + const threadID = event.threadID; + + if (!this.threadStates[threadID]) { + this.threadStates[threadID] = {}; + } + + try { + api.setMessageReaction("🕐", event.messageID, (err) => {}, true); + + const apiUrl = "https://lyrics-video.vercel.app/kshitiz"; + const response = await axios.get(apiUrl); + + if (response.data.url) { + const tikTokUrl = response.data.url; + console.log(` Video URL: ${tikTokUrl}`); + + const turtleApiUrl = `https://tikdl-video.vercel.app/tiktok?url=${encodeURIComponent(tikTokUrl)}`; + const turtleResponse = await axios.get(turtleApiUrl); + + if (turtleResponse.data.videoUrl) { + const videoUrl = turtleResponse.data.videoUrl; + console.log(`Downloadable Video URL: ${videoUrl}`); + + const cacheFilePath = __dirname + `/cache/${Date.now()}.mp4`; + await this.downloadVideo(videoUrl, cacheFilePath); + + if (fs.existsSync(cacheFilePath)) { + await api.sendMessage({ + body: "Random lyrical video.", + attachment: fs.createReadStream(cacheFilePath), + }, threadID, event.messageID); + + fs.unlinkSync(cacheFilePath); + } else { + api.sendMessage("Error downloading the video.", threadID); + } + } else { + api.sendMessage("Error fetching video URL.", threadID); + } + } else { + api.sendMessage("Error fetching data from API.", threadID); + } + } catch (err) { + console.error(err); + api.sendMessage("An error occurred while processing command.", threadID); + } + }, + + downloadVideo: async function (url, cacheFilePath) { + try { + const response = await axios({ + method: "GET", + url: url, + responseType: "arraybuffer" + }); + + fs.writeFileSync(cacheFilePath, Buffer.from(response.data, "utf-8")); + } catch (err) { + console.error(err); + } + }, +}; diff --git a/scripts/cmds/married.js b/scripts/cmds/married.js new file mode 100644 index 000000000..8fab24736 --- /dev/null +++ b/scripts/cmds/married.js @@ -0,0 +1,73 @@ +module.exports = { + config: { + name: "married", + aliases: ["married"], + version: "1.0", + author: "kivv", + countDown: 5, + role: 0, + shortDescription: "get a wife", + longDescription: "", + category: "married", + guide: "{@mention}" + }, + + onLoad: async function () { + const { resolve } = require ("path"); + const { existsSync, mkdirSync } = require ("fs-extra"); + const { downloadFile } = global.utils; + const dirMaterial = __dirname + `/cache/canvas/`; + const path = resolve(__dirname, 'cache/canvas', 'marriedv5.png'); + if (!existsSync(dirMaterial + "canvas")) mkdirSync(dirMaterial, { recursive: true }); + if (!existsSync(path)) await downloadFile("https://i.ibb.co/mhxtgwm/49be174dafdc259030f70b1c57fa1c13.jpg", path); + }, + + circle: async function (image) { + const jimp = require("jimp"); + image = await jimp.read(image); + image.circle(); + return await image.getBufferAsync("image/png"); + }, + + makeImage: async function ({ one, two }) { + const fs = require ("fs-extra"); + const path = require ("path"); + const axios = require ("axios"); + const jimp = require ("jimp"); + const __root = path.resolve(__dirname, "cache", "canvas"); + + let batgiam_img = await jimp.read(__root + "/marriedv5.png"); + let pathImg = __root + `/batman${one}_${two}.png`; + let avatarOne = __root + `/avt_${one}.png`; + let avatarTwo = __root + `/avt_${two}.png`; + + let getAvatarOne = (await axios.get(`https://graph.facebook.com/${one}/picture?width=512&height=512&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662`, { responseType: 'arraybuffer' })).data; + fs.writeFileSync(avatarOne, Buffer.from(getAvatarOne, 'utf-8')); + + let getAvatarTwo = (await axios.get(`https://graph.facebook.com/${two}/picture?width=512&height=512&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662`, { responseType: 'arraybuffer' })).data; + fs.writeFileSync(avatarTwo, Buffer.from(getAvatarTwo, 'utf-8')); + + let circleOne = await jimp.read(await this.circle(avatarOne)); + let circleTwo = await jimp.read(await this.circle(avatarTwo)); + batgiam_img.composite(circleOne.resize(130, 130), 300, 150).composite(circleTwo.resize(130, 130), 170, 230); + + let raw = await batgiam_img.getBufferAsync("image/png"); + + fs.writeFileSync(pathImg, raw); + fs.unlinkSync(avatarOne); + fs.unlinkSync(avatarTwo); + + return pathImg; + }, + + onStart: async function ({ event, api, args }) { + const fs = require ("fs-extra"); + const { threadID, messageID, senderID } = event; + const mention = Object.keys(event.mentions); + if (!mention[0]) return api.sendMessage("Please mention 1 person.", threadID, messageID); + else { + const one = senderID, two = mention[0]; + return this.makeImage({ one, two }).then(path => api.sendMessage({ body: "", attachment: fs.createReadStream(path) }, threadID, () => fs.unlinkSync(path), messageID)); + } + } +}; \ No newline at end of file diff --git a/scripts/cmds/nemo.js b/scripts/cmds/nemo.js new file mode 100644 index 000000000..5ce8eae00 --- /dev/null +++ b/scripts/cmds/nemo.js @@ -0,0 +1,167 @@ +const axios = require('axios'); +const fs = require("fs-extra"); +module.exports = { + config: { + name: "nemo", +aliases: ["sandy"], + version: 2.0, + author: "OtinXSandip", + longDescription: "ai with diff utilities", + category: "ai", + guide: { + en: "{p}{n} questions\nsdxl\nimagine\nart\ngen\ndraw\nnsfw\nanime\nsay\nmusic\ncdp", + }, + }, + onStart: async function ({ message, event, Reply, args, api, usersData }) { + try { + const id = event.senderID; + const userData = await usersData.get(id); + const name = userData.name; + const ment = [{ id, tag: name }]; + const prompt = args.join(" "); + + if (!prompt) { + return message.reply("Please provide questions or\nnemo gen cat\nnemo draw cat\nnemo art\nnemo imagine\nnemo sdxl\nnemo say or tts\nnemo song\nnemo anime\nnemo nsfw\nnemo cdp"); + } + + const encodedPrompt = encodeURIComponent(prompt); + + if (prompt.includes("sdxl")) { + const [promptText, model] = args.join(' ').split('|').map((text) => text.trim()); + const puti = model || "2"; + const baseURL = `https://sandipapi.onrender.com/sdxl?prompt=${promptText}&model=${puti}`; + + message.reply({ + body: `${name}`, + mentions: ment, + attachment: await global.utils.getStreamFromURL(baseURL) + }); + } + else if (prompt.includes("nsfw")) { + const { data } = await axios.get(`https://sandipapi.onrender.com/nsfw`); + const imageRandom = await global.utils.getStreamFromURL(data.url); + return message.reply({ body: `${name}`, +mentions: ment, + attachment: imageRandom + }); +} +else if (prompt.includes("cdp")) { + const { data } = await axios.get("https://sandipapi.onrender.com/dp"); + const maleImg = await axios.get(data.male, { responseType: "arraybuffer" }); + fs.writeFileSync(__dirname + "/tmp/img1.png", Buffer.from(maleImg.data, "utf-8")); + const femaleImg = await axios.get(data.female, { responseType: "arraybuffer" }); + fs.writeFileSync(__dirname + "/tmp/img2.png", Buffer.from(femaleImg.data, "utf-8")); + + const msg = `${name}`; + const allImages = [ + fs.createReadStream(__dirname + "/tmp/img1.png"), + fs.createReadStream(__dirname + "/tmp/img2.png") + ]; + + message.reply({ + body: msg, + attachment: allImages + }); +} + else if (prompt.includes("imagine")) { + let promptText, model; + if (prompt.includes("|")) { + [promptText, model] = prompt.split("|").map((str) => str.trim()); + } else { + promptText = prompt; + model = 19; + } + const response = await axios.get(`https://shivadon.onrender.com/test?prompt=${encodeURIComponent(promptText)}&model=${model}`); + const img = response.data.combinedImageUrl; + message.reply({ + body: `${name}`, + mentions: ment, + attachment: await global.utils.getStreamFromURL(img) + }); + } else if (prompt.includes("draw")) { + const [promptText, model] = args.join(' ').split('|').map((text) => text.trim()); + const puti = model || "5"; + const baseURL = `https://sandipapi.onrender.com/jeevan?prompt=${promptText}&model=${puti}`; + + message.reply({ + body: `${name}`, + mentions: ment, + attachment: await global.utils.getStreamFromURL(baseURL) + }); + } else if (prompt.includes("gen")) { + const [promptText, model] = args.join(' ').split('|').map((text) => text.trim()); + const puti = model || "19"; + const baseURL = `https://sandipapi.onrender.com/gen?prompt=${promptText}&model=${puti}`; + + message.reply({ + body: `${name}`, + mentions: ment, + attachment: await global.utils.getStreamFromURL(baseURL) + }); + } else if (prompt.includes("art")) { + const imgurl = encodeURIComponent(event.messageReply.attachments[0].url); + + const [promptText, model] = prompt.split('|').map((text) => text.trim()); + const puti = model || "37"; + + const lado = `https://sandipapi.onrender.com/art?imgurl=${imgurl}&prompt=${encodeURIComponent(promptText)}&model=${puti}`; + const attachment = await global.utils.getStreamFromURL(lado); + message.reply({ + body: `${name}`, + mentions: ment, + attachment, + }); + } + +else if (prompt.includes("anime")) { + const { data } = await axios.get(`https://sandipapi.onrender.com/anime`); + const imageRandom = await global.utils.getStreamFromURL(data.url); + return message.reply({ body: `${name}`, +mentions: ment, + attachment: imageRandom + }); +} + else if (prompt.includes("say") || prompt.includes("|tts")) { + const text = event.type === 'message_reply' ? event.messageReply.body : args.join(' '); + + const [lado, model] = args.join(" ").split('|').map((text) => text.trim()); + const puti = model || "18"; + const link = `https://sandipapi.onrender.com/speak?text=${text}&model=${puti}`; + + try { + const response = await axios.get(link); + const speak_url = response.data.speak_url; + + message.reply({ + body: `${name}`, +mentions: ment, + attachment: await global.utils.getStreamFromURL(speak_url) + }); + } catch (error) { + console.error("Error:", error.message); + } +} +else if (prompt.includes("music")) { + const song = args.join(" "); + const link = `https://sandipapi.onrender.com/music?song=${encodeURIComponent(song)}`; + + message.reply({ + body: `${name}`, + mentions: ment, + attachment: await global.utils.getStreamFromURL(link) + }); +} +else { + const response = await axios.get(`https://sandipapi.onrender.com/gpt?prompt=${encodedPrompt}`); + const lado = response.data.answer; + + message.reply({ + body: `${name}: ${lado}`, + mentions: ment, + }); + } + } catch (error) { + console.error("Error:", error.message); + } + }, +}; \ No newline at end of file diff --git a/scripts/cmds/p3ssy.js b/scripts/cmds/p3ssy.js new file mode 100644 index 000000000..749673802 --- /dev/null +++ b/scripts/cmds/p3ssy.js @@ -0,0 +1,32 @@ +module.exports = { + config: { + name: "pussy", + aliases: ["18+"], + version: "1.0", + author: "Doru fix by kivv", + countDown: 5, + role: 2, + shortDescription: "send you pic of pussy", + longDescription: "sends u pic of girls pussy", + category: "18+", + guide: "{pn}" + }, + + onStart: async function ({ message }) { + var link = [ +"https://i.ibb.co/jfqMF07/image.jpg", +"https://i.ibb.co/tBBCS4y/image.jpg", +"https://i.ibb.co/3zpyMVY/image.jpg", +"https://i.ibb.co/gWbWT8k/image.jpg", +"https://i.ibb.co/mHtyD1P/image.jpg", +"https://i.ibb.co/vPHNhdY/image.jpg", +"https://i.ibb.co/rm6rPjb/image.jpg", +"https://i.ibb.co/7GpN2GW/image.jpg", +"https://i.ibb.co/CnfMVpg/image.jpg", + ] +let img = link[Math.floor(Math.random()*link.length)] +message.send({ + body: '「 Pussy💦🥵 」',attachment: await global.utils.getStreamFromURL(img) +}) +} + } diff --git a/scripts/cmds/pair4.js b/scripts/cmds/pair4.js new file mode 100644 index 000000000..0976aa16f --- /dev/null +++ b/scripts/cmds/pair4.js @@ -0,0 +1,109 @@ +const { loadImage, createCanvas } = require("canvas"); +const axios = require("axios"); +const fs = require("fs-extra"); + +module.exports = { + config: { + name: "pair4", + countDown: 5, + role: 0, + category: "fun", + shortDescription: { + en: "", + }, + }, + onStart: async function ({ api, event, args, usersData, threadsData }) { + let pathImg = __dirname + "/cache/background.png"; + let pathAvt1 = __dirname + "/cache/Avtmot.png"; + let pathAvt2 = __dirname + "/cache/Avthai.png"; + + var id1 = event.senderID; + var name1 = "User1"; // Replace with function that retrieves the name of the user + var ThreadInfo = await api.getThreadInfo(event.threadID); + var all = ThreadInfo.userInfo; + for (let c of all) { + if (c.id == id1) var gender1 = c.gender; + } + const botID = api.getCurrentUserID(); + let ungvien = []; + if (gender1 == "FEMALE") { + for (let u of all) { + if (u.gender == "MALE") { + if (u.id !== id1 && u.id !== botID) ungvien.push(u.id); + } + } + } else if (gender1 == "MALE") { + for (let u of all) { + if (u.gender == "FEMALE") { + if (u.id !== id1 && u.id !== botID) ungvien.push(u.id); + } + } + } else { + for (let u of all) { + if (u.id !== id1 && u.id !== botID) ungvien.push(u.id); + } + } + var id2 = ungvien[Math.floor(Math.random() * ungvien.length)]; + var name2 = "User2"; // Replace with function that retrieves the name of the user + var rd1 = Math.floor(Math.random() * 100) + 1; + var cc = ["0", "-1", "99,99", "-99", "-100", "101", "0,01"]; + var rd2 = cc[Math.floor(Math.random() * cc.length)]; + var djtme = [`${rd1}`, `${rd1}`, `${rd1}`, `${rd1}`, `${rd1}`, `${rd2}`, `${rd1}`, `${rd1}`, `${rd1}`, `${rd1}`]; + + var tile = djtme[Math.floor(Math.random() * djtme.length)]; + + var background = [ + "https://i.postimg.cc/wjJ29HRB/background1.png", + "https://i.postimg.cc/zf4Pnshv/background2.png", + "https://i.postimg.cc/5tXRQ46D/background3.png", + ]; + var rd = background[Math.floor(Math.random() * background.length)]; + let getAvtmot = ( + await axios.get(`https://graph.facebook.com/${id1}/picture?width=720&height=720&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662`, { + responseType: "arraybuffer", + }) + ).data; + fs.writeFileSync(pathAvt1, Buffer.from(getAvtmot, "utf-8")); + let getAvthai = ( + await axios.get(`https://graph.facebook.com/${id2}/picture?width=720&height=720&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662`, { + responseType: "arraybuffer", + }) + ).data; + fs.writeFileSync(pathAvt2, Buffer.from(getAvthai, "utf-8")); + + let getbackground = ( + await axios.get(`${rd}`, { + responseType: "arraybuffer", + }) + ).data; + fs.writeFileSync(pathImg, Buffer.from(getbackground, "utf-8")); + + let baseImage = await loadImage(pathImg); + let baseAvt1 = await loadImage(pathAvt1); + let baseAvt2 = await loadImage(pathAvt2); + let canvas = createCanvas(baseImage.width, baseImage.height); + let ctx = canvas.getContext("2d"); + ctx.drawImage(baseImage, 0, 0, canvas.width, canvas.height); + ctx.drawImage(baseAvt1, 100, 150, 300, 300); + ctx.drawImage(baseAvt2, 900, 150, 300, 300); + const imageBuffer = canvas.toBuffer(); + fs.writeFileSync(pathImg, imageBuffer); + fs.removeSync(pathAvt1); + fs.removeSync(pathAvt2); + return api.sendMessage( + { + body: `Congratulations ${name1} successfully paired with ${name2}\nThe odds are ${tile}%`, + mentions: [ + { + tag: `${name2}`, + id: id2, + }, + ], + attachment: fs.createReadStream(pathImg), + }, + event.threadID, + () => fs.unlinkSync(pathImg), + event.messageID + ); + }, +}; \ No newline at end of file diff --git a/scripts/cmds/pairv2.js b/scripts/cmds/pairv2.js new file mode 100644 index 000000000..8893bade7 --- /dev/null +++ b/scripts/cmds/pairv2.js @@ -0,0 +1,108 @@ +const axios = require("axios"); +const fs = require("fs-extra"); +module.exports = { + config: { + name: "pair2", + countDown: 10, + role: 0, + shortDescription: { + en: "Get to know your partner", + }, + longDescription : { + en: "Know your destiny and know who you will complete your life with", + }, + category: "love", + guide: { + en: "{pn}" + } +}, +onStart: async function ({ api, args, message, event, threadsData, usersData, dashBoardData, globalData, threadModel, userModel, dashBoardModel, globalModel, role, commandName, getLang }) { +const { loadImage, createCanvas } = require("canvas"); + let pathImg = __dirname + "/assets/background.png"; + let pathAvt1 = __dirname + "/assets/any.png"; + let pathAvt2 = __dirname + "/assets/avatar.png"; + + var id1 = event.senderID; + var name1 = await usersData.getName(id1); + var ThreadInfo = await api.getThreadInfo(event.threadID); + var all = ThreadInfo.userInfo + for (let c of all) { + if (c.id == id1) var gender1 = c.gender; + }; + const botID = api.getCurrentUserID(); + let ungvien = []; + if(gender1 == "FEMALE"){ + for (let u of all) { + if (u.gender == "MALE") { + if (u.id !== id1 && u.id !== botID) ungvien.push(u.id) + } + } + } + else if(gender1 == "MALE"){ + for (let u of all) { + if (u.gender == "FEMALE") { + if (u.id !== id1 && u.id !== botID) ungvien.push(u.id) + } + } + } + else { + for (let u of all) { + if (u.id !== id1 && u.id !== botID) ungvien.push(u.id) + } + } + var id2 = ungvien[Math.floor(Math.random() * ungvien.length)]; + var name2 = await usersData.getName(id2); + var rd1 = Math.floor(Math.random() * 100) + 1; + var cc = ["0", "-1", "99,99", "-99", "-100", "101", "0,01"]; + var rd2 = cc[Math.floor(Math.random() * cc.length)]; + var djtme = [`${rd1}`, `${rd1}`, `${rd1}`, `${rd1}`, `${rd1}`, `${rd2}`, `${rd1}`, `${rd1}`, `${rd1}`, `${rd1}`]; + + var tile = djtme[Math.floor(Math.random() * djtme.length)]; + + var background = [ + "https://i.ibb.co/RBRLmRt/Pics-Art-05-14-10-47-00.jpg" + ]; + + let getAvtmot = ( + await axios.get( `https://graph.facebook.com/${id1}/picture?width=720&height=720&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662`, + { responseType: "arraybuffer" } + ) + ).data; + fs.writeFileSync(pathAvt1, Buffer.from(getAvtmot, "utf-8")); + + let getAvthai = ( + await axios.get( `https://graph.facebook.com/${id2}/picture?width=720&height=720&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662`, + { responseType: "arraybuffer" } + ) + ).data; + fs.writeFileSync(pathAvt2, Buffer.from(getAvthai, "utf-8")); + + let getbackground = ( + await axios.get(`${background}`, { + responseType: "arraybuffer", + }) + ).data; + fs.writeFileSync(pathImg, Buffer.from(getbackground, "utf-8")); + + let baseImage = await loadImage(pathImg); + let baseAvt1 = await loadImage(pathAvt1); + let baseAvt2 = await loadImage(pathAvt2); + let canvas = createCanvas(baseImage.width, baseImage.height); + let ctx = canvas.getContext("2d"); + ctx.drawImage(baseImage, 0, 0, canvas.width, canvas.height); + ctx.drawImage(baseAvt1, 111, 175, 330, 330); + ctx.drawImage(baseAvt2, 1018, 173, 330, 330); + const imageBuffer = canvas.toBuffer(); + fs.writeFileSync(pathImg, imageBuffer); + fs.removeSync(pathAvt1); + fs.removeSync(pathAvt2); + return api.sendMessage({ body: `『💗』Congratulations ${name1}『💗』\『❤️』Looks like your destiny brought you together with ${name2}『❤️』\『🔗』Your link percentage is ${tile}%『🔗』`, + mentions: [{ + tag: `${name2}`, + id: id2 + },{tag: `${name1}`, id: id1 }], attachment: fs.createReadStream(pathImg) }, + event.threadID, + () => fs.unlinkSync(pathImg), + event.messageID); +} +} \ No newline at end of file diff --git a/scripts/cmds/pickuplines.js b/scripts/cmds/pickuplines.js new file mode 100644 index 000000000..8e8ca6b7b --- /dev/null +++ b/scripts/cmds/pickuplines.js @@ -0,0 +1,31 @@ +const axios = require("axios"); + +module.exports = { + config: { + name: "pickuplines", + aliases: ["pul"], + version: "1.0", + author: "AceGun", + countDown: 5, + role: 0, + shortDescription: "Get pickup lines", + longDescription: { + en: "Get random pickup lines.", + }, + category: "fun", + guide: { + en: "{prefix}pickuplines", + }, + }, + + onStart: async function ({ api, event }) { + try { + const response = await axios.get("https://api.popcat.xyz/pickuplines"); + const { pickupline } = response.data; + const message = `💘 ${pickupline}`; + return api.sendMessage(message, event.threadID); + } catch (error) { + console.error(error); + } + }, +}; \ No newline at end of file diff --git a/scripts/cmds/play.js b/scripts/cmds/play.js new file mode 100644 index 000000000..f9916257e --- /dev/null +++ b/scripts/cmds/play.js @@ -0,0 +1,98 @@ +const fs = require("fs-extra"); +const ytdl = require("@neoxr/ytdl-core"); +const yts = require("yt-search"); +const axios = require('axios'); +const tinyurl = require('tinyurl'); + +module.exports = { + config: { + name: "play", + version: "1.4", + author: "hedroxyy", + countDown: 5, + role: 0, + category: "media", + }, + + onStart: async function ({ api, event, message }) { + try { + let query = ''; + + + if (event.type === "message_reply" && ["audio", "video"].includes(event.messageReply.attachments[0].type)) { + const attachmentUrl = event.messageReply.attachments[0].url; + + + const transcription = await extractTextFromAudio(attachmentUrl); + + + query = transcription.split('\n')[0]; + } else { + + const input = event.body; + const data = input.split(" "); + + if (data.length < 2) { + return message.reply("Please put a song"); + } + + data.shift(); + query = data.join(" "); + } + + + const originalMessage = await message.reply(`Searching for "${query}"...`); + 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'); + if (fs.statSync(filePath).size > 26214400) { + fs.unlinkSync(filePath); + return message.reply('[ERR] The file could not be sent because it is larger than 25MB.'); + } + const replyMessage = { + body: `💗`, + attachment: fs.createReadStream(filePath), + }; + await api.unsendMessage(originalMessage.messageID); + await message.reply(replyMessage, event.threadID, () => { + fs.unlinkSync(filePath); + }); + }); + } catch (error) { + console.error('[ERROR]', error); + message.reply("An error occurred while processing the request."); + } + }, +}; + + +async function extractTextFromAudio(audioUrl) { + try { + const response = await axios.get(`https://milanbhandari.onrender.com/transcribe?url=${encodeURIComponent(audioUrl)}`); + return response.data.transcript || ''; + } catch (error) { + console.error('[ERROR]', error); + return ''; + } +} diff --git a/scripts/cmds/profilepicture.js b/scripts/cmds/profilepicture.js new file mode 100644 index 000000000..fa8e8e1e5 --- /dev/null +++ b/scripts/cmds/profilepicture.js @@ -0,0 +1,40 @@ +module.exports = { + config: { + name: "profilepicture", + aliases: ["pfp"], + version: "1.0", + author: "Shikaki", + role: 0, + shortDescription: "Get user avatar", + longDescription: "Get user avatar by mentioning or UID", + category: "image", + }, + + onStart: async function ({ event, message, usersData, api, args, getLang }) { + let uid; + + if (args[0]) { + + if (/^\d+$/.test(args[0])) { + uid = args[0]; + } else { + + const match = args[0].match(/profile\.php\?id=(\d+)/); + if (match) { + uid = match[1]; + } + } + } + + if (!uid) { + + uid = event.type === "message_reply" ? event.messageReply.senderID : Object.keys(event.mentions)[0] || event.senderID; + } + + const avatarUrl = await usersData.getAvatarUrl(uid); + + message.reply({ + attachment: await global.utils.getStreamFromURL(avatarUrl) + }); + } +}; diff --git a/scripts/cmds/prompt.js b/scripts/cmds/prompt.js new file mode 100644 index 000000000..86d4d0217 --- /dev/null +++ b/scripts/cmds/prompt.js @@ -0,0 +1,50 @@ +const { existsSync, mkdirSync } = require("fs"); +const axios = require("axios"); +const tinyurl = require('tinyurl'); + +module.exports = { + config: { + name: "prompt", + aliases: [], + version: "1.0", + author: "Vex_Kshitiz", + countDown: 5, + role: 0, + shortDescription: "Generate prompt for an image", + longDescription: "generate prompt for an image", + category: "image", + guide: { + en: "{p}prompt (reply to image)" + } + }, + + onStart: async function ({ message, event, api }) { + api.setMessageReaction("🕐", event.messageID, (err) => {}, true); + const { type, messageReply } = event; + const { attachments, threadID } = messageReply || {}; + + if (type === "message_reply" && attachments) { + const [attachment] = attachments; + const { url, type: attachmentType } = attachment || {}; + + if (!attachment || attachmentType !== "photo") { + return message.reply("Reply to an image."); + } + + try { + const tinyUrl = await tinyurl.shorten(url); + const apiUrl = `https://prompt-gen-eight.vercel.app/kshitiz?url=${encodeURIComponent(tinyUrl)}`; + const response = await axios.get(apiUrl); + + const { prompt } = response.data; + + message.reply(prompt, threadID); + } catch (error) { + console.error(error); + message.reply("❌ An error occurred while generating the prompt."); + } + } else { + message.reply("Please reply to an image."); + } + } +}; diff --git a/scripts/cmds/qr.js b/scripts/cmds/qr.js new file mode 100644 index 000000000..c2fe86764 --- /dev/null +++ b/scripts/cmds/qr.js @@ -0,0 +1,59 @@ +const request = require('request'); +const fs = require('fs'); + +module.exports = { + config: { + name: "qr", + version: "1.0", + shortDescription: "Generate a QR code to share links/text easily", + longDescription: "Generate a QR code to share links/text easily. Any text after the qr command will be encoded in the QR code. For multi-coloured QR codes, use the qr+ command instead.", + category: "search", + guide: "-qr {text}", + envConfig: {} + }, + onStart: async function({ message, event, threadsData, args }) { + if (args.length < 1) { + return message.reply("You must add text to your command, so I can convert it to a QR code.\Eg: `-qr This message is now encoded as a QR code`"); + } else { + // Necessary for choosing random colours for rich embeds + var colour_array = ["1211996", "3447003", "13089792", "16711858", "1088163", "16098851", "6150962"] + var randomNumber = getRandomNumber(0, colour_array.length - 1); + var randomColour = colour_array[randomNumber]; + var user_text = args.join(" ").split(" ").join("%20") + var qr_generator = `https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=${user_text}`; + + // Use request to fetch the QR code image from the API endpoint + request(qr_generator, { encoding: 'binary' }, function(error, response, body) { + if (!error && response.statusCode == 200) { + // Save the image as a file on the server + fs.writeFile('qr.png', body, 'binary', function(err) { + if (err) { + console.error(err); + return message.reply("An error occurred while generating the QR code."); + } + // Send the saved image file using sendLocalImage function + message.reply({ + attachment: fs.createReadStream('qr.png') + }, (err) => { + if (err) { + console.error(err); + return message.reply("An error occurred while sending the QR code image."); + } + // Remove the saved image file + fs.unlink('qr.png', function(err) { + if (err) console.error(err); + }); + }); + }); + } else { + return message.reply("An error occurred while generating the QR code."); + } + }); + } + + function getRandomNumber(min, max) { + return Math.floor(Math.random() * (max - min + 1)) + min; + } + }, + onEvent: async function({ api, event, threadsData }) {} +}; \ No newline at end of file diff --git a/scripts/cmds/quote.js b/scripts/cmds/quote.js new file mode 100644 index 000000000..a26c92b1a --- /dev/null +++ b/scripts/cmds/quote.js @@ -0,0 +1,32 @@ +.cmd install quote.js const axios = require('axios'); + +module.exports = { + config: { + name: "quote", + version: "1.0", + author: "YourName", + shortDescription: "Fetch a random quote.", + longDescription: "Fetches a random quote from an API.", + category: "text", + guide: { + en: "{pn} quote" + } + }, + + onStart: async function ({ message }) { + try { + const apiUrl = 'https://joshweb.click/quotes'; + const response = await axios.get(apiUrl); + + if (response.status === 200 && response.data && response.data.quotes && response.data.author) { + const { quotes, author } = response.data; + message.reply(`"${quotes}" - ${author}`); + } else { + message.reply("Failed to fetch a quote. Please try again later."); + } + } catch (error) { + console.error("Error fetching quote:", error); + message.reply("Failed to fetch a quote. Please try again later."); + } + } +}; diff --git a/scripts/cmds/randomuseragent.js b/scripts/cmds/randomuseragent.js new file mode 100644 index 000000000..eb5c49130 --- /dev/null +++ b/scripts/cmds/randomuseragent.js @@ -0,0 +1,51 @@ +.cmd install randomuseragent.js const { Random } = require('random-js'); + +module.exports = { + config: { + name: "randomuseragent", + aliases: ["rua"], + version: "1.1", + author: "hedroxyy", + countDown: 1, + role: 0, + shortDescription: "Generate and send random user agents", + longDescription: "Generate a specified number of random user agents and send them one by one.", + category: "tools", + guide: "{pn} {number of user agents}" + }, + + onStart: async function ({ event, message, args }) { + const numberOfUserAgents = parseInt(args[0]) || 5; // Default to 5 if no number is provided + const userAgents = generateRandomUserAgents(numberOfUserAgents); + + // Send each user agent one by one + for (let i = 0; i < userAgents.length; i++) { + const userAgent = userAgents[i]; + await message.send(`${userAgent}`); + } + } +}; + +function generateRandomUserAgents(numberOfUserAgents) { + const random = new Random(); + const userAgents = []; + + for (let i = 0; i < numberOfUserAgents; i++) { + const a = "Mozilla/5.0 (Symbian/3; Series60/"; + const b = random.integer(1, 9); + const c = random.integer(1, 9); + const d = "SamsungBrowser"; + const e = random.integer(100, 9999); + const f = "NEO-AL00 Build/HUAWEINEO-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/"; + const g = random.integer(1, 9); + const h = random.integer(1, 4); + const i1 = random.integer(1, 4); + const j = random.integer(1, 4); + const k = "Mobile Safari/537.36"; + + const userAgent = `${a}${b}.${c} ${d}${e}${f}${g}.${h}.${i1}.${j} ${k}`; + userAgents.push(userAgent); + } + + return userAgents; +} diff --git a/scripts/cmds/routineofnepalbanda.js b/scripts/cmds/routineofnepalbanda.js new file mode 100644 index 000000000..6310eaefd --- /dev/null +++ b/scripts/cmds/routineofnepalbanda.js @@ -0,0 +1,89 @@ +const axios = require("axios"); +const fs = require("fs-extra"); +const canvas = require("canvas"); + +module.exports = { + config: { + name: "routineofnepalbanda", + aliases: ["ronb"], + author: "Fun", + countDown: 5, + role: 0, + category: "Fun", + shortDescription: { + en: "make something RONB wrote about you or friends/ something", + }, + }, + wrapText: async (ctx, text, maxWidth) => { + return new Promise((resolve) => { + if (ctx.measureText(text).width < maxWidth) return resolve([text]); + if (ctx.measureText("W").width > maxWidth) return resolve(null); + const words = text.split(" "); + const lines = []; + let line = ""; + while (words.length > 0) { + let split = false; + while (ctx.measureText(words[0]).width >= maxWidth) { + const temp = words[0]; + words[0] = temp.slice(0, -1); + if (split) words[1] = `${temp.slice(-1)}${words[1]}`; + else { + split = true; + words.splice(1, 0, temp.slice(-1)); + } + } + if (ctx.measureText(`${line}${words[0]}`).width < maxWidth) + line += `${words.shift()} `; + else { + lines.push(line.trim()); + line = ""; + } + if (words.length === 0) lines.push(line.trim()); + } + return resolve(lines); + }); + }, + + onStart: async function ({ api, event, args }) { + let { senderID, threadID, messageID } = event; + const { loadImage, createCanvas } = require("canvas"); + const fs = require("fs-extra"); + const axios = require("axios"); + let pathImg = __dirname + "/cache/ronb.png"; + var text = args.join(" "); + if (!text)return api.sendMessage( + "Enter the content of the comment on the board", + threadID, + messageID + ); + let getPorn = ( + await axios.get(`https://i.ibb.co/vhtV1x9/image.jpg`, { + responseType: "arraybuffer", + }) + ).data; + fs.writeFileSync(pathImg, Buffer.from(getPorn, "utf-8")); + let baseImage = await loadImage(pathImg); + let canvas = createCanvas(baseImage.width, baseImage.height); + let ctx = canvas.getContext("2d"); + ctx.drawImage(baseImage, 0, 0, canvas.width, canvas.height); + ctx.font = "200 25px Arial"; + ctx.fillStyle = "#000000"; + ctx.textAlign = "start"; + let fontSize = 23; + while (ctx.measureText(text).width > 2400) { + fontSize--; + ctx.font = `200 ${fontSize}px Arial, sans-serif`; + } + const lines = await this.wrapText(ctx, text, 990); + ctx.fillText(lines.join("\n"), 50, 155); //comment + ctx.beginPath(); + const imageBuffer = canvas.toBuffer(); + fs.writeFileSync(pathImg, imageBuffer); + return api.sendMessage( + { attachment: fs.createReadStream(pathImg) }, + threadID, + () => fs.unlinkSync(pathImg), + messageID + ); + }, +}; diff --git a/scripts/cmds/sadcat.js b/scripts/cmds/sadcat.js new file mode 100644 index 000000000..05105de4c --- /dev/null +++ b/scripts/cmds/sadcat.js @@ -0,0 +1,40 @@ +const axios = require('axios'); +const fs = require('fs'); + +module.exports = { + config: { + name: "sadcat", + aliases: ["sc"], + version: "1.1", + author: "JV BARCENAS", + countDown: 5, + role: 0, + shortDescription: "sadcat with text", + longDescription: "sadcat with text", + category: "image", + guide: { + en: " {pn} {prompt}" + } + }, + + onStart: async function ({ event, message, usersData, args, getLang }) { + const userPrompt = args.join(' '); + + try { + const response = await axios.get(`https://api.popcat.xyz/sadcat?text=${encodeURIComponent(userPrompt)}`, { + responseType: 'arraybuffer' + }); + + const imageData = Buffer.from(response.data, 'binary'); + const pathSave = `${__dirname}/tmp/sadcat.png`; + fs.writeFileSync(pathSave, imageData); + + message.reply({ + attachment: fs.createReadStream(pathSave) + }, () => fs.unlinkSync(pathSave)); + } catch (error) { + console.error(error); + message.reply('An error occurred while generating the image.'); + } + } +}; diff --git a/scripts/cmds/ship.js b/scripts/cmds/ship.js new file mode 100644 index 000000000..a8d6dba34 --- /dev/null +++ b/scripts/cmds/ship.js @@ -0,0 +1,94 @@ +const { resolve } = require("path"); +const { existsSync, mkdirSync } = require("fs-extra"); + +module.exports = { + config: { + name: "ship", + author: "Otineeeeeyyyyyyy", + countDown: 5, + role: 0, + category: "love" , + shortDescription: { + en: "", + }, + }, + onLoad: async function() { + const { downloadFile } = global.utils; + const dirMaterial = __dirname + "/cache/canvas/"; + const path = resolve(__dirname, "cache/canvas", "pairing.jpg"); + if (!existsSync(dirMaterial)) mkdirSync(dirMaterial, { recursive: true }); + if (!existsSync(path)) await downloadFile("https://i.pinimg.com/736x/15/fa/9d/15fa9d71cdd07486bb6f728dae2fb264.jpg", path); + }, + makeImage: async function({ one, two }) { + const fs = require("fs-extra"); + const path = require("path"); + const axios = require("axios"); + const jimp = require("jimp"); + const __root = path.resolve(__dirname, "cache", "canvas"); + + let pairing_img = await jimp.read(__root + "/pairing.jpg"); + let pathImg = __root + `/pairing_${one}_${two}.png`; + let avatarOne = __root + `/avLt_${one}.png`; + let avatarTwo = __root + `/avLt_${two}.png`; + + let getAvatarOne = (await axios.get(`https://graph.facebook.com/${one}/picture?width=512&height=512&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662`, { responseType: 'arraybuffer' })).data; + fs.writeFileSync(avatarOne, Buffer.from(getAvatarOne, 'utf-8')); + + let getAvatarTwo = (await axios.get(`https://graph.facebook.com/${two}/picture?width=512&height=512&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662`, { responseType: 'arraybuffer' })).data; + fs.writeFileSync(avatarTwo, Buffer.from(getAvatarTwo, 'utf-8')); + + let circleOne = await jimp.read(await this.circle(avatarOne)); + let circleTwo = await jimp.read(await this.circle(avatarTwo)); + pairing_img.composite(circleOne.resize(85, 85), 355, 100).composite(circleTwo.resize(75, 75), 250, 140); + + let raw = await pairing_img.getBufferAsync("image/png"); + + fs.writeFileSync(pathImg, raw); + fs.unlinkSync(avatarOne); + fs.unlinkSync(avatarTwo); + + return pathImg; + }, + circle: async function(image) { + const jimp = require("jimp"); + image = await jimp.read(image); + image.circle(); + return await image.getBufferAsync("image/png"); + }, + onStart: async function({ api, event, args, usersData, threadsData }) { + const axios = require("axios"); + const fs = require("fs-extra"); + const { threadID, messageID, senderID } = event; + var tl = ['21%', '67%', '19%', '37%', '17%', '96%', '52%', '62%', '76%', '83%', '100%', '99%', "0%", "48%"]; + var tle = tl[Math.floor(Math.random() * tl.length)]; + let dataa = await api.getUserInfo(event.senderID); + let namee = await dataa[event.senderID].name; + let loz = await api.getThreadInfo(event.threadID); + var emoji = loz.participantIDs; + var id = emoji[Math.floor(Math.random() * emoji.length)]; + let data = await api.getUserInfo(id); + let name = await data[id].name; + var arraytag = []; + arraytag.push({id: event.senderID, tag: namee}); + arraytag.push({id: id, tag: name}); + + var sex = await data[id].gender; + var gender = sex == 2 ? "Male🧑" : sex == 1 ? "Female👩‍ " : "Tran Duc Bo"; + var one = senderID, two = id; + return this.makeImage({one, two}).then(async pathImg => { + var message = { + body: `💘${namee} paired with ${name} ${gender}💘\n\nTag : ${arraytag.map(tag => `@${tag.tag} `).join("")}`, + mentions: arraytag, + attachment: fs.createReadStream(pathImg), + }; + api.sendMessage(message, threadID, async () => { + try { + fs.unlinkSync(pathImg); + } catch (e) { + console.log(e); + } + }, messageID); + return; + }).catch(e => console.log(e)); + }, +}; \ No newline at end of file diff --git a/scripts/cmds/sim.js b/scripts/cmds/sim.js new file mode 100644 index 000000000..272c5f1d1 --- /dev/null +++ b/scripts/cmds/sim.js @@ -0,0 +1,2 @@ +const axios = require("axios"); module.exports = { config: { name: "sim", category: "ai", + }, onStart: async function ({ message, args }){ const a = "vyturex"; const response = await axios.get(`https://simsimi.${a}.com/chat?ques=${args.join(" ")}`); message.reply(response.data); }, }; \ No newline at end of file diff --git a/scripts/cmds/sing.js b/scripts/cmds/sing.js new file mode 100644 index 000000000..249148560 --- /dev/null +++ b/scripts/cmds/sing.js @@ -0,0 +1,87 @@ + module.exports = { + config: { + name: "sing", + version: "1.0", + role: 0, + author: "AceGun", + cooldowns: 5, + shortdescription: "download music from YouTube", + longdescription: "", + category: "media", + usages: "{pn} music name", + dependencies: { + "fs-extra": "", + "request": "", + "axios": "", + "ytdl-core": "", + "yt-search": "" + } + }, + + onStart: async ({ api, event }) => { + const axios = require("axios"); + const fs = require("fs-extra"); + const ytdl = require("ytdl-core"); + const request = require("request"); + const yts = require("yt-search"); + + const input = event.body; + const text = input.substring(12); + const data = input.split(" "); + + if (data.length < 2) { + return api.sendMessage("Please specify a music name.", event.threadID); + } + + data.shift(); + const musicName = data.join(" "); + + try { + api.sendMessage(`✅ | Searching music for "${musicName}".\n⏳ | Please wait...`, event.threadID); + + const searchResults = await yts(musicName); + if (!searchResults.videos.length) { + return api.sendMessage("No music found.", event.threadID, event.messageID); + } + + const music = searchResults.videos[0]; + const musicUrl = music.url; + + const stream = ytdl(musicUrl, { filter: "audioonly" }); + + const fileName = `${event.senderID}.mp3`; + 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 music: ${info.videoDetails.title}`); + }); + + stream.on('end', () => { + console.info('[DOWNLOADER] Downloaded'); + + if (fs.statSync(filePath).size > 26214400) { + fs.unlinkSync(filePath); + return api.sendMessage('❌ | The file could not be sent because it is larger than 25MB.', event.threadID); + } + + const message = { + body: `💁‍♀ | Here's your music\n\n🔮 | Title: ${music.title}\n⏰ | Duration: ${music.duration.timestamp}`, + attachment: fs.createReadStream(filePath) + }; + + api.sendMessage(message, event.threadID, () => { + fs.unlinkSync(filePath); + }); + }); + } catch (error) { + console.error('[ERROR]', error); + api.sendMessage('🥺 | An error occurred while processing the command.', event.threadID); + } + } +}; \ No newline at end of file diff --git a/scripts/cmds/spam.js b/scripts/cmds/spam.js new file mode 100644 index 000000000..5cbe31071 --- /dev/null +++ b/scripts/cmds/spam.js @@ -0,0 +1,25 @@ +const fs = require("fs"); +module.exports = { + config: { + name: "spam", + version: "1.0", + author: "Otineeeyyyyy", + countDown: 5, + role: 2, + shortDescription: "useless", + longDescription: "", + category: "fun", + guide: { + vi: "{pn} " + } + }, + onStart: async function ({ api,event,args }) { + const axios = require("axios"); + const message = args.join(' '); + if (!message) +return api.sendMessage(`Type the text that you want to spam.. `, event.threadID, event.messageID); + var k = function (k) { api.sendMessage(k, event.threadID)}; +for (i = 0; i < 100; i++) +{ k(`${message}`);} + } +}; \ No newline at end of file diff --git a/scripts/cmds/spy.js b/scripts/cmds/spy.js new file mode 100644 index 000000000..8d3cc088d --- /dev/null +++ b/scripts/cmds/spy.js @@ -0,0 +1,66 @@ +module.exports = { + config: { + name: "spy", + version: "1.0", + author: "Shikaki", + countDown: 60, + role: 0, + shortDescription: "Get user information and avatar", + longDescription: "Get user information and avatar by mentioning", + category: "image", + }, + + onStart: async function ({ event, message, usersData, api, args, getLang }) { + let avt; + const uid1 = event.senderID; + const uid2 = Object.keys(event.mentions)[0]; + let uid; + + if (args[0]) { + // Check if the argument is a numeric UID + if (/^\d+$/.test(args[0])) { + uid = args[0]; + } else { + // Check if the argument is a profile link + const match = args[0].match(/profile\.php\?id=(\d+)/); + if (match) { + uid = match[1]; + } + } + } + + if (!uid) { + // If no UID was extracted from the argument, use the default logic + uid = event.type === "message_reply" ? event.messageReply.senderID : uid2 || uid1; + } + + api.getUserInfo(uid, async (err, userInfo) => { + if (err) { + return message.reply("Failed to retrieve user information."); + } + + const avatarUrl = await usersData.getAvatarUrl(uid); + + // Gender mapping + let genderText; + switch (userInfo[uid].gender) { + case 1: + genderText = "Girl"; + break; + case 2: + genderText = "Boy"; + break; + default: + genderText = "Unknown"; + } + + // Construct and send the user's information with avatar + const userInformation = `❏ Name: ${userInfo[uid].name}\n❏ Profile URL: ${userInfo[uid].profileUrl}\n❏ Gender: ${genderText}\n❏ User Type: ${userInfo[uid].type}\n❏ Is Friend: ${userInfo[uid].isFriend ? "Yes" : "No"}\n❏ Is Birthday today: ${userInfo[uid].isBirthday ? "Yes" : "No"}`; + + message.reply({ + body: userInformation, + attachment: await global.utils.getStreamFromURL(avatarUrl) + }); + }); + } +}; diff --git a/scripts/cmds/ss.js b/scripts/cmds/ss.js new file mode 100644 index 000000000..4a83d482c --- /dev/null +++ b/scripts/cmds/ss.js @@ -0,0 +1,62 @@ +const fetch = require('node-fetch'); +const fs = require('fs-extra'); + +module.exports = { + config: { + name: "screenshot", +aliases: ["ss"], + version: "1.0", + author: "Fixed by JARiF", + countDown: 5, + role: 0, + longDescription: "Screenshot webpage or Google search", + category: "wiki", + guide: { + en: "{pn} 'url'\pn} g- 'text'", + }, + }, + + onStart: async function ({args, message, event }) { + + + if (args.length === 0) { + message.reply(`invalid input⚠️\lease follow:\{p}screenshot \r\{p}screenshot -g .`); + return; + } + const { getPrefix } = global.utils; + const p = getPrefix(event.threadID); + + let url; + if (args[0] === '-g') { + if (args.length < 2) { + message.reply(`invalid text input after -g Tag⚠️\lease follow:\{p}screenshot -g YourText`); + return; + } + const query = args.slice(1).join('+'); + url = `https://www.google.com/search?q=${query}&tbm=isch`; + } else { + url = args[0]; + if (!url.match(/^https?:\.+$/)) { + url = `https://${url}`; + } + } + const apiURL = `https://image.thum.io/get/width/1920/crop/400/fullpage/noanimate/${url}`; + try { + const res = await fetch(apiURL); + if (!res.ok) { + message.reply(`API not responding. try again later..!`); + return; + } + const buffer = await res.buffer(); + const tag = Date.now(); fs.writeFileSync(`${tag}.jpg`, buffer); + + message.reply({ + body: `Here is the screenshot: `, + attachment: fs.createReadStream(`${tag}.jpg`), + }, () => fs.unlinkSync(`${tag}.jpg`)); + } catch (err) { + console.log(err); + message.reply(` error when generating the screenshot for ${url}.`); + } + }, +}; \ No newline at end of file diff --git a/scripts/cmds/sugarmomma.js b/scripts/cmds/sugarmomma.js new file mode 100644 index 000000000..35871cc10 --- /dev/null +++ b/scripts/cmds/sugarmomma.js @@ -0,0 +1,115 @@ +module.exports = { + config: { + name: "sugarmomma", + aliases: ["n3de"], + version: "1.0", + author: "hedroxyy", + countDown: 5, + role: 2, + shortDescription: "send you pic of nude", + longDescription: "sends u pic of girls nude", + category: "18+", + guide: "{pn}" + }, + + onStart: async function ({ message }) { + var link = [ +"https://i.imgur.com/T5BPkRG.jpg", +"https://i.imgur.com/69MT3Wg.jpg", +"https://i.imgur.com/z6EtvVm.jpg", +"https://i.imgur.com/hf3KluZ.jpg", +"https://i.imgur.com/9XxaYI3.jpg", +"https://i.imgur.com/rCSoCaA.jpg", +"https://i.imgur.com/6olWIAr.jpg", +"https://i.imgur.com/AcKfCpt.jpg", +"https://i.imgur.com/OA6wMjp.jpg", +"https://i.imgur.com/WBUspj9.jpg", +"https://i.imgur.com/GBzR0aY.jpg", +"https://i.imgur.com/EefsUX3.jpg", +"https://i.imgur.com/kWqwF1K.jpg", +"https://i.imgur.com/tUee6NZ.jpg", +"https://i.imgur.com/NJSUN9k.jpg", +"https://i.imgur.com/GxPSGo9.jpg", +"https://i.imgur.com/junGPIa.jpg", +"https://i.imgur.com/fj0WV5S.jpg", +"https://i.imgur.com/trR1T6P.jpg", +"https://i.imgur.com/5GPy7MZ.jpg", +"https://i.imgur.com/kPpcoFe.jpg", +"https://i.imgur.com/DibHjLg.jpg", +"https://i.imgur.com/lzY1HP3.jpg", +"https://i.imgur.com/z7oHPeD.jpg", +"https://i.imgur.com/2kW0UrZ.jpg", +"https://i.imgur.com/2TJXTM8.jpg", +"https://i.imgur.com/hHkxDMt.jpg", +"https://i.imgur.com/H7vs8c6.jpg", +"https://i.imgur.com/jVSz5tX.jpg", +"https://i.imgur.com/vF32mr2.jpg", +"https://i.imgur.com/BoJDDpm.jpg", +"https://i.imgur.com/GbAkVR3.jpg", +"https://i.imgur.com/aMw2mEz.jpg", +"https://i.imgur.com/egPMyvA.jpg", +"https://i.imgur.com/OPZDGUY.jpg", +"https://i.imgur.com/dxbjwmx.jpg", +"https://i.imgur.com/FNQQETm.jpg", +"https://i.imgur.com/hT7bbZr.jpg", +"https://i.imgur.com/0Eg5ZN4.jpg", +"https://i.imgur.com/Qle3LJi.jpg", +"https://i.imgur.com/pzJq8ay.jpg", +"https://i.imgur.com/NyqSI83.jpg", +"https://i.imgur.com/p41qMvY.jpg", +"https://i.imgur.com/p7EiSkE.jpg", +"https://i.imgur.com/JYUOHUd.jpg", +"https://i.imgur.com/cWxtrc2.jpg", +"https://i.imgur.com/2pSSMtl.jpg", +"https://i.imgur.com/DAnirH8.jpg", +"https://i.imgur.com/8XyrCGu.jpg", +"https://i.imgur.com/I7rtkwT.jpg", +"https://i.imgur.com/KCo1P0u.jpg", +"https://i.imgur.com/GLIwmQk.jpg", +"https://i.imgur.com/Mue8s3E.jpg", +"https://i.imgur.com/Fak0Ahg.jpg", +"https://i.imgur.com/EDsi80I.jpg", +"https://i.imgur.com/JvVpF6W.jpg", +"https://i.imgur.com/I3CE748.jpg", +"https://i.imgur.com/CH0PxJP.jpg", +"https://i.imgur.com/3T1q41U.jpg", +"https://i.imgur.com/WD3uX9V.jpg", +"https://i.imgur.com/7sS6lji.jpg", +"https://i.imgur.com/kFAfAC3.jpg", +"https://i.imgur.com/EpyMadP.jpg", +"https://i.imgur.com/9AJt2Tt.jpg", +"https://i.imgur.com/55EbaeY.jpg", +"https://i.imgur.com/xRJSAmJ.jpg", +"https://i.imgur.com/kXA2fSX.jpg", +"https://i.imgur.com/dy1YlJs.jpg", +"https://i.imgur.com/0LlpoXG.jpg", +"https://i.imgur.com/Kof1KXr.jpg", +"https://i.imgur.com/xIgnYGo.jpg", +"https://i.imgur.com/4cFgFZq.jpg", +"https://i.imgur.com/d8k4a6G.jpg", +"https://i.imgur.com/eraz44H.jpg", +"https://i.imgur.com/uSHLM8y.jpg", +"https://i.imgur.com/2iy9KnD.jpg", +"https://i.imgur.com/Aew0gjm.jpg", +"https://i.imgur.com/sxXm5cI.jpg", +"https://i.imgur.com/2or8urJ.jpg", +"https://i.imgur.com/cslJLNt.jpg", +"https://i.imgur.com/zQztjGM.jpg", +"https://i.imgur.com/dyluWmm.jpg", +"https://i.imgur.com/CgAc5ux.jpg", +"https://i.imgur.com/Z5ph1wc.jpg", +"https://i.imgur.com/0bRLqAR.jpg", +"https://i.imgur.com/x68KtYI.jpg", +"https://i.imgur.com/cAich41.jpg", +"https://i.imgur.com/BMcYATY.jpg", +"https://i.imgur.com/E9PYK7J.jpg", +"https://i.imgur.com/1oaM7ai.jpg", +"https://i.imgur.com/Urx9Ijl.jpg", +"https://i.imgur.com/QYGOZuK.jpg", + ] +let img = link[Math.floor(Math.random()*link.length)] +message.send({ + body: '「 Sugar Momma 💦🥵 」',attachment: await global.utils.getStreamFromURL(img) +}) +} + } diff --git a/scripts/cmds/tinyurl.js b/scripts/cmds/tinyurl.js new file mode 100644 index 000000000..1fcbc4c3a --- /dev/null +++ b/scripts/cmds/tinyurl.js @@ -0,0 +1,38 @@ +const axios = require("axios"); +const fs = require('fs-extra'); +const path = require('path'); +const { shortenURL } = global.utils; + +async function shortURL(api, event) { + if (event.type !== "message_reply" || !event.messageReply.attachments || event.messageReply.attachments.length === 0) { + return api.sendMessage({ body: "❌ | Please reply to an attachment." }, event.threadID, event.messageID); + } + + const attachment = event.messageReply.attachments[0]; + + try { + const shortUrl = await shortenURL(attachment.url); + api.sendMessage({ body: `${shortUrl}` }, event.threadID, event.messageID); + } catch (error) { + api.sendMessage({ body: "❌ | Error occurred while shortening URL." }, event.threadID, event.messageID); + console.error(error); + } +} + +module.exports = { + config: { + name: "tinyurl", + aliases: ["turl"], + version: "2.0", + author: "Vex_Kshitiz", + countDown: 10, + role: 0, + shortDescription: "alternative of imgurl", + longDescription: "alternative of imgurl", + category: "utility", + guide: "{p}tinyurl" + }, + onStart: function ({ api, event }) { + return shortURL(api, event); + } +}; diff --git a/scripts/cmds/trash.js b/scripts/cmds/trash.js new file mode 100644 index 000000000..8c9c078a2 --- /dev/null +++ b/scripts/cmds/trash.js @@ -0,0 +1,31 @@ +const DIG = require("discord-image-generation"); +const fs = require("fs-extra"); + +module.exports = { + config: { + name: "trash", + version: "1.1", + author: "hedroxyy", + countDown: 5, + role: 0, + shortDescription: "Trash image", + longDescription: "Trash image", + category: "image", + guide: { + vi: "{pn} [@tag | để trống]", + en: "{pn} [@tag]" + } + }, + + onStart: async function ({ event, message, usersData }) { + const uid = Object.keys(event.mentions)[0] + if(!uid) return message.reply("Mention someone") + const avatarURL = await usersData.getAvatarUrl(uid); + const img = await new DIG.Trash().getImage(avatarURL); + const pathSave = `${__dirname}/tmp/${uid}_Trash.png`; + fs.writeFileSync(pathSave, Buffer.from(img)); + message.reply({ + attachment: fs.createReadStream(pathSave) + }, () => fs.unlinkSync(pathSave)); + } +}; diff --git a/scripts/cmds/unforgivable.js b/scripts/cmds/unforgivable.js new file mode 100644 index 000000000..0a48b6183 --- /dev/null +++ b/scripts/cmds/unforgivable.js @@ -0,0 +1,33 @@ +const axios = require('axios'); +const jimp = require("jimp"); +const fs = require("fs"); + +module.exports = { + config: { + name: "unforgivable", + aliases: ["god"], + version: "1.0", + author: "Samir", + countDown: 5, + role: 0, + shortDescription: "Get god's notification on your searching", + longDescription: "", + category: "fun", + guide: "{pn}" + }, + + onStart: async function ({ message, args }) { + const text = args.join(" "); + if (!text) { + return message.reply(`Please enter a text`); + } else { + const img = `https://api.popcat.xyz/unforgivable?text=${encodeURIComponent(text)}`; + + const form = { + body: `` + }; + form.attachment = [] + form.attachment[0] = await global.utils.getStreamFromURL(img); + message.reply(form); + } +}}; diff --git a/scripts/cmds/uptime.js b/scripts/cmds/uptime.js new file mode 100644 index 000000000..4064ff172 --- /dev/null +++ b/scripts/cmds/uptime.js @@ -0,0 +1,31 @@ +const moment = require('moment'); + +module.exports = { + config: { + name: "uptime", + aliases: ['upt'], + version: "1.0", + author: "HeDroxuu", + category: "system", + guide: { + en: "Use {p}uptime or {p}upt" + } + }, + onStart: async function ({ message }) { + const uptime = process.uptime(); + const formattedUptime = formatMilliseconds(uptime * 1000); + + const response = `╭╼╾『𝐒𝐲𝐬𝐭𝐞𝐦 𝐔𝐩𝐭𝐢𝐦𝐞』\n${formattedUptime}`; + + message.reply(response); + } +}; + +function formatMilliseconds(ms) { + const seconds = Math.floor(ms / 1000); + const minutes = Math.floor(seconds / 60); + const hours = Math.floor(minutes / 60); + const days = Math.floor(hours / 24); + + return `╰─> 𝐃𝐚𝐲𝐬 ─ ${days}\n╰─> 𝐇𝐫𝐬 ─ ${hours % 24}\n╰─> 𝐌𝐢𝐧𝐬 ─ ${minutes % 60}\n╰─> 𝐒𝐞𝐜 ─ ${seconds % 60}`; +} diff --git a/scripts/cmds/video.js b/scripts/cmds/video.js new file mode 100644 index 000000000..7e087c9c5 --- /dev/null +++ b/scripts/cmds/video.js @@ -0,0 +1,91 @@ +const axios = require("axios"); +const fs = require("fs-extra"); +const ytdl = require("ytdl-core"); +const yts = require("yt-search"); + +module.exports = { + config: { + name: "video", + aliases: ["v"], + version: "1.3", + role: 0, + author: "AceGun", + cooldowns: 5, + shortdescription: "download music video from YouTube", + longdescription: "", + category: "music", + usages: "{pn} video name", + dependencies: { + "fs-extra": "^10.0.0", // Specify version for each dependency + "request": "^2.88.2", + "axios": "^0.24.0", + "ytdl-core": "^5.0.5", + "yt-search": "^2.6.1" + } + }, + + onStart: async ({ api, event }) => { + const input = event.body; + const text = input.substring(12); + const data = input.split(" "); + + if (data.length < 2) { + return api.sendMessage("Please specify a video name.", event.threadID); + } + + data.shift(); + const videoName = data.join(" "); + + try { + api.setMessageReaction("⏳", event.messageID, event.messageID, api); + const searchMessage = await api.sendMessage(`💁 | Finding video for "${videoName}".\n⏳ | Please wait...`, event.threadID); + + const searchResults = await yts(videoName); + if (!searchResults.videos.length) { + return api.sendMessage("No videos found.", event.threadID, event.messageID); + } + + const video = searchResults.videos[0]; + const videoUrl = video.url; + + const stream = ytdl(videoUrl, { filter: "audioandvideo" }); + + const fileName = `${event.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); + return api.sendMessage('❌ | The file could not be sent because it is larger than 25MB.', event.threadID); + } + + const message = { + body: `💁‍♀️ | Here's your video\n\n🔮 | Title: ${video.title}\n⏰ | Duration: ${video.duration.timestamp}`, + attachment: fs.createReadStream(filePath) + }; + + api.unsendMessage(searchMessage.messageID); + api.setMessageReaction("🎥", event.messageID, event.messageID, api); + + api.sendMessage(message, event.threadID, () => { + fs.unlinkSync(filePath); + }); + }); + } catch (error) { + console.error('[ERROR]', error); + api.sendMessage('🥺 | An error occurred while processing the command.', event.threadID); + } + } +}; \ No newline at end of file diff --git a/scripts/cmds/wanted.js b/scripts/cmds/wanted.js new file mode 100644 index 000000000..f098ede4a --- /dev/null +++ b/scripts/cmds/wanted.js @@ -0,0 +1,33 @@ +const DIG = require("discord-image-generation"); +const fs = require("fs-extra"); + +module.exports = { + config: { + name: "wanted", + version: "1.1", + author: "hedroxyy", + countDown: 5, + role: 0, + shortDescription: "Generate a 'wanted' image with your own avatar.", + longDescription: "Generate a 'wanted' image with your own avatar.", + category: "image", + guide: { + en: "{pn}" + } + }, + + onStart: async function ({ event, message, usersData }) { + const uid = event.senderID; + const avatarURL = await usersData.getAvatarUrl(uid); // Fetch your own avatar URL + + const img = await new DIG.Wanted().getImage(avatarURL); + const pathSave = `${__dirname}/tmp/${uid}_Wanted.png`; + + fs.writeFileSync(pathSave, Buffer.from(img)); + + message.reply({ + body: "「 🔥 」", + attachment: fs.createReadStream(pathSave) + }, () => fs.unlinkSync(pathSave)); + } +}; diff --git a/scripts/cmds/war.js b/scripts/cmds/war.js new file mode 100644 index 000000000..98d35d34c --- /dev/null +++ b/scripts/cmds/war.js @@ -0,0 +1,87 @@ +module.exports = { + config: { + name: "war", + version: "1.0", + author: "hedroxyy", + role: 2, + category: "texts", + guide: { + vi: "Not Available", + en: "Use .war on to activate War Mode, .war off to deactivate, and .war @mention to send a message in War Mode." + } + }, + + onStart: async function ({ api, event, args }) { + // Initialize userData if it doesn't exist + if (typeof global.userData === 'undefined') { + global.userData = {}; + } + if (typeof global.userData[event.threadID] === 'undefined') { + global.userData[event.threadID] = {}; + } + if (typeof global.userData[event.threadID].warMode === 'undefined') { + global.userData[event.threadID].warMode = false; + } + if (typeof global.userData[event.threadID].warInterval === 'undefined') { + global.userData[event.threadID].warInterval = null; + } + + const userData = global.userData[event.threadID]; + + if (args[0] === "on") { + userData.warMode = true; + return api.sendMessage("War Mode activated.", event.threadID); + } else if (args[0] === "off") { + userData.warMode = false; + if (userData.warInterval) { + clearInterval(userData.warInterval); + userData.warInterval = null; + } + return api.sendMessage("War Mode deactivated.", event.threadID); + } else if (userData.warMode && Object.keys(event.mentions).length > 0) { + var mention = Object.keys(event.mentions)[0]; + let name = event.mentions[mention]; + var arraytag = [{ id: mention, tag: name }]; + var a = function (a) { api.sendMessage(a, event.threadID); } + + if (userData.warInterval) { + clearInterval(userData.warInterval); + } + + userData.warInterval = setInterval(() => { + a({ body: "TERII AMA KO KALO PUTII MA LYAMMMA LYAMMA CHKAMM MUJII THUKK LAII LAII MADRCHOOOD BESYYA AMA KO XORO " + name, mentions: arraytag }); + setTimeout(() => { + a({ body: "TEORO AMAA LAAII KOPCHI MAA LAGERW CHIKAAMM RANNDDII MAKAA BAXHHA😭💋 " + name, mentions: arraytag }); + }, 500); // Reduced delay between messages to 500 milliseconds + setTimeout(() => { + a({ body: "TERO AAMA KO SIL TUTNEY GARII CHODNA NA PAROSSS MUJII KHATEYYY GAWAAARR 😂💦" + name, mentions: arraytag }); + }, 1000); // Additional message after 1000 milliseconds + setTimeout(() => { + a({ body: "MUJI GAREEEB KO BACCHA SALLA XAKKAAA MUJIII AUKAT LESSSS EKSIKKO AUKAT NA BHAKO BUNU 😂💋 " + name, mentions: arraytag }); + }, 1500); // Additional message after 1500 milliseconds + setTimeout(() => { + a({ body: "TA MUJII KTA SAMAJ MAH KASARI AAYIS TEI SOCHI RAXUHH MUJII PUTI BHAKO MANXEYY YAAA PUTI FLEX HANNA NA AAIJO 😂💋 " + name, mentions: arraytag }); + }, 2000); // Additional message after 2000 milliseconds + setTimeout(() => { + a({ body: "SALA GAWARR TERO JASTO TW MERO BHUTRA SAMAN HOOO JHAT HARU MUJI 2 3 CLASS MAH DNEY FUCCHA FUCHHI BAU SANGA NEU KHOJXA 😂😂💋 " + name, mentions: arraytag }); + }, 2500); // Additional message after 2500 milliseconds + setTimeout(() => { + a({ body: "GAWARR KHATEYYY KOO XOROO MUJII TAILET LADOO CHUSNA BAHEK K GAREKO XASS HMM MUJII ? 😂😂💋 KHATEYY SALLA JAAA GAYERW BLOUSE LAGAYERW GHUMMM 😂👌 " + name, mentions: arraytag }); + }, 3000); // Additional message after 3000 milliseconds + setTimeout(() => { + a({ body: "MUJI THAMEL KO MAAAL SALA GAWARRR KO NASOOOOO AUKAT LESSS TERO CHAK MAH MERO LADO KO JHATYARO HANNU PARNEY BELA BHAYO 😂👌 " + name, mentions: arraytag }); + }, 3500); // Additional message after 3500 milliseconds + setTimeout(() => { + a({ body: "HEER BABU TW MUJI KO AUKAT XAINA BUJHIS AHILEY TESAILEY BHANDAI XUH MUJI AAFNO PUTI FLX NA HAAAN CHIKNA TIME LAGAUDANA 😂👌" + name, mentions: arraytag }); + }, 4000); // Additional message after 4000 milliseconds + setTimeout(() => { + a({ body: "SALA RATNA PARK KOO MAAAL MUJI TERO RATE KATI HO BHANTWWW ? MUJII PUTI FLEX HANDAI HIDXAS RANDI KAAA BAAAN 😂😂👌 " + name, mentions: arraytag }); + }, 4500); // Additional message after 4500 milliseconds + }, 5000); // Adjusted interval duration to 5000 milliseconds to accommodate all messages + } else if (!userData.warMode) { + return api.sendMessage("War Mode is currently deactivated.", event.threadID); + } else { + return api.sendMessage("You need to mention someone to send a message.", event.threadID); + } + } +}; diff --git a/scripts/cmds/weather.js b/scripts/cmds/weather.js index 9be3e6f4c..a1f3f2486 100644 --- a/scripts/cmds/weather.js +++ b/scripts/cmds/weather.js @@ -1,123 +1,46 @@ -const axios = require("axios"); -const moment = require("moment-timezone"); -const Canvas = require("canvas"); -const fs = require("fs-extra"); +const axios = require('axios'); +const cheerio = require('cheerio'); -Canvas.registerFont( - __dirname + "/assets/font/BeVietnamPro-SemiBold.ttf", { - family: "BeVietnamPro-SemiBold" -}); -Canvas.registerFont( - __dirname + "/assets/font/BeVietnamPro-Regular.ttf", { - family: "BeVietnamPro-Regular" -}); +async function getWeather(location) { + const url = `https://www.google.com/search?q=weather+${location}`; + const headers = { "User-Agent": "Mozilla/5.0" }; -function convertFtoC(F) { - return Math.floor((F - 32) / 1.8); -} -function formatHours(hours) { - return moment(hours).tz("Asia/Ho_Chi_Minh").format("HH[h]mm[p]"); -} - -module.exports = { - config: { - name: "weather", - version: "1.2", - author: "NTKhang", - countDown: 5, - role: 0, - description: { - vi: "xem dự báo thời tiết hiện tại và 5 ngày sau", - en: "view the current and next 5 days weather forecast" - }, - category: "other", - guide: { - vi: "{pn} <địa điểm>", - en: "{pn} " - }, - envGlobal: { - weatherApiKey: "d7e795ae6a0d44aaa8abb1a0a7ac19e4" - } - }, - - langs: { - vi: { - syntaxError: "Vui lòng nhập địa điểm", - notFound: "Không thể tìm thấy địa điểm: %1", - error: "Đã xảy ra lỗi: %1", - today: "Thời tiết hôm nay: %1\n%2\n🌡 Nhiệt độ thấp nhất - cao nhất %3°C - %4°C\n🌡 Nhiệt độ cảm nhận được %5°C - %6°C\n🌅 Mặt trời mọc %7\n🌄 Mặt trời lặn %8\n🌃 Mặt trăng mọc %9\n🏙️ Mặt trăng lặn %10\n🌞 Ban ngày: %11\n🌙 Ban đêm: %12" - }, - en: { - syntaxError: "Please enter a location", - notFound: "Location not found: %1", - error: "An error has occurred: %1", - today: "Today's weather: %1\n%2\n🌡 Low - high temperature %3°C - %4°C\n🌡 Feels like %5°C - %6°C\n🌅 Sunrise %7\n🌄 Sunset %8\n🌃 Moonrise %9\n🏙️ Moonset %10\n🌞 Day: %11\n🌙 Night: %12" - } - }, - - onStart: async function ({ args, message, envGlobal, getLang }) { - const apikey = envGlobal.weatherApiKey; - - const area = args.join(" "); - if (!area) - return message.reply(getLang("syntaxError")); - let areaKey, dataWeather, areaName; - - try { - const response = (await axios.get(`https://api.accuweather.com/locations/v1/cities/search.json?q=${encodeURIComponent(area)}&apikey=${apikey}&language=vi-vn`)).data; - if (response.length == 0) - return message.reply(getLang("notFound", area)); - const data = response[0]; - areaKey = data.Key; - areaName = data.LocalizedName; - } - catch (err) { - return message.reply(getLang("error", err.response.data.Message)); - } + try { + const response = await axios.get(url, { headers }); + const html = response.data; + const $ = cheerio.load(html); - try { - dataWeather = (await axios.get(`http://api.accuweather.com/forecasts/v1/daily/10day/${areaKey}?apikey=${apikey}&details=true&language=vi`)).data; - } - catch (err) { - return message.reply(`❌ Đã xảy ra lỗi: ${err.response.data.Message}`); - } + const weatherInfo = $(".BNeawe.iBp4i.AP7Wnd").first().text(); - const dataWeatherDaily = dataWeather.DailyForecasts; - const dataWeatherToday = dataWeatherDaily[0]; - const msg = getLang("today", areaName, dataWeather.Headline.Text, convertFtoC(dataWeatherToday.Temperature.Minimum.Value), convertFtoC(dataWeatherToday.Temperature.Maximum.Value), convertFtoC(dataWeatherToday.RealFeelTemperature.Minimum.Value), convertFtoC(dataWeatherToday.RealFeelTemperature.Maximum.Value), formatHours(dataWeatherToday.Sun.Rise), formatHours(dataWeatherToday.Sun.Set), formatHours(dataWeatherToday.Moon.Rise), formatHours(dataWeatherToday.Moon.Set), dataWeatherToday.Day.LongPhrase, dataWeatherToday.Night.LongPhrase); - - const bg = await Canvas.loadImage(__dirname + "/assets/image/bgWeather.jpg"); - const { width, height } = bg; - const canvas = Canvas.createCanvas(width, height); - const ctx = canvas.getContext("2d"); - ctx.drawImage(bg, 0, 0, width, height); - let X = 100; - ctx.fillStyle = "#ffffff"; - const data = dataWeather.DailyForecasts.slice(0, 7); - for (const item of data) { - const icon = await Canvas.loadImage("http://vortex.accuweather.com/adc2010/images/slate/icons/" + item.Day.Icon + ".svg"); - ctx.drawImage(icon, X, 210, 80, 80); - - ctx.font = "30px BeVietnamPro-SemiBold"; - const maxC = `${convertFtoC(item.Temperature.Maximum.Value)}°C `; - ctx.fillText(maxC, X, 366); - - ctx.font = "30px BeVietnamPro-Regular"; - const minC = String(`${convertFtoC(item.Temperature.Minimum.Value)}°C`); - const day = moment(item.Date).format("DD"); - ctx.fillText(minC, X, 445); - ctx.fillText(day, X + 20, 140); - - X += 135; - } - - const pathSaveImg = `${__dirname}/tmp/weather_${areaKey}.jpg`; - fs.writeFileSync(pathSaveImg, canvas.toBuffer()); - - return message.reply({ - body: msg, - attachment: fs.createReadStream(pathSaveImg) - }, () => fs.unlinkSync(pathSaveImg)); + return weatherInfo; + } catch (error) { + console.error("Error fetching weather data:", error); + return "Could not retrieve weather data"; + } +} - } -}; \ No newline at end of file +module.exports = { + config: { + name: "weather", + version: "1.0", + author: "Your Name", + role: 0, + category: "utility", + description: "Gets the weather information for a specified location.", + guide: { + vi: "Không có sẵn", + en: "Usage: .weather {location}" + } + }, + + onStart: async function ({ bot, message, args }) { + if (args.length === 0) { + message.reply("Please provide a location."); + return; + } + + const location = args.join(" "); + const weatherInfo = await getWeather(location); + message.reply(`Weather in ${location}: ${weatherInfo}`); + } +}; diff --git a/scripts/cmds/women.js b/scripts/cmds/women.js new file mode 100644 index 000000000..ba8fb5124 --- /dev/null +++ b/scripts/cmds/women.js @@ -0,0 +1,22 @@ +const fs = require('fs'); +module.exports = { + config: { + name: "women", + version: "1.0", + author: "otineeeeyyyy", + countDown: 5, + role: 0, + shortDescription: "no prefix", + longDescription: "no prefix", + category: "no prefix", + }, + onStart: async function(){}, + onChat: async function({ event, message, getLang }) { + if (event.body && event.body.toLowerCase() === "women") { + return message.reply({ + body: "Women ☕", + attachment: fs.createReadStream("women.mp4"), + }); + } + } +}; \ No newline at end of file diff --git a/scripts/cmds/xlink.js b/scripts/cmds/xlink.js new file mode 100644 index 000000000..40053a893 --- /dev/null +++ b/scripts/cmds/xlink.js @@ -0,0 +1,63 @@ +const axios = require('axios'); +const cheerio = require('cheerio'); + +module.exports = { + config: { + name: "xlink", + version: "1.0", + author: "hedroxyy", + role: 2, + aliases: ["xv", "pornsearch"], + category: "18+", + description: "Search Pornhub and return the specified number of unique video links.", + guide: { + vi: "Không có sẵn", + en: "Usage: .xvid {query} {number of links (optional)}" + } + }, + + onStart: async function ({ api, event, args }) { + if (args.length === 0) { + api.sendMessage("Usage: .xvid {query} {number of links (optional)}", event.threadID, event.messageID); + return; + } + + let numLinks = 1; // Default number of links + const lastArg = args[args.length - 1]; + + if (!isNaN(lastArg) && lastArg > 0) { + numLinks = parseInt(lastArg, 10); + args.pop(); + } + + const query = args.join(' '); + + const searchUrl = `https://www.pornhub.com/video/search?search=${encodeURIComponent(query)}`; + + try { + const response = await axios.get(searchUrl); + const $ = cheerio.load(response.data); + + const results = new Set(); // Using a Set to store unique links + + $('ul.videos.search-video-thumbs li div.wrap a').each((index, element) => { + if (results.size < numLinks) { // Limit to the specified number of links + const videoLink = `https://www.pornhub.com${$(element).attr('href')}`; + if (!videoLink.includes("/channels/") && !videoLink.includes("/model/")) { // Exclude channel and model URLs + const videoTitle = $(element).attr('title'); + results.add(`🔍 | ${videoTitle}\n🔗 | Link: ${videoLink}`); + } + } + }); + + if (results.size > 0) { + api.sendMessage(Array.from(results).join('\n\n'), event.threadID, event.messageID); + } else { + api.sendMessage("❌ | No results found.", event.threadID, event.messageID); + } + } catch (error) { + console.error(error); + api.sendMessage("❌ | An error occurred while searching.", event.threadID, event.messageID); + } + } +}; diff --git a/scripts/cmds/xvid.js b/scripts/cmds/xvid.js new file mode 100644 index 000000000..1f4c9f66d --- /dev/null +++ b/scripts/cmds/xvid.js @@ -0,0 +1,63 @@ +const axios = require('axios'); +const cheerio = require('cheerio'); + +module.exports = { + config: { + name: "xvid", + version: "1.0", + author: "hedroxyy", + role: 2, + aliases: ["xv", "pornsearch"], + category: "18+", + description: "Search Pornhub and return the specified number of unique video links.", + guide: { + vi: "Không có sẵn", + en: "Usage: .xvid {query} {number of links (optional)}" + } + }, + + onStart: async function ({ api, event, args }) { + if (args.length === 0) { + api.sendMessage("Usage: .xvid {query} {number of links (optional)}", event.threadID, event.messageID); + return; + } + + let numLinks = 1; // Default number of links + const lastArg = args[args.length - 1]; + + if (!isNaN(lastArg) && lastArg > 0) { + numLinks = parseInt(lastArg, 10); + args.pop(); + } + + const query = args.join(' '); + + const searchUrl = `https://www.pornhub.com/video/search?search=${encodeURIComponent(query)}`; + + try { + const response = await axios.get(searchUrl); + const $ = cheerio.load(response.data); + + const results = new Set(); // Using a Set to store unique links + + $('ul.videos.search-video-thumbs li div.wrap a').each((index, element) => { + if (results.size < numLinks) { // Limit to the specified number of links + const videoLink = `https://www.pornhub.com${$(element).attr('href')}`; + if (!videoLink.includes("/channels/") && !videoLink.includes("/model/")) { // Exclude channel and model URLs + const videoTitle = $(element).attr('title'); + results.add(`🔍 | ${videoTitle}\n🔗 | Link: ${videoLink}`); + } + } + }); + + if (results.size > 0) { + api.sendMessage(Array.from(results).join('\n\n'), event.threadID, event.messageID); + } else { + api.sendMessage("❌ | No results found.", event.threadID, event.messageID); + } + } catch (error) { + console.error(error); + api.sendMessage("❌ | An error occurred while searching.", event.threadID, event.messageID); + } + } +};