-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
143 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
let stdouts = [] | ||
module.exports = (maxLength = 200) => { | ||
let oldWrite = process.stdout.write.bind(process.stdout) | ||
module.exports.disable = () => { | ||
module.exports.isModified = false | ||
return process.stdout.write = oldWrite | ||
} | ||
process.stdout.write = (chunk, encoding, callback) => { | ||
stdouts.push(Buffer.from(chunk, encoding)) | ||
oldWrite(chunk, encoding, callback) | ||
if (stdouts.length > maxLength) stdouts.shift() | ||
} | ||
module.exports.isModified = true | ||
return module.exports | ||
} | ||
|
||
module.exports.isModified = false | ||
module.exports.logs = () => Buffer.concat(stdouts) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
let handler = async (m, { conn, text }) => { | ||
m.reply('_Sedang membuat..._\n*Mohon tunggu sekitar 1 menit*') | ||
let q | ||
try { q = m.quoted.download() } | ||
catch (e) { q = m.download() } | ||
running(await q).then(vid => conn.sendFile(m.chat, vid, 'run.mp4', '*© Nurutomo*\nMade with FFmpeg', m)) | ||
} | ||
handler.help = ['run'] | ||
handler.tags = ['tools'] | ||
handler.command = /^run$/i | ||
handler.limit = true | ||
|
||
module.exports = handler | ||
|
||
let { spawn } = require('child_process') | ||
let fs = require('fs') | ||
let path = require('path') | ||
let tmp = path.join(__dirname, '../tmp/') | ||
function running(img) { | ||
return new Promise((resolve, reject) => { | ||
let layers = [ | ||
'color=s=512x512:d=10:r=60[bg]', | ||
'[0:v]scale=-2:512[img]', | ||
"[bg][img]overlay=x='(w+(2*h))*((n/60)*(-1/10))+(2*h)'" | ||
] | ||
|
||
let n = + new Date + 'run.jpg' | ||
let i = path.join(tmp, n) | ||
fs.writeFileSync(i, img) | ||
console.log(img) | ||
let o = path.join(tmp, n + '.mp4') | ||
let args = [ | ||
'-y', | ||
'-i', i, | ||
'-t', '10', | ||
'-filter_complex', layers.join(';'), | ||
'-pix_fmt', 'yuv420p', | ||
'-crf', '18', | ||
o | ||
] | ||
console.log('ffmpeg', ...args) | ||
spawn('ffmpeg', args, { stdio: 'inherit' }) | ||
.on('error', reject) | ||
.on('close', () => { | ||
try { | ||
fs.unlinkSync(i) | ||
resolve(fs.readFileSync(o)) | ||
fs.unlinkSync(o) | ||
} catch (e) { | ||
reject(e) | ||
} | ||
}) | ||
//.stderr.on('data', a => console.log(a+'')) | ||
}) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
let fetch = require('node-fetch') | ||
let split = '|' | ||
let handler = async (m, { conn, args: [effect], text: txt }) => { | ||
let { effects } = await (await (fetch(global.API('xteam', '/textpro')))).json() | ||
if (!effect) throw '*List Effect*\n\n' + effects.sort((a, b) => a - b).join('\n') | ||
effect = effect.toLowerCase() | ||
if (!effect in effects) throw `Efek *${effect}* tidak ditemukan` | ||
let [text, ...text2] = txt.replace(effect, '').trimStart().split(split) | ||
text2 = text2.join(split) | ||
let url = global.API('xteam', '/textpro/' + effect, { text, text2 }, 'APIKEY') | ||
try { | ||
conn.sendFile(m.chat, url, 'textpro.jpg', `*TEXTPRO*\n*Effect:* ${effect}`, m) | ||
} catch (e) { | ||
m.reply(url) | ||
throw e | ||
} | ||
} | ||
handler.help = ['textpro'].map(v => v + ' <effect> <text>|[text2]') | ||
handler.tags = ['tools'] | ||
handler.command = /^(textpro)$/i | ||
|
||
module.exports = handler | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters