forked from Paquito1923/elyasmd
-
Notifications
You must be signed in to change notification settings - Fork 1
/
nulis.js
77 lines (73 loc) · 1.84 KB
/
nulis.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
let util = require('util')
let path = require('path')
let { spawn } = require('child_process')
// Font By MFarelS:V
let fontPath = 'src/font/Zahraaa.ttf'
let handler = async (m, { conn, args }) => {
if (!global.support.convert &&
!global.support.magick &&
!global.support.gm) return handler.disabled = true // Disable if doesnt support
let inputPath = 'src/kertas/magernulis1.jpg'
let d = new Date
let tgl = d.toLocaleDateString('id-Id')
let hari = d.toLocaleDateString('id-Id', { weekday: 'long' })
let teks = args.join` `
// conn.reply(m.chat, util.format({fontPath, inputPath, outputPath, tgl, hari, teks}), m)
let bufs = []
const [_spawnprocess, ..._spawnargs] = [...(global.support.gm ? ['gm'] : global.support.magick ? ['magick'] : []),
'convert',
inputPath,
'-font',
fontPath,
'-size',
'1024x784',
'-pointsize',
'20',
'-interline-spacing',
'1',
'-annotate',
'+806+78',
hari,
'-font',
fontPath,
'-size',
'1024x784',
'-pointsize',
'18',
'-interline-spacing',
'1',
'-annotate',
'+806+102',
tgl,
'-font',
fontPath,
'-size',
'1024x784',
'-pointsize',
'20',
'-interline-spacing',
'-7.5',
'-annotate',
'+344+142',
teks,
'jpg:-'
]
spawn(_spawnprocess, _spawnargs)
.on('error', e => conn.reply(m.chat, util.format(e), m))
.on('close', () => {
conn.sendFile(m.chat, Buffer.concat(bufs), 'nulis.jpg', 'Hati² ketahuan:v', m)
})
.stdout.on('data', chunk => bufs.push(chunk))
}
handler.help = ['n'].map(v => v + 'ulis <teks>')
handler.tags = ['tools']
handler.command = /^nulis$/i
handler.owner = false
handler.mods = false
handler.premium = false
handler.group = false
handler.private = false
handler.admin = false
handler.botAdmin = false
handler.fail = null
module.exports = handler