File size: 559 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
const { bot } = require('../lib/')

bot(
  {
    pattern: 'poll ?(.*)',
    desc: 'poll',
    type: 'whatsapp',
  },
  async (message, match) => {
    const poll = match.split(',')
    if (poll.length < 3) return await message.send('*Example : question,option1,option2,...*')
    const name = poll[0]
    const options = []
    for (let i = 1; i < poll.length; i++) options.push({ optionName: poll[i] })
    await message.send(
      {
        name,
        options,
        selectableOptionsCount: options.length,
      },
      {},
      'poll'
    )
  }
)