-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathtwitter.js
20 lines (18 loc) · 1.04 KB
/
twitter.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const { twitter } = require('../lib/scrape')
let handler = async (m, { conn, args, usedPrefix, command }) => {
if (!args[0]) throw `*Perintah ini untuk mengunduh media twitter dengan link*\n\ncontoh:\n${usedPrefix + command} https://twitter.com/gofoodindonesia/status/1229369819511709697`
if (!args[0].match(/(https:\/\/.*twitter.com)/gi)) throw `*Link salah! Perintah ini untuk mengunduh media twitter dengan link*\n\ncontoh:\n${usedPrefix + command} https://twitter.com/gofoodindonesia/status/1229369819511709697`
twitter(args[0]).then(async res => {
let twit = JSON.stringify(res)
let json = JSON.parse(twit)
let pesan = json.data.map((v) => `Link: ${v.url}`).join('\n------------\n')
m.reply(pesan)
for (let { url } of json.data)
conn.sendFile(m.chat, url, 'ig' + (/mp4/i.test(url) ? '.mp4' : '.jpg'), `*© stikerin*`, m, false, { thumbnail: Buffer.alloc(0) })
})
}
handler.help = ['twitter'].map(v => v + ' <url>')
handler.tags = ['downloader']
handler.command = /^twitter$/i
handler.limit = true
module.exports = handler