@neelegirl/baileys 1.6.0 → 1.6.1

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.
@@ -888,6 +888,24 @@ const makeChatsSocket = (config) => {
888
888
  }, jid)
889
889
  }
890
890
 
891
+ /**
892
+ * Add or Edit Quick Reply
893
+ */
894
+ const addOrEditQuickReply = (quickReply) => {
895
+ return chatModify({
896
+ quickReply
897
+ }, '')
898
+ }
899
+
900
+ /**
901
+ * Remove Quick Reply
902
+ */
903
+ const removeQuickReply = (timestamp) => {
904
+ return chatModify({
905
+ quickReply: { timestamp, deleted: true }
906
+ }, '')
907
+ }
908
+
891
909
  /**
892
910
  * Removes Chats
893
911
  */
@@ -1104,6 +1122,8 @@ const makeChatsSocket = (config) => {
1104
1122
  removeChatLabel,
1105
1123
  addMessageLabel,
1106
1124
  removeMessageLabel,
1125
+ addOrEditQuickReply,
1126
+ removeQuickReply,
1107
1127
  clearMessage
1108
1128
  }
1109
1129
  }
@@ -956,6 +956,36 @@ const makeMessagesSocket = (config) => {
956
956
  .then((metadata) => WABinary_1.getBinaryNodeChild(metadata, 'ephemeral')?.attrs?.expiration || 0)
957
957
  }
958
958
 
959
+ /**
960
+ * Update Member Label
961
+ */
962
+ const updateMemberLabel = (jid, memberLabel) => {
963
+ return relayMessage(
964
+ jid,
965
+ {
966
+ protocolMessage: {
967
+ type: WAProto_1.proto.Message.ProtocolMessage.Type.GROUP_MEMBER_LABEL_CHANGE,
968
+ memberLabel: {
969
+ label: memberLabel?.slice(0, 30),
970
+ labelTimestamp: Utils_1.unixTimestampSeconds()
971
+ }
972
+ }
973
+ },
974
+ {
975
+ additionalNodes: [
976
+ {
977
+ tag: 'meta',
978
+ attrs: {
979
+ tag_reason: 'user_update',
980
+ appdata: 'member_tag'
981
+ },
982
+ content: undefined
983
+ }
984
+ ]
985
+ }
986
+ )
987
+ }
988
+
959
989
  const waUploadToServer = Utils_1.getWAUploadToServer(config, refreshMediaConn)
960
990
 
961
991
  const waitForMsgMediaUpdate = Utils_1.bindWaitForEvent(ev, 'messages.media-update')
