diff --git a/modules_new_2022/igdl_img_mzk.js b/modules_new_2022/igdl_img_mzk.js index c11b401..44796b3 100644 --- a/modules_new_2022/igdl_img_mzk.js +++ b/modules_new_2022/igdl_img_mzk.js @@ -3,13 +3,19 @@ * @warn Do not edit code or edit credits */ module.exports.config = { - name: "igdl", + name: "igdlimg", version: "1.0.0", hasPermssion: 0, credits: "MạnhG", description: "Tìm kiếm hình ảnh", commandCategory: "Tiện ích", usages: "[Text]", + dependencies: { + "axios": "", + "path": "", + "fs-extra": "", + "tinyurl": "" + }, cooldowns: 0, }; module.exports.run = async function({ api, event, args }) { diff --git a/modules_new_2022/sing_v1.js b/modules_new_2022/sing_v1.js index e93587e..940655d 100644 --- a/modules_new_2022/sing_v1.js +++ b/modules_new_2022/sing_v1.js @@ -11,6 +11,12 @@ commandCategory: "Phương tiện", usages: "[search]", cooldowns: 10, + dependencies: { + "axios": "", + "path": "", + "fs-extra": "", + "tinyurl": "" + }, envConfig: { "API_KEY": "mzkFree_722124509AC10" } diff --git a/modules_new_2022/singv2.js b/modules_new_2022/singv2.js new file mode 100644 index 0000000..cb61411 --- /dev/null +++ b/modules_new_2022/singv2.js @@ -0,0 +1,22 @@ +module.exports.config = { + name: "singv2", + version: "1.0.0", + hasPermssion: 0, + credits: "MạnhG", + description: "Phát nhạc thông qua link YouTube hoặc từ khoá tìm kiếm", + commandCategory: "Phương tiện", + usages: "[link / keySearch]", + cooldowns: 10, + dependencies: { + "axios": "", + "path": "", + "fs-extra": "", + "tinyurl": "" + }, + envConfig: { + "API_KEY": "mzkFree_722124509AC10" + } +}; +var rdPath = Math.floor(Math.random() * 99999999999999); + +module.exports.run=async function({event:e,api:t,args:a}){const{threadID:n,messageID:s,senderID:r}=e,i=require("axios"),{createReadStream:d,statSync:o,writeFileSync:l,readdirSync:g,unlinkSync:c}=require("fs-extra"),{API_KEY:h}=global.configModule[this.config.name];if(0!=a.join(" ").indexOf("https://"))return t.sendMessage("Reply tin nhắn này nhập thời gian tìm kiếm của video(Là 1 con số 3 < timeSearch < 9)\n\nVí dụ:\n4 -> get những bài nhạc ngắn\n7 -> get những bài nhạc siêu dài",n,((e,t)=>{global.client.handleReply.push({step:1,name:this.config.name,messageID:t.messageID,content:{id:r,timeSearch:"",keySearch:""}})}),s);{const e=a.join(" ").trim();try{t.sendMessage("Đang tải, vui lòng đợi...",n,((e,a)=>setTimeout((()=>{t.unsendMessage(a.messageID)}),3e4)));let{data:a}=await i.get(`https://manhict.tech/sing?link=${e}&apikey=${h}`);if(a.error)return t.sendMessage(a.error,n);let r=a.title,g=a.link;var u=__dirname+`/cache/${rdPath}.m4a`;if(""==g){let{data:a}=await i.get(`https://manhict.tech/video?link=${e}&apikey=${h}`);if(a.error)return t.sendMessage(a.error,n);let r=a.title,o=a.link.audio;const g=(await i.get(o,{responseType:"arraybuffer"})).data;l(u,Buffer.from(g,"utf-8"));return await t.sendMessage({body:r,attachment:d(u)},n,(()=>c(u)),s)}{const a=(await i.get(g,{responseType:"arraybuffer"})).data;if(l(u,Buffer.from(a,"utf-8")),o(u).size>26e6){t.sendMessage("Không thể gửi file có dung lượng lớn hơn 25MB.\n\nTiến hành render và gửi lại...",n,(()=>c(u)),s);let{data:a}=await i.get(`https://manhict.tech/video?link=${e}&apikey=${h}`);if(a.error)return t.sendMessage(a.error,n);let r=a.title,o=a.link.audio;const g=(await i.get(o,{responseType:"arraybuffer"})).data;l(u,Buffer.from(g,"utf-8"));return await t.sendMessage({body:r,attachment:d(u)},n,(()=>c(u)),s)}return await t.sendMessage({body:r,attachment:d(u)},n,(()=>c(u)),s)}}catch(e){return console.log(e),t.sendMessage("Có lỗi xảy ra:"+e,n,s)}}},module.exports.handleReply=async function({event:e,api:t,handleReply:a}){const n=require("axios"),{createReadStream:s,statSync:r,writeFileSync:i,readdirSync:d,unlinkSync:o}=require("fs-extra"),{threadID:l,senderID:g,messageID:c,body:h}=e,{API_KEY:u}=global.configModule[this.config.name];const f=h.trim(),y=(e,n,s)=>t.sendMessage(e,l,((e,r)=>{global.client.handleReply.splice(global.client.handleReply.indexOf(a),1),t.unsendMessage(a.messageID),global.client.handleReply.push({step:n,name:this.config.name,messageID:r.messageID,content:s})}),c);let m=a.content;switch(a.step){case 1:if(m.timeSearch=f,S=h,isNaN(S)||(S<4||S>8))return t.sendMessage("Chọn từ 4 -> 8, baby. love uwu ❤️",l,c);y("Reply tin nhắn này nhập từ cần tìm kiếm hoặc url video",2,m);break;case 2:m.keySearch=f,global.client.handleReply.splice(global.client.handleReply.indexOf(a),1),t.unsendMessage(a.messageID);let d=m;if(0==d.keySearch.indexOf("https://")){const e=d.keySearch;try{t.sendMessage("Đang tải, vui lòng đợi...",l,((e,a)=>setTimeout((()=>{t.unsendMessage(a.messageID)}),3e4)));let{data:a}=await n.get(`https://manhict.tech/sing?link=${e}&apikey=${u}`);if(a.error)return t.sendMessage(a.error,l);let d=a.title,g=a.link;var p=__dirname+`/cache/${rdPath}.m4a`;if(""==g){let{data:a}=await n.get(`https://manhict.tech/video?link=${e}&apikey=${u}`);if(a.error)return t.sendMessage(a.error,l);let r=a.title,d=a.link.audio;const g=(await n.get(d,{responseType:"arraybuffer"})).data;i(p,Buffer.from(g,"utf-8"));return await t.sendMessage({body:r,attachment:s(p)},l,(()=>o(p)),c)}{const a=(await n.get(g,{responseType:"arraybuffer"})).data;if(i(p,Buffer.from(a,"utf-8")),r(p).size>26e6){t.sendMessage("Không thể gửi file có dung lượng lớn hơn 25MB.\n\nTiến hành render và gửi lại...",l,(()=>o(p)),c);let{data:a}=await n.get(`https://manhict.tech/video?link=${e}&apikey=${u}`);if(a.error)return t.sendMessage(a.error,l);let r=a.title,d=a.link.audio;const g=(await n.get(d,{responseType:"arraybuffer"})).data;i(p,Buffer.from(g,"utf-8"));return await t.sendMessage({body:r,attachment:s(p)},l,(()=>o(p)),c)}return await t.sendMessage({body:d,attachment:s(p)},l,(()=>o(p)),c)}}catch(e){return console.log(e),t.sendMessage("Có lỗi xảy ra:"+e,l,c)}}else try{var b,M,k=[],w="",v=0;const a=encodeURIComponent(d.keySearch);var{data:$}=await n.get(`https://manhict.tech/youtube?q=${a}&apikey=${u}`);if($.error)return t.sendMessage($.error,l);b=$.results;for(let e in b)if(null!=b[e].video&&(M=b[e].video).duration.length<=d.timeSearch&&"Live"!=M.duration){v=v+=1,k.push(M.id),w+=`${v}.《${M.duration}》 ${M.title}\n\n`}var I=`»🔎 There are ${k.length} results matching your search keyword:\n\n${w}» Please reply (feedback) choose one of the above searches.`;return void t.sendMessage({body:I},l,((t,a)=>{client.handleReply.push({step:"reply_bodySend",name:this.config.name,messageID:a.messageID,author:e.senderID,idYT:k})}),c)}catch(e){return t.sendMessage("Lỗi: "+e.message,l,c)}break;case"reply_bodySend":if(global.client.handleReply.splice(global.client.handleReply.indexOf(a),1),function(e){return isNaN(e)?"Not a Number!":e<1||e>20}(h))return t.sendMessage("Choose from 1 -> 20, baby. love uwu ❤️",l,c);t.unsendMessage(a.messageID),t.sendMessage("Đang tải, vui lòng đợi...",l,((e,a)=>setTimeout((()=>{t.unsendMessage(a.messageID)}),3e4)));try{let{data:d}=await n.get(`https://manhict.tech/sing/id?id=${a.idYT[h-1]}&apikey=${u}`);if(d.error)return t.sendMessage(d.error,l);let g=d.title,f=d.link;p=__dirname+`/cache/${rdPath}.m4a`;if(""==f){let{data:e}=await n.get(`https://manhict.tech/singv2/id?id=${a.idYT[h-1]}&apikey=${u}`);if(e.error)return t.sendMessage(e.error,l);let r=e.title,d=e.link;const g=(await n.get(d,{responseType:"arraybuffer"})).data;i(p,Buffer.from(g,"utf-8"));return await t.sendMessage({body:r,attachment:s(p)},l,(()=>o(p)),c)}{const d=(await n.get(f,{responseType:"arraybuffer"})).data;if(i(p,Buffer.from(d,"utf-8")),r(p).size>26e6){t.sendMessage("Không thể gửi file có dung lượng lớn hơn 25MB.\n\nTiến hành render và gửi lại...",l,(()=>o(p)),c);let{data:r}=await n.get(`https://manhict.tech/singv2/id?id=${a.idYT[e.body-1]}&apikey=${u}`);if(r.error)return t.sendMessage(r.error,l);let d=r.title,g=r.link;const h=(await n.get(g,{responseType:"arraybuffer"})).data;i(p,Buffer.from(h,"utf-8"));return await t.sendMessage({body:d,attachment:s(p)},l,(()=>o(p)),c)}return await t.sendMessage({body:g,attachment:s(p)},l,(()=>o(p)),c)}}catch(e){return console.log(e),t.sendMessage("Có lỗi xảy ra:"+e,l,c)}}var S}; \ No newline at end of file diff --git a/modules_new_2022/tiktok_mzk.js b/modules_new_2022/tiktok_mzk.js index 7d53406..c15e8eb 100644 --- a/modules_new_2022/tiktok_mzk.js +++ b/modules_new_2022/tiktok_mzk.js @@ -11,13 +11,14 @@ commandCategory: "Phương tiện", usages: "[searchVideos]", cooldowns: 5, - envConfig: { - API_KEY: "mzkFree_722124509AC10" //Nhập API_Key của bạn ở đây hoặc file config.json - }, dependencies: { "axios": "", "path": "", - "fs-extra": "" + "fs-extra": "", + "tinyurl": "" + }, + envConfig: { + API_KEY: "mzkFree_722124509AC10" //Nhập API_Key của bạn ở đây hoặc file config.json } }; var timeVD = "0"; // 0 - mọi lúc; 1 - ngày hôm qua; 7 - tuần này; 30 - tháng; 90 - 3 tháng; 180 - 6 tháng diff --git a/modules_new_2022/video_mzk.js b/modules_new_2022/video_mzk.js index 7a19209..7c3da87 100644 --- a/modules_new_2022/video_mzk.js +++ b/modules_new_2022/video_mzk.js @@ -11,6 +11,12 @@ commandCategory: "Phương tiện", usages: "[searchVideos]", cooldowns: 10, + dependencies: { + "axios": "", + "path": "", + "fs-extra": "", + "tinyurl": "" + }, envConfig: { "API_KEY": "mzkFree_722124509AC10" }