1.41.56 • Published 1 day ago

@neoxr/wb v1.41.56

Weekly downloads
-
License
ISC
Repository
github
Last release
1 day ago

Simplicity WhatsApp Bot (Baileys)

This is a WhatsApp bot module based on Baileys which can be used in a very easy way.

Example

For example of use you can open the example folder or here for example base

Handling Events

There are several events that can be used are as follows :

client.on('connect', () => console.log)
client.on('error', error => console.log(error))
client.on('ready', () => console.log)
client.on('message', ctx => console.log(ctx))
client.on('message.delete', ctx => console.log(ctx))
client.on('group.add', ctx => console.log(ctx))
client.on('group.remove', ctx => console.log(ctx))
client.on('group.promote', ctx => console.log(ctx))
client.on('group.demote', ctx => console.log(ctx))
client.on('caller', ctx => console.log(ctx))
client.on('poll', ctx => console.log(ctx))
client.on('presence.update', ctx => console.log(ctx))

Event Message (message)

{
   m: {
      key: {
         remoteJid: '6285887776722@s.whatsapp.net',
         fromMe: false,
         id: 'A4A5E1FB9C33178CD11673178C46CA1E',
         participant: undefined
      },
      messageTimestamp: 1689557472,
      pushName: 'Wildan Izzudin',
      broadcast: false,
      message: Message {
         extendedTextMessage: [ExtendedTextMessage],
         messageContextInfo: [MessageContextInfo]
      },
      id: 'A4A5E1FB9C33178CD11673178C46CA1E',
      isBot: false,
      chat: '6285887776722@s.whatsapp.net',
      fromMe: false,
      isGroup: false,
      sender: '6285887776722@s.whatsapp.net',
      mtype: 'extendedTextMessage',
      msg: ExtendedTextMessage {
         text: '.menu',
         previewType: 0,
         contextInfo: [ContextInfo],
         inviteLinkGroupTypeV2: 0
      },
      quoted: null,
      mentionedJid: [],
      reply: [Function(anonymous)],
      text: '.menu'
   },
   body: '.menu',
   prefix: '.',
   plugins: [],
   commands: [],
   args: [],
   command: 'menu',
   text: '',
   prefixes: ['.', '#', '!', '/']
}

Messaging Function

// declaration variable sock
const sock = client.sock

// send a text message (auto tagged)
sock.reply(m.chat, `Test!`, m)

// send a react message
sock.sendReact(m.chat, `💀`, m.key)

// send a text message with progress bar
sock.sendProgress(m.chat, `Test!`, m)

// send a ptv message from path, url, or buffer (video duration 10s)
sock.sendPtv(m.chat, `./media/video/yemete.mp4`)

// send a text message with custom thumbnail
sock.sendMessageModify(m.chat, `Test!`, m, {
   title: '© neoxr-bot',
   largeThumb: true,
   ads: false,
   /* can buffer or url */
   thumbnail: 'https://iili.io/HP3ODj2.jpg',
   link: 'https://chat.whatsapp.com/HYknAquOTrECm9KPJJQO1V'
})

// send a text message with custom thumbnail & fake quoted
sock.sendMessageModifyV2(m.chat, `Test!`, '© neoxr-bot', {
   title: '© neoxr-bot',
   largeThumb: true,
   ads: false,
   /* can buffer or url */
   thumbnail: 'https://iili.io/HP3ODj2.jpg',
   link: 'https://chat.whatsapp.com/HYknAquOTrECm9KPJJQO1V'
})

// send a text message with fake quoted
sock.sendMessageVerify(m.chat, `Test!`, '© neoxr-bot')

// send a file from path, url, or buffer (auto extension)
sock.sendFile(m.chat, 'https://iili.io/HP3ODj2.jpg', 'image.jpg', 'Test!', m)

// send a document from path, url, or buffer (auto extension)
sock.sendFile(m.chat, 'https://iili.io/HP3ODj2.jpg', 'image.jpg', 'Test!', m, {
   document: true
})

// send a voicenote from path, url, or buffer
sock.sendFile(m.chat, './media/audio/ah.mp3', '', '', m, {
   ptt: true
})

// send a audio from path, url, or buffer with thumbnail in audio tag
sock.sendFile(m.chat, './media/audio/ah.mp3', '', '', m, {
   APIC: < Buffer >
})

