
PaiX0 / Fake story ig
Idk mbut
APIJavaScript
5 views

Idk mbut
*`CASE FAKE STORY IG`*
> *Saluran Share :* https://whatsapp.com/channel/0029Vb7pLCF35fLqMBUCMP1D
case 'fakestory': {
try {
const { createCanvas, loadImage } = require('canvas')
await conn.sendMessage(m.chat, { react: { text: '⏳', key: m.key } })
let [username, caption] = text.split('|')
if (!username || !caption) return m.reply(`Kek gini:\n.${command} Ichika|hmm...`)
const bgUrl = 'https://files.catbox.moe/3gwr1l.jpg'
const bg = await loadImage(bgUrl)
const userPP = await conn.profilePictureUrl(m.sender, 'image').catch(_ => 'https://img1.pixhost.to/images/5831/600387261_biyu-offc.jpg')
const pp = await loadImage(userPP)
const canvas = createCanvas(720, 1280)
const ctx = canvas.getContext('2d')
ctx.drawImage(bg, 0, 0, canvas.width, canvas.height)
const ppX = 40
const ppY = 250
const ppSize = 70
ctx.save()
ctx.beginPath()
ctx.arc(ppX + ppSize / 2, ppY + ppSize / 2, ppSize / 2, 0, Math.PI * 2)
ctx.closePath()
ctx.clip()
ctx.drawImage(pp, ppX, ppY, ppSize, ppSize)
ctx.restore()
ctx.font = '28px Arial'
ctx.fillStyle = '#FFFFFF'
ctx.textAlign = 'left'
ctx.textBaseline = 'middle'
const usernameX = ppX + ppSize + 15
const usernameY = ppY + ppSize / 2
ctx.fillText(username, usernameX, usernameY)
ctx.font = 'bold 30px Arial'
ctx.fillStyle = '#FFFFFF'
ctx.textAlign = 'center'
ctx.textBaseline = 'top'
const captionX = canvas.width / 2
const captionY = canvas.height - 650
const maxWidth = canvas.width - 100
const lineHeight = 42
wrapTextCenter(ctx, caption, captionX, captionY, maxWidth, lineHeight)
let buffer = canvas.toBuffer()
await conn.sendMessage(m.chat, {
image: buffer,
caption: 'Berhasil'
}, { quoted: m })
} catch (e) {
m.reply(`❌ Error\nLogs error : ${e.message}`)
}
function wrapTextCenter(ctx, text, x, y, maxWidth, lineHeight) {
let line = ''
for (let i = 0; i < text.length; i++) {
let testLine = line + text[i]
let testWidth = ctx.measureText(testLine).width
if (testWidth > maxWidth && line !== '') {
ctx.fillText(line, x, y)
line = text[i]
y += lineHeight
} else {
line = testLine
}
}
if (line) ctx.fillText(line, x, y)
}
}
break