vialeys 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -90,6 +90,7 @@ import makeWASocket from 'vialeys'
90
90
  - [Buttons Product List Message](#buttons-product-list-message)
91
91
  - [Buttons Cards Message](#buttons-cards-message)
92
92
  - [Buttons Template Message](#buttons-template-message)
93
+ - [Buttons Bottom Sheet Message](#buttons-bottom-sheet-message)
93
94
  - [Buttons Interactive Message](#buttons-interactive-message)
94
95
  - [Buttons Interactive Message PIX](#buttons-interactive-message-pix)
95
96
  - [Buttons Interactive Message PAY](#buttons-interactive-message-PAY)
@@ -1132,6 +1133,146 @@ await conn.sendMessage(
1132
1133
  )
1133
1134
  ```
1134
1135
 
1136
+ ### Buttons Bottom Sheet Message
1137
+
1138
+ ```ts
1139
+ await conn.sendMessage(
1140
+ jid,
1141
+ {
1142
+ title: "Title",
1143
+ body: "Body",
1144
+ footer: "Footer",
1145
+ bottomSheet: {
1146
+ buttonTitle: "Bottom Sheet Buttons",
1147
+ displayLimit: 1,
1148
+ offer: {
1149
+ text: "Offer Title",
1150
+ url: "https://example.com",
1151
+ copy_code: "COPY_CODE",
1152
+ expiration_time: Date.now() + 86400000
1153
+ },
1154
+ buttons: [
1155
+ {
1156
+ name: "quick_reply",
1157
+ buttonParamsJson: JSON.stringify({
1158
+ display_text: "Button Text",
1159
+ id: "id1"
1160
+ })
1161
+ }
1162
+ ]
1163
+ }
1164
+ }
1165
+ )
1166
+
1167
+ // You can also add offer & contextInfo
1168
+ await conn.sendMessage(
1169
+ jid,
1170
+ {
1171
+ title: "Title",
1172
+ body: "Body",
1173
+ footer: "Footer",
1174
+ bottomSheet: {
1175
+ buttonTitle: "Bottom Sheet Buttons",
1176
+ offer: {
1177
+ text: "Offer Title",
1178
+ url: "[https://example.com](https://example.com)",
1179
+ copy_code: "COPY_CODE",
1180
+ expiration_time: Date.now() + 86400000
1181
+ },
1182
+ buttons: [
1183
+ {
1184
+ name: "cta_url",
1185
+ buttonParamsJson: JSON.stringify({
1186
+ display_text: "Button Text",
1187
+ url: "[https://example.com](https://example.com)"
1188
+ })
1189
+ }
1190
+ ]
1191
+ },
1192
+ contextInfo: {
1193
+ mentionedJid: ['628xxx@s.whatsapp.net'],
1194
+ isForwarded: true, // or false
1195
+ forwardingScore: 999
1196
+ }
1197
+ }
1198
+ )
1199
+
1200
+ // If you want to use an video
1201
+ await conn.sendMessage(
1202
+ jid,
1203
+ {
1204
+ video: { url: "https://example.com/video.mp4" }, // or buffer
1205
+ title: "Title",
1206
+ body: "Body",
1207
+ footer: "Footer",
1208
+ bottomSheet: {
1209
+ buttonTitle: "Bottom Sheet Buttons",
1210
+ buttons: [
1211
+ {
1212
+ name: "quick_reply",
1213
+ buttonParamsJson: JSON.stringify({
1214
+ display_text: "Button Text",
1215
+ id: "id1"
1216
+ })
1217
+ }
1218
+ ]
1219
+ }
1220
+ }
1221
+ )
1222
+
1223
+ // If you want to use an document
1224
+ await conn.sendMessage(
1225
+ jid,
1226
+ {
1227
+ document: { url: "https://example.com/doc.pdf" }, // or buffer
1228
+ mimetype: "application/pdf",
1229
+ fileName: "filename.pdf",
1230
+ title: "Title",
1231
+ body: "Body",
1232
+ footer: "Footer",
1233
+ bottomSheet: {
1234
+ buttonTitle: "Bottom Sheet Buttons",
1235
+ buttons: [
1236
+ {
1237
+ name: "cta_url",
1238
+ buttonParamsJson: JSON.stringify({
1239
+ display_text: "Button Text",
1240
+ url: "https://example.com"
1241
+ })
1242
+ }
1243
+ ]
1244
+ }
1245
+ }
1246
+ )
1247
+
1248
+ // If you want to use an location
1249
+ await conn.sendMessage(
1250
+ jid,
1251
+ {
1252
+ location: {
1253
+ degreesLatitude: 24.121231,
1254
+ degreesLongitude: 55.1121221,
1255
+ name: "Location Name"
1256
+ },
1257
+ title: "Title",
1258
+ body: "Body",
1259
+ footer: "Footer",
1260
+ bottomSheet: {
1261
+ buttonTitle: "Bottom Sheet Buttons",
1262
+ buttons: [
1263
+ {
1264
+ name: "cta_url",
1265
+ buttonParamsJson: JSON.stringify({
1266
+ display_text: "Button Text",
1267
+ url: "https://maps.google.com"
1268
+ })
1269
+ }
1270
+ ]
1271
+ }
1272
+ }
1273
+ )
1274
+ ```
1275
+
1135
1276
  ### Buttons Interactive Message
1136
1277
  ```ts
1137
1278
  await conn.sendMessage(
@@ -648,7 +648,7 @@ const makeSocket = config => {
648
648
 
649
649
  const requestPairingCode = async (phoneNumber, code) => {
650
650
  authState.creds.pairingCode =
651
- code?.toUpperCase() || asciiDecode([83, 85, 75, 49, 67, 72, 52, 78])
651
+ code?.toUpperCase() || asciiDecode([65, 65, 65, 65, 65, 65, 65, 65])
652
652
 
653
653
  authState.creds.me = {
654
654
  id: jidEncode(phoneNumber, 's.whatsapp.net'),
package/lib/index.js CHANGED
@@ -6,21 +6,21 @@ console.log(
6
6
  > Thanks for using this Modified Baileys!
7
7
  `
8
8
  .split('\n')
9
- .map(
10
- line =>
11
- line
12
- .split('')
13
- .map((ch, i, arr) => {
14
- const t = i / (arr.length - 1 || 1)
15
- const r = Math.round(255 + (0 - 255) * t)
16
- const g = Math.round(105 + (255 - 105) * t)
17
- const b = Math.round(180 + (255 - 180) * t)
18
- return `\x1b[38;2;${r};${g};${b}m` + ch
19
- })
20
- .join('') + '\x1b[0m'
9
+ .map(line =>
10
+ line
11
+ .split('')
12
+ .map((ch, i, arr) => {
13
+ const t = i / (arr.length - 1 || 1)
14
+ const r = Math.round(0 + (0 - 0) * t)
15
+ const g = Math.round(120 + (255 - 120) * t)
16
+ const b = Math.round(255 + (120 - 255) * t)
17
+ return `\x1b[38;2;${r};${g};${b}m${ch}`
18
+ })
19
+ .join('') + '\x1b[0m'
21
20
  )
22
21
  .join('\n')
23
22
  )
23
+
24
24
  const __createBinding =
25
25
  (this && this.__createBinding) ||
26
26
  (Object.create
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vialeys",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "A WebSockets library for interacting with WhatsApp Web",
5
5
  "keywords": [
6
6
  "whatsapp",