// send a sticker message from url or buffer
sock.sendSticker(m.chat, 'https://iili.io/HP3ODj2.jpg', m, {
   packname: 'Sticker by',
   author: '© neoxr.js'
})

// send polling message
sock.sendPoll(m.chat, 'Do you like this library ?', {
   options: ['Yes', 'No'],
   multiselect: false
})

// send contact message
sock.sendContact(m.chat, [{
   name: 'Wildan Izzudin',
   number: '6285887776722',
   about: 'Owner & Creator'
}], m, {
   org: 'Neoxr Network',
   website: 'https://api.neoxr.my.id',
   email: 'contact@neoxr.my.id'
})

// forward message
sock.copyNForward(m.chat, m)

// send button message (your own risk)
var buttons = [{
   name: "quick_reply",
   buttonParamsJson: JSON.stringify({
      display_text: "OWNER",
      id: '.owner'
   }),
}, {
   name: "cta_url",
   buttonParamsJson: JSON.stringify({
      display_text: "Rest API",
      url: "https://api.neoxr.my.id",
      merchant_url: "https://api.neoxr.my.id"
   })
}, {
   name: "cta_copy",
   buttonParamsJson: JSON.stringify({
      display_text: "Copy",
      copy_code: "123456"
   })
}, {
   name: "single_select",
   buttonParamsJson: JSON.stringify({
      title: "Tap!",
      sections: [{
         rows: [{
            title: "Owner",
            description: `X`,
            id: `.owner`
         }, {
            title: "Runtime",
            description: `Y`,
            id: `.run`
         }]
      }]
   })
}]

// button & list
client.sendIAMessage(m.chat, buttons, m, {
   header: '',
   content: 'Hi!',
   footer: '',
   media: global.db.setting.cover // video or image link
})
1.41.56

1 day ago

1.40.56

3 days ago

1.40.55

4 days ago

1.39.54

4 days ago

1.39.55

4 days ago

1.38.53

21 days ago

1.38.54

21 days ago

1.38.51

1 month ago

1.38.52

1 month ago

1.37.51

2 months ago

1.37.50

2 months ago

1.36.49

2 months ago

1.36.48

2 months ago

1.36.47

2 months ago

1.35.46

2 months ago

1.35.47

2 months ago

1.34.46

2 months ago

1.34.44

2 months ago

1.34.45

2 months ago

1.33.42

2 months ago

1.33.43

2 months ago

1.33.41

2 months ago

1.31.41

2 months ago

1.32.41

2 months ago

1.29.42

2 months ago

1.30.42

2 months ago

1.30.41

2 months ago

1.28.42

3 months ago

1.28.41

3 months ago

1.28.40

3 months ago

1.27.38

3 months ago

1.27.37

3 months ago

1.27.39

3 months ago

1.27.40

3 months ago

1.26.37

3 months ago

1.25.37

4 months ago

1.24.37

6 months ago

1.24.36

6 months ago

1.23.36

6 months ago

1.23.35

6 months ago

1.23.34

6 months ago

1.22.34

6 months ago

1.21.34

6 months ago

1.21.33

6 months ago

1.21.32

6 months ago

1.21.31

6 months ago

1.21.30

6 months ago

1.20.30

6 months ago

1.20.29

6 months ago

1.20.28

7 months ago

1.19.28

7 months ago

1.18.28

7 months ago

1.18.27

7 months ago

1.18.26

7 months ago

1.17.25

7 months ago

1.17.24

7 months ago

1.17.23

7 months ago

1.17.22

8 months ago

1.17.21

8 months ago

1.17.20

8 months ago

1.17.19

8 months ago

1.17.18

8 months ago

1.17.17

8 months ago

1.16.17

8 months ago

1.16.16

9 months ago

1.16.15

9 months ago

1.14.15

9 months ago

1.14.14

9 months ago

1.14.13

9 months ago

1.13.12

9 months ago

1.12.12

9 months ago

1.12.11

9 months ago

1.12.10

9 months ago

1.12.9

9 months ago

1.11.9

10 months ago

1.11.8

10 months ago

1.10.8

10 months ago

1.9.7

10 months ago

1.8.7

10 months ago

1.5.6

10 months ago

1.5.5

10 months ago

1.5.4

10 months ago

1.4.4

10 months ago

1.4.3

10 months ago

1.3.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago