Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.4 kB
3
Indexable
Never
module.exports.config = {
    name: "bannertet",
    version: "1.0.1",
    hasPermssion: 0,
    credits: "tdunguwu",
    description: "",
    commandCategory: "image",
    cooldowns: 0,
    dependencies: {
        "fs-extra": "",
        "request": ""
    }
};
module.exports.run = async ({ api, event,args }) => {  {
    
    const fs = global.nodemodule["fs-extra"];
    const request = global.nodemodule["request"];
	 const { threadID, messageID, senderID, body } = event;
let text = args.join(" ")
  if (!text) return api.sendMessage('Vui lòng nhập đúng định dạng [text1 | idfb ]!', event.threadID, event.messageID);
  const length_0 = parseInt(text.length)
 const text1 = args.join(" ").trim().replace(/\s+/g, " ").replace(/(\s+\|)/g, "|").replace(/\|\s+/g, "|").split("|")[0];
  const text2 = args.join(" ").trim().replace(/\s+/g, " ").replace(/(\s+\|)/g, "|").replace(/\|\s+/g, "|").split("|")[1];
  ;
 
	 var callback = () => api.sendMessage({body:``,attachment: fs.createReadStream(__dirname + "/cache/bannertet.png")}, event.threadID, () => fs.unlinkSync(__dirname + "/cache/bannertet.png"),event.messageID);
	 return request(encodeURI(`https://apitaoa-1.chinhle4447.repl.co/textpro/tet2022?text1=${text1}&text2=${even.senderID}`)).pipe(fs.createWriteStream(__dirname+'/cache/bannertet.png')).on('close',() => callback());     
}}