The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
Bnnn
By Guest on 24th November 2022 06:01:23 AM | Syntax: TEXT | Views: 1



New paste | Download | Show/Hide line no. | Copy text to clipboard
  1. module.exports.config = {
  2.   name: "banner4",
  3.   version: "1.0.0",
  4.   hasPermssion: 0,
  5.   credits: "Hanaku UwuU",
  6.   description: "baner",
  7.   commandCategory: "new",
  8.   usages: "",
  9.   cooldowns: 5
  10. };
  11. module.exports.run = async function({ api, args, event, permssion }) {
  12.   const axios = require('axios')
  13.   if(args[0] == "find" || args[0] == "tìm"){
  14.      const lengthchar = (await axios.get('https://run.mocky.io/v3/0dcc2ccb-b5bd-45e7-ab57-5dbf9db17864')).data
  15.     const t = (await axios.get(`${lengthchar[args[1]].imgAnime}`, {
  16.         responseType: "stream"
  17.       })).data;
  18.     const msg = ({
  19.     body: `char mang số thứ tự ${args[1]}`,
  20.     attachment: t
  21.   })
  22.     return api.sendMessage(msg, event.threadID, event.messageID)
  23.   }
  24.   if(!args[0]){
  25.   const abcxyz = ["https://imgur.com/7AiLKO5.png","https://imgur.com/6we7T1g.png","https://imgur.com/W1TNnj9.png","https://imgur.com/qZAh20x.png"]
  26.   let o = [];
  27.   for(let i = 0; i < 4; i++){
  28.     const t = (await axios.get(`${abcxyz[i]}`, {
  29.         responseType: "stream"
  30.       })).data;
  31.     o.push(t)
  32.   }
  33.   const msg = ({
  34.     body: "Reply Message To Choose Style(1, 2, 3 or 4)",
  35.     attachment: o
  36.   })
  37.   return api.sendMessage(msg, event.threadID, (err, info) => {
  38.     return global.client.handleReply.push({
  39.       step: 1,
  40.       name: "banner5",
  41.       author: event.senderID,
  42.       messageID: info.messageID
  43.     });
  44.   }, event.messageID);
  45. }
  46. }
  47. module.exports.handleReply = async function({ api, event, args, handleReply, client, __GLOBAL, Threads, Users, Currencies }) {
  48.   const axios = require("axios");
  49.   const fs = require("fs-extra");
  50.   const request = require("request");
  51.   if (handleReply.author != event.senderID) return api.sendMessage('CúC', event.threaID);
  52.   const { loadImage, createCanvas } = require("canvas");
  53.   const path = require('path');
  54.   const Canvas = require('canvas');
  55.    let pathImg1 = __dirname + `/tad/avatar_1_11.png`;
  56.   let pathImg2 = __dirname + `/tad/avatar_1_21.png`;
  57.   let pathImg = __dirname + `/tad/avatar_1.png`;
  58.   let pathAva = __dirname + `/tad/avatar_2.png`;
  59.   let pathLine = __dirname + `/tad/avatar_3.png`;
  60.   const lengthchar = (await axios.get('https://run.mocky.io/v3/0dcc2ccb-b5bd-45e7-ab57-5dbf9db17864')).data
  61.   if (!fs.existsSync(__dirname +
  62.     `/tad/GMV_DIN_Pro.ttf`)) {
  63.     let getfont = (await axios.get(`https://github.com/hanakuUwU/font/raw/main/GMV_DIN_Pro.ttf`, { responseType: "arraybuffer" })).data;
  64.     fs.writeFileSync(__dirname + `/tad/GMV_DIN_Pro.ttf`, Buffer.from(getfont, "utf-8"));
  65.   };
  66.   if (!fs.existsSync(__dirname + `Asem-Kandis-PERSONAL-USE.ttf`)) {
  67.     let getfont2 = (await axios.get(`https://github.com/hanakuUwU/font/raw/main/Asem-Kandis-PERSONAL-USE.ttf`, { responseType: "arraybuffer" })).data;
  68.     fs.writeFileSync(__dirname + `/tad/Asem-Kandis-PERSONAL-USE.ttf`, Buffer.from(getfont2, "utf-8"));
  69.   };
  70.   if (!fs.existsSync(__dirname + `/tad/MTD William Letter.otf`)) {
  71.     let getfont3 = (await axios.get(`https://drive.google.com/u/0/uc?id=1HsVzLw3LOsKfIeuCm9VlTuN_9zqucOni&export=download`, { responseType: "arraybuffer" })).data;
  72.     fs.writeFileSync(__dirname + `/tad/MTD William Letter.otf`, Buffer.from(getfont3, "utf-8"));
  73.   };
  74.   if (!fs.existsSync(__dirname + `/tad/SteelfishRg-Regular.otf`)) {
  75.     let getfont4 = (await axios.get(`https://drive.google.com/u/0/uc?id=1SZD5VXMnXQTBYzHG834pHnfyt7B2tfRF&export=download`, { responseType: "arraybuffer" })).data;
  76.     fs.writeFileSync(__dirname + `/tad/SteelfishRg-Regular.otf`, Buffer.from(getfont4, "utf-8"));
  77.   };
  78.   if (!fs.existsSync(__dirname + `/tad/SVN-BigNoodleTitling.otf`)) {
  79.     let getfont5 = (await axios.get(`https://drive.google.com/u/0/uc?id=1uCXXgyepedb9xwlqMsMsvH48D6wwCmUn&export=download`, { responseType: "arraybuffer" })).data;
  80.     fs.writeFileSync(__dirname + `/tad/SVN-BigNoodleTitling.otf`, Buffer.from(getfont5, "utf-8"));
  81.   };
  82.   const {
  83.     threadID,
  84.     messageID,
  85.     senderID
  86.   } = event;
  87.   if (handleReply.step == 1) {
  88.     if(isNaN(event.body)) return api.sendMessage('Not a number', event.threadID)
  89.     api.unsendMessage(handleReply.messageID);
  90.     return api.sendMessage(`You have chosen style as ${event.body} reply to this message to enter character id`, threadID, function(err, info) {
  91.       return global.client.handleReply.push({
  92.         step: 2,
  93.         name: "banner5",
  94.         author: senderID,
  95.         kieu: event.body,
  96.         messageID: info.messageID
  97.       })
  98.     }, messageID);
  99.   }
  100.   else if (handleReply.step == 2) {
  101.     api.unsendMessage(handleReply.messageID);
  102.     return api.sendMessage(`You have chosen the character as ${event.body} reply to this message to enter the main name`, threadID, function(err, info) {
  103.       return global.client.handleReply.push({
  104.         step: 3,
  105.         name: "banner5",
  106.         author: senderID,
  107.         kieu: handleReply.kieu,
  108.         idnv: event.body,
  109.         messageID: info.messageID
  110.       })
  111.     }, messageID);
  112.   } else if (handleReply.step == 3) {
  113.     api.unsendMessage(handleReply.messageID);
  114.     return api.sendMessage(`You chose the main name ${event.body} reply to this message to enter the subname`, threadID, function(err, info) {
  115.       return global.client.handleReply.push({
  116.         step: 4,
  117.         name: "banner5",
  118.         author: senderID,
  119.         kieu: handleReply.kieu,
  120.         idnv: handleReply.idnv,
  121.         tenchinh: event.body,
  122.         messageID: info.messageID
  123.       })
  124.     }, messageID);
  125.   } else if (handleReply.step == 4) {
  126.     api.unsendMessage(handleReply.messageID);
  127.     return api.sendMessage(`You have chosen a subname ${event.body}, reply to this message to choose a color (please enter no if you want to use the default color )`, threadID, function(err, info) {
  128.       return global.client.handleReply.push({
  129.         step: 5,
  130.         name: "banner5",
  131.         author: senderID,
  132.         kieu: handleReply.kieu,
  133.         idnv: handleReply.idnv,
  134.         tenchinh: handleReply.tenchinh,
  135.         tenphu: event.body,
  136.         messageID: info.messageID
  137.       })
  138.     }, messageID);
  139.   } else if (handleReply.step == 5) {
  140.     const type = handleReply.kieu;
  141.     const char = handleReply.idnv;
  142.     const tenchinh = handleReply.tenchinh;
  143.     const subname = handleReply.tenphu;
  144.     const color = event.body;
  145.     //const test = "https://facebook.com/" + `${senderID}`
  146.     if (color == "no" || color == "No") {
  147.       var color_ = lengthchar[char].colorBg;
  148.     } else {
  149.       var color_ = color;
  150.     }
  151.     if (type == 1) {
  152.       let avtAnime = (
  153.         await axios.get(encodeURI(`${lengthchar[char].imgAnime}`), { responseType: "arraybuffer" })).data;
  154.       let line = (await axios.get(encodeURI(
  155.         `https://i.imgur.com/4BQHmeI.png`),
  156.         { responseType: "arraybuffer" })).data;
  157.       let background = (await axios.get(encodeURI(`https://i.imgur.com/HUblFwC.png`), { responseType: "arraybuffer" })).data;
  158.       fs.writeFileSync(pathAva, Buffer.from(avtAnime, "utf-8"));
  159.       fs.writeFileSync(pathLine, Buffer.from(line, "utf-8"));
  160.       fs.writeFileSync(pathImg, Buffer.from(background, "utf-8"));
  161.       let a = await loadImage(pathImg);
  162.       let ab = await loadImage(pathAva);
  163.       let az = await loadImage(pathLine);
  164.       let canvas = createCanvas(a.width, a.height);
  165.       let ctx = canvas.getContext("2d");
  166.       let canvas2 = createCanvas(a.width, a.height);
  167.       let ctx1 = canvas2.getContext("2d");
  168.       ctx1.fillStyle = "#ffff"
  169.       ctx1.fillRect(0, 0, 1500, 1500)
  170.       ctx1.save();
  171.       ctx1.globalAlpha = "0.1";
  172.       ctx1.drawImage(ab, 0, 0, 1500, 1500);
  173.       ctx1.restore();
  174.       ctx1.save();
  175.       ctx1.fillStyle = "#000"
  176.       ctx1.globalCompositeOperation = "color";
  177.       ctx1.fillRect(0, 0, 1500, 1500)
  178.       ctx1.restore();
  179.       ctx.clearRect(0, 0, canvas.width, canvas.height);
  180.       ctx.fillStyle = color_;
  181.       ctx.fillRect(0, 0, canvas.width, canvas.height);
  182.       ctx.globalCompositeOperation = "destination-in";
  183.       ctx.drawImage(a, 0, 0, canvas.width, canvas.height);
  184.       ctx.globalCompositeOperation = "destination-over";
  185.       ctx.save();
  186.       ctx.fillStyle = "#fff";
  187.       ctx.fillRect(0, 0, canvas.width, canvas.height);
  188.       ctx.restore();
  189.       ctx.globalCompositeOperation = "source-over";
  190.       ctx.drawImage(az, 0, 0, canvas.width, canvas.height);
  191.       ctx.save();
  192.       ctx.textAlign = "center";
  193.       Canvas.registerFont(__dirname + `/tad/GMV_DIN_Pro.ttf`, {
  194.         family: "GMV DIN Pro Cond"
  195.       });
  196.       ctx.fillStyle = "rgba(255, 255, 255,0.8)";
  197.       ctx.strokeStyle = "#fff";
  198.       ctx.lineWidth = 2;
  199.       ctx.font = "200px GMV DIN Pro Cond";
  200.       ctx.strokeText(tenchinh, canvas.width / 2, 650);
  201.       ctx.fillText(tenchinh, canvas.width / 2, 825);
  202.       ctx.strokeText(tenchinh, canvas.width / 2, 1000);
  203.       ctx.restore();
  204.       ctx.save();
  205.       ctx.globalCompositeOperation = "multiply";
  206.       ctx.drawImage(canvas2, -canvas.width / 4, -canvas.width / 4, canvas.width * 1.5, canvas.height * 1.5);
  207.       ctx.restore();
  208.       ctx.save();
  209.       ctx.shadowColor = "rgba(0,0,0, 0.3)";
  210.       ctx.shadowBlur = 10;
  211.       ctx.shadowOffsetX = 0;
  212.       ctx.shadowOffsetY = 0;
  213.       ctx.drawImage(ab, 0, 0, canvas.width, canvas.height);
  214.       ctx.restore();
  215.       ctx.save()
  216.       Canvas.registerFont(__dirname + `Asem-Kandis-PERSONAL-USE.ttf`, {
  217.         family: "Asem Kandis"
  218.       });
  219.       ctx.textAlign = "center";
  220.       ctx.fillStyle = color_;
  221.       ctx.font = "120px Asem Kandis"
  222.       ctx.fillText(subname, canvas.width / 2, 200)
  223.       ctx.save();
  224.       ctx.beginPath();
  225.       ctx.beginPath();
  226.       const imageBuffer = canvas.toBuffer();
  227.       fs.writeFileSync(pathImg, imageBuffer);
  228.       return api.sendMessage({
  229.         body: "Ảnh Của Bạn Đây",
  230.         attachment: fs.createReadStream(pathImg)
  231.       },
  232.         event.threadID,
  233.         () => fs.unlinkSync(pathImg),
  234.         fs.unlinkSync(pathAva),
  235.         fs.unlinkSync(pathLine),
  236.         event.messageID
  237.       );
  238.     } else if (type == 2) {
  239.       let avtAnime = (
  240.         await axios.get(encodeURI(`${lengthchar[char].imgAnime}`), { responseType: "arraybuffer" })).data;
  241.       let line = (await axios.get(encodeURI(
  242.         `https://1.bp.blogspot.com/-5SECGn_32Co/YQkQ-ZyDSPI/AAAAAAAAv1o/nZYKV0s_UPY41XlfWfNIX0HbVoRLhnlogCNcBGAsYHQ/s0/line.png`), { responseType: "arraybuffer" })).data;
  243.       let background = (await axios.get(encodeURI(`https://i.imgur.com/j8FVO1W.jpg`), { responseType: "arraybuffer" })).data;
  244.       fs.writeFileSync(pathAva, Buffer.from(avtAnime, "utf-8"));
  245.       fs.writeFileSync(pathLine, Buffer.from(line, "utf-8"));
  246.       fs.writeFileSync(pathImg, Buffer.from(background, "utf-8"));
  247.       let amg = await loadImage(pathImg);
  248.       let cmg = await loadImage(pathAva);
  249.       let omg = await loadImage(pathLine);
  250.       let canvas = createCanvas(amg.width, amg.height);
  251.       let ctx = canvas.getContext("2d");
  252.       ctx.fillStyle = "#ffffff"
  253.       ctx.fillRect(0, 0, canvas.width, canvas.height)
  254.       ctx.fillStyle = color_
  255.       ctx.fillRect(0, 0, canvas.width, canvas.height)
  256.       Canvas.registerFont(__dirname + `/tad/SteelfishRg-Regular.otf`, {
  257.         family: "SteelfishRg-Regular"
  258.       });
  259.       ctx.font = `430px SteelfishRg-Regular`;
  260.       ctx.textAlign = "center";
  261.       ctx.fillStyle = "rgb(255 255 255 / 70%)"
  262.       ctx.globalAlpha = 0.7
  263.       ctx.fillText(tenchinh.toUpperCase(), canvas.width / 2, 1350)
  264.       ctx.globalAlpha = 1
  265.       ctx.strokeStyle = "white"
  266.       ctx.lineWidth = 7
  267.       ctx.textAlign = "center"
  268.       ctx.strokeText(tenchinh.toUpperCase(), canvas.width / 2, 900)
  269.       ctx.strokeText(tenchinh.toUpperCase(), canvas.width / 2, 1800)
  270.       ctx.drawImage(cmg, 0, 0, 2000, 2000);
  271.       ctx.drawImage(omg, 0, 0, canvas.width, canvas.height)
  272.       Canvas.registerFont(__dirname + `/tad/MTD William Letter.otf`, {
  273.         family: "MTD William Letter"
  274.       });
  275.       ctx.font = `300px MTD William Letter`;
  276.       ctx.fillStyle = `#FFFFFF`
  277.       ctx.textAlign = "center";
  278.       ctx.fillText(subname, canvas.width / 2, 350);
  279.       ctx.beginPath();
  280.       ctx.beginPath();
  281.       const imageBuffer = canvas.toBuffer();
  282.       fs.writeFileSync(pathImg, imageBuffer);
  283.       return api.sendMessage({
  284.         body: "Here's Your Photo",
  285.         attachment: fs.createReadStream(pathImg)
  286.       },
  287.         event.threadID,
  288.         () => fs.unlinkSync(pathImg),
  289.         fs.unlinkSync(pathAva),
  290.         fs.unlinkSync(pathLine),
  291.         event.messageID
  292.       );
  293.     }
  294.     else if (type == 3) {
  295.       let avtAnime = (
  296.         await axios.get(encodeURI(`${lengthchar[char].imgAnime}`), { responseType: "arraybuffer" })).data;
  297.       let background = (
  298.         await axios.get(encodeURI(`https://lh3.googleusercontent.com/-p0IHqcx8eWE/YXZN2izzTrI/AAAAAAAAym8/T-hqrJ2IFooUfHPeVTbiwu047RkmxGLzgCNcBGAsYHQ/s0/layer2.jpg`), {
  299.           responseType: "arraybuffer",
  300.         })
  301.       ).data;
  302.       let hieuung = (
  303.         await axios.get(encodeURI(`https://lh3.googleusercontent.com/-F8w1tQRZ9s0/YXZZmKaylRI/AAAAAAAAynI/HBoYISaw-LE2z8QOE39OGwTUiFjHUH6xgCNcBGAsYHQ/s0/layer4.png`), {
  304.           responseType: "arraybuffer",
  305.         })
  306.       ).data;
  307.       fs.writeFileSync(pathAva, Buffer.from(avtAnime, "utf-8"));
  308.       fs.writeFileSync(pathImg, Buffer.from(background, "utf-8"));
  309.       fs.writeFileSync(pathLine, Buffer.from(hieuung, "utf-8"));
  310.       let h = await loadImage(pathImg);
  311.       let u = await loadImage(pathAva);
  312.       let k = await loadImage(pathLine);
  313.       let canvas = createCanvas(h.width, h.height);
  314.       let ctx = canvas.getContext("2d");
  315.       ctx.drawImage(h, 0, 0, h.width, h.height);
  316.       ctx.fillStyle = color_;
  317.       ctx.filter = "grayscale(1)"
  318.       ctx.fillRect(0, 164, canvas.width, 633)
  319.       ctx.drawImage(k, 0, 0, h.width, h.height);
  320.       ctx.globalAlpha = 0.5
  321.       ctx.drawImage(u, 0, -320, canvas.width, canvas.width)
  322.       ctx.beginPath();
  323.       ctx.globalAlpha = 1
  324.       ctx.transform(1, 0, -0.2, 1, 0, 0)
  325.       Canvas.registerFont(__dirname + `/tad/SVN-BigNoodleTitling.otf`, {
  326.         family: "SVN-BigNoodleTitling"
  327.       });
  328.       ctx.font = `italic 200px SVN-BigNoodleTitling`;
  329.       ctx.fillStyle = `#FFFFFF`
  330.       ctx.textAlign = "end";
  331.       ctx.globalAlpha = 0.8
  332.       ctx.fillText(tenchinh.toUpperCase(), 1215, 535);
  333.       Canvas.registerFont(__dirname + `/tad/SVN-BigNoodleTitling.otf`, {
  334.         family: "SVN-BigNoodleTitling"
  335.       });
  336.       ctx.font = `60px SVN-BigNoodleTitling`;
  337.       ctx.fillStyle = `#FFFFFF`
  338.       ctx.textAlign = "end";
  339.       ctx.globalAlpha = 1
  340.       var l = ctx.measureText(subname).width;
  341.       ctx.fillRect(1500, 164, 150, 633)
  342.       ctx.fillRect(canvas.width - l - 540, 580, l + 50, 75)
  343.       ctx.fillStyle = color_
  344.       ctx.fillText(subname.toUpperCase(), 1195, 640);
  345.       ctx.fillStyle = `#FFFFFF`
  346.       ctx.globalAlpha = 0.5
  347.       ctx.fillRect(1300, 164, 150, 633)
  348.       ctx.globalAlpha = 1
  349.       ctx.transform(1, 0, 0.2, 1, 0, 0)
  350.       ctx.filter = "grayscale(0)"
  351.       ctx.drawImage(u, 1010, 97, 700, 700)
  352.       const imageBuffer = canvas.toBuffer();
  353.       fs.writeFileSync(pathImg, imageBuffer);
  354.       return api.sendMessage({
  355.         body: `Here's Your Photo`,
  356.         attachment: fs.createReadStream(pathImg)
  357.       },
  358.         event.threadID,
  359.         () => fs.unlinkSync(pathImg),
  360.         fs.unlinkSync(pathAva),
  361.         fs.unlinkSync(pathLine),
  362.         event.messageID
  363.       );
  364.     }
  365.     else if(type == 4){
  366.       let background = (await axios.get(encodeURI(`https://lh3.googleusercontent.com/-JZxo4uTVIKQ/YaS7VBjAojI/AAAAAAAA1rk/mg_Bp0Z6_yUGLp1lfC9ugriYTGFfRaXTwCNcBGAsYHQ/s0/layer-2.png`), { responseType: "arraybuffer" })).data;
  367.       fs.writeFileSync(pathImg, Buffer.from(background, "utf-8"));
  368.       let background2 = (await axios.get(encodeURI(`https://lh3.googleusercontent.com/-j9JKCim94ks/YaIMA7fVnPI/AAAAAAAA1k8/g9e5X5FfRH4NiG-7hHRNikGxViI2o8pYQCNcBGAsYHQ/s0/layer-3.png`), { responseType: "arraybuffer" })).data;
  369.       fs.writeFileSync(pathImg1, Buffer.from(background2, "utf-8"));
  370.       let background3 = (await axios.get(encodeURI(`https://lh3.googleusercontent.com/-F8w1tQRZ9s0/YXZZmKaylRI/AAAAAAAAynI/HBoYISaw-LE2z8QOE39OGwTUiFjHUH6xgCNcBGAsYHQ/s0/layer4.png`), { responseType: "arraybuffer" })).data;
  371.       fs.writeFileSync(pathImg2, Buffer.from(background3, "utf-8"));
  372.       let ava = (await axios.get(encodeURI(`${lengthchar[char].imgAnime}`), { responseType: "arraybuffer" })).data;
  373.       fs.writeFileSync(pathAva, Buffer.from(ava, "utf-8"));
  374.       if (!fs.existsSync(__dirname +
  375.         `/tad/UTM-Avo.ttf`)) {
  376.         let getfont = (await axios.get(`https://github.com/hanakuUwU/font/blob/main/UTM%20Avo.ttf?raw=true`, { responseType: "arraybuffer" })).data;
  377.         fs.writeFileSync(__dirname + `/tad/UTM-Avo.ttf`, Buffer.from(getfont, "utf-8"));
  378.       }
  379.       const test = "https://facebook.com/" + event.senderID;
  380.       let l1 = await loadImage(pathAva);
  381.       let l2 = await loadImage(pathImg);
  382.       let l3 = await loadImage(pathImg1);
  383.       let l4 = await loadImage(pathImg2);
  384.       let a = await loadImage(pathImg);
  385.       let canvas = createCanvas(a.width, a.height);
  386.       var ctx = canvas.getContext("2d");
  387.       Canvas.registerFont(__dirname + `/tad/UTM-Avo.ttf`, {
  388.         family: "UTM-Avo"
  389.       });
  390.       ctx.save();
  391.       ctx.fillStyle = color_;
  392.       ctx.fillRect(0, 0, canvas.width, canvas.height);
  393.       ctx.restore();
  394.       ctx.save();
  395.       ctx.drawImage(l2, 0, 0, canvas.width, canvas.height);
  396.       ctx.restore();
  397.       ctx.save();
  398.       ctx.globalCompositeOperation = "multiply";
  399.       ctx.globalAlpha = "0.5"
  400.       ctx.drawImage(l1, -300, -300, 1500, 1500);
  401.       ctx.restore();
  402.       ctx.save();
  403.       ctx.fillStyle = "#fff";
  404.       ctx.transform(1, 0, 1, 1, 0, 0);
  405.       ctx.fillRect(500, 0, 650, 740);
  406.       ctx.restore();
  407.  
  408.  
  409.       ctx.save();
  410.       ctx.beginPath();
  411.       ctx.save();
  412.       ctx.transform(1, 0, 1, 1, 0, 0);
  413.       ctx.rect(500, 0, 650, 740);
  414.       ctx.restore();
  415.       ctx.clip();
  416.       ctx.save();
  417.       ctx.globalAlpha = "0.1";
  418.       ctx.drawImage(l1, 300, -300, 1500, 1500);
  419.       ctx.restore();
  420.       ctx.save();
  421.       ctx.drawImage(l3, 0, 0, canvas.width, canvas.height);
  422.       ctx.restore();
  423.       ctx.save();
  424.       ctx.globalCompositeOperation = "color";
  425.       ctx.fillStyle = "#000";
  426.       ctx.fillRect(0, 0, canvas.width, canvas.height);
  427.       ctx.restore();
  428.       ctx.restore();
  429.       var ttx = 950;
  430.       var tty = 600;
  431.       var ttpad = 180;
  432.       var ttsize = "300px";
  433.       ctx.save();
  434.       ctx.beginPath();
  435.       ctx.save();
  436.       ctx.transform(1, 0, 1, 1, 0, 0);
  437.       ctx.rect(500, 0, 650, 740);
  438.       ctx.restore();
  439.       ctx.clip();
  440.       ctx.save();
  441.       ctx.translate(ttx, tty);
  442.       ctx.globalAlpha = 0.5;
  443.       ctx.rotate(Math.PI / 180 * 45);
  444.       ctx.strokeStyle = color_;
  445.       ctx.lineWidth = 4;
  446.       ctx.textAlign = "center";
  447.       ctx.font = ttsize + " DIN Condensed";
  448.       ctx.strokeText(subname.split("").join(String.fromCharCode(8203)), 0, 0);
  449.       ctx.restore();
  450.       ctx.save();
  451.       ctx.globalAlpha = 0.5;
  452.       ctx.fillStyle = color_;
  453.       ctx.lineWidth = 2;
  454.       ctx.translate(ttx + ttpad, tty - ttpad);
  455.       ctx.rotate(Math.PI / 180 * 45);
  456.       ctx.textAlign = "center";
  457.       ctx.font = ttsize + " DIN Condensed";
  458.       ctx.fillText(subname.split("").join(String.fromCharCode(8202)), 0, 0);
  459.       ctx.restore();
  460.       ctx.strokeStyle = color_;
  461.       ctx.globalAlpha = 0.4;
  462.       ctx.lineWidth = 5;
  463.       ctx.translate(ttx + ttpad * 2, tty - ttpad * 2);
  464.       ctx.rotate(Math.PI / 180 * 45);
  465.       ctx.textAlign = "center";
  466.       ctx.font = ttsize + " DIN Condensed"; ctx.strokeText(subname.split("").join(String.fromCharCode(8202)), 0, 0);
  467.       ctx.restore();
  468.       ctx.restore();
  469.       ctx.save();
  470.       ctx.shadowColor = "rgba(0,0,0, 0.3)";
  471.       ctx.shadowBlur = 10;
  472.       ctx.shadowOffsetX = 0;
  473.       ctx.shadowOffsetY = 0;
  474.       ctx.drawImage(l1, 900, -200, 1000, 1000);
  475.       ctx.restore();
  476.       ctx.save();
  477.       //ctx.style.letterSpacing = '5px';
  478.       ctx.fillStyle = "#fff";
  479.       ctx.textAlign = "center";
  480.       ctx.font = "bold 65px UTM-Avo";
  481.       ctx.fillText(tenchinh, 430, 390);
  482.       ctx.restore();
  483.       ctx.save();
  484.       // ctx.style.letterSpacing = '10px';
  485.       ctx.fillStyle = "#fff";
  486.       ctx.textAlign = "center";
  487.       ctx.font = "27px UTM-Avo";
  488.       ctx.fillText(test.toUpperCase(), 430, 440);
  489.       ctx.restore();
  490.       ctx.save();
  491.       ctx.fillStyle = "#fff";
  492.       ctx.fillRect(430 - 300 / 2, 470, 300, 5)
  493.       ctx.font = "27px UTM-Avo";
  494.       ctx.fillText("+++".toUpperCase(), 150, 300);
  495.       ctx.restore();
  496.       ctx.beginPath();
  497.       const imageBuffer = canvas.toBuffer();
  498.       fs.writeFileSync(pathImg, imageBuffer);
  499.       return api.sendMessage({
  500.         body: "Here's Your Photo",
  501.         attachment: fs.createReadStream(pathImg)
  502.       },
  503.         event.threadID,
  504.         () => fs.unlinkSync(pathImg),
  505.         fs.unlinkSync(pathImg1),
  506.         fs.unlinkSync(pathImg2),
  507.         fs.unlinkSync(pathAva),
  508.         event.messageID
  509.       );
  510.     }
  511.   }
  512. }



  • Recent Pastes