File size: 1,119 Bytes
bb69f9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
const { facebook, bot, generateList, isUrl } = require('../lib/')

bot(
  {
    pattern: 'fb ?(.*)',
    desc: 'Download facebook video',
    type: 'download',
  },
  async (message, match) => {
    match = isUrl(match || message.reply_message.text)
    if (!match) return await message.send('_Example : fb url_')
    const result = await facebook(match)
    if (!result.length)
      return await message.send('*Not found*', {
        quoted: message.quoted,
      })
    if (result.length == 1)
      return await message.sendFromUrl(result[0].url, { quoted: message.data })
    const list = generateList(
      result.map((e) => ({
        id: `upload ${e.url}`,
        text: e.quality,
      })),
      `*Choose Video Quality*`,
      message.jid,
      message.participant,
      message.id
    )
    return await message.send(list.message, {}, list.type)
    // return await message.send(
    // 	await genButtonMessage(
    // 		result.map((e) => ({
    // 			id: `upload ${e.url}`,
    // 			text: e.quality,
    // 		})),
    // 		'Choose Video Quality'
    // 	),
    // 	{},
    // 	'button'
    // )
  }
)