@@ -977,6 +1007,7 @@ const makeMessagesSocket = (config) => {
977
1007
  createParticipantNodes,
978
1008
  sendPeerDataOperationMessage,
979
1009
  messageRetryManager,
1010
+ updateMemberLabel,
980
1011
  updateMediaMessage: async (message) => {
981
1012
  const content = Utils_1.assertMediaContent(message.message)
982
1013
  const mediaKey = content.mediaKey
@@ -0,0 +1,20 @@
1
+ import type { proto } from '../../WAProto'
2
+
3
+ export type DayOfWeekBussines = 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'
4
+
5
+ export type HoursDay =
6
+ | { day: DayOfWeekBussines; mode: 'specific_hours'; openTimeInMinutes: string; closeTimeInMinutes: string }
7
+ | { day: DayOfWeekBussines; mode: 'open_24h' | 'appointment_only' }
8
+
9
+ export type UpdateBussinesProfileProps = {
10
+ address?: string
11
+ websites?: string[]
12
+ email?: string
13
+ description?: string
14
+ hours?: {
15
+ timezone: string
16
+ days: HoursDay[]
17
+ }
18
+ }
19
+
20
+ export type QuickReplyAction = proto.SyncActionValue.IQuickReplyAction & { timestamp?: string }
@@ -0,0 +1,2 @@
1
+ "use strict"
2
+ Object.defineProperty(exports, "__esModule", { value: true })
@@ -6,6 +6,7 @@ import type { LabelActionBody } from './Label'
6
6
  import type { ChatLabelAssociationActionBody } from './LabelAssociation'
7
7
  import type { MessageLabelAssociationActionBody } from './LabelAssociation'
8
8
  import type { MinimalMessage, WAMessageKey } from './Message'
9
+ import type { QuickReplyAction } from './Bussines'
9
10
 
10
11
  /** privacy settings in WhatsApp Web */
11
12
  export type WAPrivacyValue = 'all' | 'contacts' | 'contact_blacklist' | 'none'
@@ -122,6 +123,8 @@ export type ChatModification = {
122
123
  addMessageLabel: MessageLabelAssociationActionBody
123
124
  } | {
124
125
  removeMessageLabel: MessageLabelAssociationActionBody
126
+ } | {
127
+ quickReply: QuickReplyAction
125
128
  }
126
129
 
127
130
  export type InitialReceivedChatsState = {
@@ -96,6 +96,14 @@ export type BaileysEventMap = {
96
96
  action: RequestJoinAction
97
97
  method: RequestJoinMethod
98
98
  }
99
+ /* update the labels assigned to a group participant */
100
+ 'group.member-tag.update': {
101
+ groupId: string
102
+ participant: string
103
+ participantAlt?: string
104
+ label: string
105
+ messageTimestamp?: number
106
+ }
99
107
  'newsletter.reaction': {
100
108
  id: string
101
109
  newsletter_server_id: string
@@ -11,6 +11,7 @@ export * from './Events'
11
11
  export * from './Product'
12
12
  export * from './Call'
13
13
  export * from './Signal'
14
+ export * from './Bussines'
14
15
 
15
16
  import { AuthenticationState } from './Auth'
16
17
  import { SocketConfig } from './Socket'
@@ -514,6 +514,23 @@ const chatModificationToAppPatch = (mod, jid) => {
514
514
  operation: OP.SET,
515
515
  }
516
516
  }
517
+ else if ('quickReply' in mod) {
518
+ patch = {
519
+ syncAction: {
520
+ quickReplyAction: {
521
+ count: 0,
522
+ deleted: mod.quickReply.deleted || false,
523
+ keywords: [],
524
+ message: mod.quickReply.message || '',
525
+ shortcut: mod.quickReply.shortcut || ''
526
+ }
527
+ },
528
+ index: ['quick_reply', mod.quickReply.timestamp || String(Math.floor(Date.now() / 1000))],
529
+ type: 'regular',
530
+ apiVersion: 2,
531
+ operation: OP.SET
532
+ }
533
+ }
517
534
  else if ('addLabel' in mod) {
518
535
  patch = {
519
536
  syncAction: {
@@ -13,3 +13,5 @@ export interface VersionInfo {
13
13
  export declare const checkNpmVersion: (packageName: string, currentVersion: string) => Promise<VersionInfo | null>;
14
14
  //# sourceMappingURL=check-npm-version.d.ts.map
15
15
 
16
+
17
+
@@ -50,3 +50,5 @@ const checkNpmVersion = (packageName, currentVersion) => {
50
50
  exports.checkNpmVersion = checkNpmVersion;
51
51
  //# sourceMappingURL=check-npm-version.js.map
52
52
 
53
+
54
+
@@ -80,3 +80,5 @@ export declare class MessageRetryManager {
80
80
  private removeRecentMessage;
81
81
  }
82
82
 
83
+
84
+
@@ -175,3 +175,5 @@ class MessageRetryManager {
175
175
  exports.MessageRetryManager = MessageRetryManager;
176
176
  //# sourceMappingURL=message-retry-manager.js.map
177
177
 
178
+
179
+
@@ -249,6 +249,18 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
249
249
  update_time: protocolMsg.limitSharing.limitSharingSettingTimestamp
250
250
  })
251
251
  break
252
+ case WAProto_1.proto.Message.ProtocolMessage.Type.GROUP_MEMBER_LABEL_CHANGE:
253
+ const labelAssociationMsg = protocolMsg.memberLabel
254
+ if (labelAssociationMsg?.label) {
255
+ ev.emit('group.member-tag.update', {
256
+ groupId: chat.id,
257
+ label: labelAssociationMsg.label,
258
+ participant: message.key.participant,
259
+ participantAlt: message.key.participantAlt,
260
+ messageTimestamp: Number(message.messageTimestamp)
261
+ })
262
+ }
263
+ break
252
264
  }
253
265
  }
254
266
  else if (content?.reactionMessage) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neelegirl/baileys",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "WhatsApp API for wa-api, a multi-device WhatsApp Web API client",
5
5
  "keywords": [
6
6
  "whatsapp",