@kyyinfinite/baileys 1.0.0 → 2.1.0
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 +582 -1340
- package/WAProto/WAProto.proto +360 -916
- package/WAProto/fix-imports.js +22 -18
- package/WAProto/index.d.ts +14015 -0
- package/WAProto/index.js +47122 -81757
- package/engine-requirements.js +10 -0
- package/lib/Defaults/index.d.ts +15 -14
- package/lib/Defaults/index.d.ts.map +1 -1
- package/lib/Defaults/index.js +99 -107
- package/lib/Defaults/index.js.map +1 -1
- package/lib/Kyyinfinite/AIRich.js +2041 -0
- package/lib/Kyyinfinite/BaseBuilder.js +64 -0
- package/lib/Kyyinfinite/Button.js +341 -0
- package/lib/Kyyinfinite/ButtonV2.js +175 -0
- package/lib/Kyyinfinite/Carousel.js +125 -0
- package/lib/Kyyinfinite/Foad.js +542 -0
- package/lib/Kyyinfinite/Foad2.js +466 -0
- package/lib/Kyyinfinite/Simple/AIBuilder.js +18 -0
- package/lib/Kyyinfinite/Simple/BuilderFactories.js +17 -0
- package/lib/Kyyinfinite/Simple/ButtonBuilder.js +107 -0
- package/lib/Kyyinfinite/Simple/CardBuilder.js +179 -0
- package/lib/Kyyinfinite/Simple/CarouselBuilder.js +97 -0
- package/lib/Kyyinfinite/Simple/FoadBuilder.js +18 -0
- package/lib/Kyyinfinite/Simple/KyyMessage.js +46 -0
- package/lib/Kyyinfinite/Simple/MediaBuilder.js +41 -0
- package/lib/Kyyinfinite/Simple/MessageBuilder.js +55 -0
- package/lib/Kyyinfinite/Simple/MessageTypesBuilder.js +3 -0
- package/lib/Kyyinfinite/Simple/SimpleBuilder.js +28 -0
- package/lib/Kyyinfinite/Simple/SimpleClient.js +120 -0
- package/lib/Kyyinfinite/Simple/TextBuilder.js +28 -0
- package/lib/Kyyinfinite/Simple/UniversalMediaBuilder.js +21 -0
- package/lib/Kyyinfinite/Simple/index.d.ts +232 -0
- package/lib/Kyyinfinite/Simple/index.js +38 -0
- package/lib/Kyyinfinite/Simple/jid.js +55 -0
- package/lib/Kyyinfinite/Simple/messageUtils.js +49 -0
- package/lib/Kyyinfinite/Simple/parseMessage.js +55 -0
- package/lib/Kyyinfinite/Toolkit.js +453 -0
- package/lib/Kyyinfinite/constants.js +1 -0
- package/lib/Kyyinfinite/errors.js +39 -0
- package/lib/Kyyinfinite/index.d.ts +2 -0
- package/lib/Kyyinfinite/index.js +2 -0
- package/lib/Kyyinfinite/wrapper.d.ts +2 -0
- package/lib/Kyyinfinite/wrapper.js +10 -0
- package/lib/Signal/Group/group_cipher.js.map +1 -1
- package/lib/Signal/Group/keyhelper.d.ts.map +1 -1
- package/lib/Signal/Group/keyhelper.js.map +1 -1
- package/lib/Signal/Group/sender-chain-key.js.map +1 -1
- package/lib/Signal/Group/sender-key-message.js.map +1 -1
- package/lib/Signal/Group/sender-message-key.js.map +1 -1
- package/lib/Signal/libsignal.d.ts.map +1 -1
- package/lib/Signal/libsignal.js +45 -17
- package/lib/Signal/libsignal.js.map +1 -1
- package/lib/Signal/lid-mapping.d.ts +4 -0
- package/lib/Signal/lid-mapping.d.ts.map +1 -1
- package/lib/Signal/lid-mapping.js +6 -0
- package/lib/Signal/lid-mapping.js.map +1 -1
- package/lib/Socket/business.d.ts +213 -532
- package/lib/Socket/business.d.ts.map +1 -1
- package/lib/Socket/business.js +358 -401
- package/lib/Socket/chats.d.ts +16 -2
- package/lib/Socket/chats.d.ts.map +1 -1
- package/lib/Socket/chats.js +247 -40
- package/lib/Socket/chats.js.map +1 -1
- package/lib/Socket/communities.d.ts +269 -641
- package/lib/Socket/communities.d.ts.map +1 -1
- package/lib/Socket/groups.d.ts +13 -2
- package/lib/Socket/groups.d.ts.map +1 -1
- package/lib/Socket/groups.js +21 -1
- package/lib/Socket/groups.js.map +1 -1
- package/lib/Socket/index.d.ts +255 -631
- package/lib/Socket/index.d.ts.map +1 -1
- package/lib/Socket/index.js +9 -10
- package/lib/Socket/index.js.map +1 -1
- package/lib/Socket/messages-recv.d.ts +23 -58
- package/lib/Socket/messages-recv.d.ts.map +1 -1
- package/lib/Socket/messages-recv.js +645 -181
- package/lib/Socket/messages-recv.js.map +1 -1
- package/lib/Socket/messages-send.d.ts +195 -575
- package/lib/Socket/messages-send.d.ts.map +1 -1
- package/lib/Socket/messages-send.js +1099 -1549
- package/lib/Socket/messages-send.js.map +1 -1
- package/lib/Socket/mex.d.ts.map +1 -1
- package/lib/Socket/mex.js +2 -8
- package/lib/Socket/mex.js.map +1 -1
- package/lib/Socket/newsletter.d.ts +11 -18
- package/lib/Socket/newsletter.d.ts.map +1 -1
- package/lib/Socket/newsletter.js +167 -302
- package/lib/Socket/newsletter.js.map +1 -1
- package/lib/Socket/socket.d.ts +6 -2
- package/lib/Socket/socket.d.ts.map +1 -1
- package/lib/Socket/socket.js +59 -25
- package/lib/Socket/socket.js.map +1 -1
- package/lib/Types/Auth.d.ts +1 -0
- package/lib/Types/Auth.d.ts.map +1 -1
- package/lib/Types/Bussines.d.ts +22 -34
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Call.d.ts.map +1 -1
- package/lib/Types/Chat.d.ts +1 -0
- package/lib/Types/Chat.d.ts.map +1 -1
- package/lib/Types/Contact.d.ts +2 -0
- package/lib/Types/Contact.d.ts.map +1 -1
- package/lib/Types/Events.d.ts +20 -1
- package/lib/Types/Events.d.ts.map +1 -1
- package/lib/Types/GroupMetadata.d.ts +4 -1
- package/lib/Types/GroupMetadata.d.ts.map +1 -1
- package/lib/Types/Message.d.ts +239 -341
- package/lib/Types/Message.d.ts.map +1 -1
- package/lib/Types/Message.js.map +1 -1
- package/lib/Types/{Newsletter.d.ts → Mex.d.ts} +11 -5
- package/lib/Types/Mex.d.ts.map +1 -0
- package/lib/Types/{Newsletter.js → Mex.js} +9 -3
- package/lib/Types/Mex.js.map +1 -0
- package/lib/Types/Signal.d.ts +12 -1
- package/lib/Types/Signal.d.ts.map +1 -1
- package/lib/Types/Socket.d.ts +126 -148
- package/lib/Types/Socket.d.ts.map +1 -1
- package/lib/Types/State.d.ts +58 -0
- package/lib/Types/State.d.ts.map +1 -1
- package/lib/Types/State.js +43 -0
- package/lib/Types/State.js.map +1 -1
- package/lib/Types/index.d.ts +52 -52
- package/lib/Types/index.d.ts.map +1 -1
- package/lib/Types/index.js +23 -30
- package/lib/Types/index.js.map +1 -1
- package/lib/Utils/auth-utils.d.ts +5 -0
- package/lib/Utils/auth-utils.d.ts.map +1 -1
- package/lib/Utils/auth-utils.js +12 -0
- package/lib/Utils/auth-utils.js.map +1 -1
- package/lib/Utils/browser-utils.d.ts.map +1 -1
- package/lib/Utils/browser-utils.js +1 -0
- package/lib/Utils/browser-utils.js.map +1 -1
- package/lib/Utils/chat-utils.d.ts +34 -4
- package/lib/Utils/chat-utils.d.ts.map +1 -1
- package/lib/Utils/chat-utils.js +80 -20
- package/lib/Utils/chat-utils.js.map +1 -1
- package/lib/Utils/companion-reg-client-utils.d.ts +17 -0
- package/lib/Utils/companion-reg-client-utils.d.ts.map +1 -0
- package/lib/Utils/companion-reg-client-utils.js +35 -0
- package/lib/Utils/companion-reg-client-utils.js.map +1 -0
- package/lib/Utils/crypto.d.ts +12 -12
- package/lib/Utils/crypto.d.ts.map +1 -1
- package/lib/Utils/crypto.js.map +1 -1
- package/lib/Utils/decode-wa-message.d.ts +18 -0
- package/lib/Utils/decode-wa-message.d.ts.map +1 -1
- package/lib/Utils/decode-wa-message.js +34 -0
- package/lib/Utils/decode-wa-message.js.map +1 -1
- package/lib/Utils/event-buffer.d.ts +2 -0
- package/lib/Utils/event-buffer.d.ts.map +1 -1
- package/lib/Utils/event-buffer.js +49 -1
- package/lib/Utils/event-buffer.js.map +1 -1
- package/lib/Utils/generics.d.ts +3 -2
- package/lib/Utils/generics.d.ts.map +1 -1
- package/lib/Utils/generics.js +10 -1
- package/lib/Utils/generics.js.map +1 -1
- package/lib/Utils/history.d.ts +2 -0
- package/lib/Utils/history.d.ts.map +1 -1
- package/lib/Utils/history.js +12 -9
- package/lib/Utils/history.js.map +1 -1
- package/lib/Utils/identity-change-handler.d.ts +7 -0
- package/lib/Utils/identity-change-handler.d.ts.map +1 -1
- package/lib/Utils/identity-change-handler.js +1 -0
- package/lib/Utils/identity-change-handler.js.map +1 -1
- package/lib/Utils/index.d.ts +22 -25
- package/lib/Utils/index.d.ts.map +1 -1
- package/lib/Utils/index.js +2 -4
- package/lib/Utils/index.js.map +1 -1
- package/lib/Utils/link-preview.js +2 -2
- package/lib/Utils/link-preview.js.map +1 -1
- package/lib/Utils/logger.d.ts +1 -2
- package/lib/Utils/logger.d.ts.map +1 -1
- package/lib/Utils/message-retry-manager.d.ts +5 -0
- package/lib/Utils/message-retry-manager.d.ts.map +1 -1
- package/lib/Utils/message-retry-manager.js +40 -0
- package/lib/Utils/message-retry-manager.js.map +1 -1
- package/lib/Utils/messages-media.d.ts +16 -13
- package/lib/Utils/messages-media.d.ts.map +1 -1
- package/lib/Utils/messages-media.js +85 -79
- package/lib/Utils/messages-media.js.map +1 -1
- package/lib/Utils/messages.d.ts +1 -1
- package/lib/Utils/messages.d.ts.map +1 -1
- package/lib/Utils/messages.js +751 -1096
- package/lib/Utils/messages.js.map +1 -1
- package/lib/Utils/noise-handler.d.ts +1 -1
- package/lib/Utils/process-message.d.ts.map +1 -1
- package/lib/Utils/process-message.js +103 -1
- package/lib/Utils/process-message.js.map +1 -1
- package/lib/Utils/signal.d.ts +13 -0
- package/lib/Utils/signal.d.ts.map +1 -1
- package/lib/Utils/signal.js +42 -0
- package/lib/Utils/signal.js.map +1 -1
- package/lib/Utils/sync-action-utils.d.ts.map +1 -1
- package/lib/Utils/sync-action-utils.js +1 -0
- package/lib/Utils/sync-action-utils.js.map +1 -1
- package/lib/Utils/tc-token-utils.d.ts +26 -1
- package/lib/Utils/tc-token-utils.d.ts.map +1 -1
- package/lib/Utils/tc-token-utils.js +151 -5
- package/lib/Utils/tc-token-utils.js.map +1 -1
- package/lib/Utils/validate-connection.d.ts.map +1 -1
- package/lib/Utils/validate-connection.js +12 -2
- package/lib/Utils/validate-connection.js.map +1 -1
- package/lib/WABinary/decode.d.ts +1 -1
- package/lib/WABinary/decode.d.ts.map +1 -1
- package/lib/WABinary/generic-utils.d.ts +1 -3
- package/lib/WABinary/generic-utils.d.ts.map +1 -1
- package/lib/WABinary/generic-utils.js +0 -78
- package/lib/WABinary/generic-utils.js.map +1 -1
- package/lib/WAM/encode.d.ts +1 -1
- package/lib/WAM/encode.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +26 -3
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -1
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/index.d.ts +1 -0
- package/lib/WAUSync/Protocols/index.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/index.js +1 -0
- package/lib/WAUSync/Protocols/index.js.map +1 -1
- package/lib/WAUSync/USyncQuery.d.ts +1 -0
- package/lib/WAUSync/USyncQuery.d.ts.map +1 -1
- package/lib/WAUSync/USyncQuery.js +6 -2
- package/lib/WAUSync/USyncQuery.js.map +1 -1
- package/lib/WAUSync/USyncUser.d.ts +4 -0
- package/lib/WAUSync/USyncUser.d.ts.map +1 -1
- package/lib/WAUSync/USyncUser.js +8 -0
- package/lib/WAUSync/USyncUser.js.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +13 -12
- package/lib/index.js.map +1 -1
- package/package.json +104 -23
- package/test/core.test.js +38 -0
- package/test/simple-api.test.js +183 -0
- package/lib/Socket/dugong.d.ts +0 -130
- package/lib/Socket/dugong.d.ts.map +0 -1
- package/lib/Socket/dugong.js +0 -768
- package/lib/Socket/dugong.js.map +0 -1
- package/lib/Types/Newsletter.d.ts.map +0 -1
- package/lib/Types/Newsletter.js.map +0 -1
- package/lib/Utils/kyy-features.d.ts +0 -158
- package/lib/Utils/kyy-features.js +0 -365
- package/lib/Utils/rich-messages.d.ts +0 -277
- package/lib/Utils/rich-messages.d.ts.map +0 -1
- package/lib/Utils/rich-messages.js +0 -1144
- package/lib/Utils/rich-messages.js.map +0 -1
- package/lib/Utils/sticker-pack.d.ts +0 -10
- package/lib/Utils/sticker-pack.js +0 -111
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { prepareWAMessageMedia } from '../../Utils/messages.js'
|
|
2
|
+
|
|
3
|
+
export class CardBuilder {
|
|
4
|
+
constructor(parent, options = {}) {
|
|
5
|
+
this.parent = parent
|
|
6
|
+
this.card = {
|
|
7
|
+
header: {
|
|
8
|
+
hasMediaAttachment: false
|
|
9
|
+
},
|
|
10
|
+
body: { text: '' },
|
|
11
|
+
footer: { text: '' },
|
|
12
|
+
nativeFlowMessage: { buttons: [] }
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (options && typeof options === 'object') {
|
|
16
|
+
if (options.image !== undefined) this.image(options.image, options.imageOptions || {})
|
|
17
|
+
if (options.video !== undefined) this.video(options.video, options.videoOptions || {})
|
|
18
|
+
this.payload(options)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
title(value) {
|
|
23
|
+
this.card.header.title = String(value ?? '')
|
|
24
|
+
return this
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
body(value) {
|
|
28
|
+
this.card.body.text = String(value ?? '')
|
|
29
|
+
return this
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
text(value) {
|
|
33
|
+
return this.body(value)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
footer(value) {
|
|
37
|
+
this.card.footer.text = String(value ?? '')
|
|
38
|
+
return this
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
image(media, options = {}) {
|
|
42
|
+
this.card._media = { type: 'image', media, options }
|
|
43
|
+
return this
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
video(media, options = {}) {
|
|
47
|
+
this.card._media = { type: 'video', media, options }
|
|
48
|
+
return this
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
media(type, media, options = {}) {
|
|
52
|
+
if (type !== 'image' && type !== 'video') {
|
|
53
|
+
throw new TypeError('Carousel card media must be image or video')
|
|
54
|
+
}
|
|
55
|
+
return this[type](media, options)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
button(displayText, id, options = {}) {
|
|
59
|
+
return this._button('quick_reply', {
|
|
60
|
+
display_text: displayText,
|
|
61
|
+
id,
|
|
62
|
+
...options
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
reply(displayText, id, options = {}) {
|
|
67
|
+
return this.button(displayText, id, options)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
quickReply(displayText, id, options = {}) {
|
|
71
|
+
return this.button(displayText, id, options)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
url(displayText, url, options = {}) {
|
|
75
|
+
return this._button('cta_url', {
|
|
76
|
+
display_text: displayText,
|
|
77
|
+
url,
|
|
78
|
+
...options
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
copy(displayText, copyCode, options = {}) {
|
|
83
|
+
return this._button('cta_copy', {
|
|
84
|
+
display_text: displayText,
|
|
85
|
+
copy_code: copyCode,
|
|
86
|
+
...options
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
coppy(displayText, copyCode, options = {}) {
|
|
91
|
+
return this.copy(displayText, copyCode, options)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
call(displayText, phone, options = {}) {
|
|
95
|
+
return this._button('cta_call', {
|
|
96
|
+
display_text: displayText,
|
|
97
|
+
id: phone,
|
|
98
|
+
...options
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
buttons(buttons = []) {
|
|
103
|
+
if (!Array.isArray(buttons)) {
|
|
104
|
+
throw new TypeError('Buttons must be an array')
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
this.card.nativeFlowMessage.buttons.push(...buttons)
|
|
108
|
+
return this
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
rawButton(button) {
|
|
112
|
+
if (!button || typeof button !== 'object' || Array.isArray(button)) {
|
|
113
|
+
throw new TypeError('Button must be a plain object')
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
this.card.nativeFlowMessage.buttons.push(button)
|
|
117
|
+
return this
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
context(value) {
|
|
121
|
+
this.card.contextInfo = value || {}
|
|
122
|
+
return this
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
payload(value) {
|
|
126
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
127
|
+
return this
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const { header, body, footer, nativeFlowMessage, image, video, imageOptions, videoOptions, ...extra } = value
|
|
131
|
+
|
|
132
|
+
Object.assign(this.card, extra)
|
|
133
|
+
if (header) Object.assign(this.card.header, header)
|
|
134
|
+
if (body) Object.assign(this.card.body, body)
|
|
135
|
+
if (footer) Object.assign(this.card.footer, footer)
|
|
136
|
+
if (nativeFlowMessage) Object.assign(this.card.nativeFlowMessage, nativeFlowMessage)
|
|
137
|
+
|
|
138
|
+
return this
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
_button(name, params) {
|
|
142
|
+
this.card.nativeFlowMessage.buttons.push({
|
|
143
|
+
name,
|
|
144
|
+
buttonParamsJson: JSON.stringify(params)
|
|
145
|
+
})
|
|
146
|
+
return this
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async build() {
|
|
150
|
+
const { _media, ...card } = this.card
|
|
151
|
+
|
|
152
|
+
if (!_media) {
|
|
153
|
+
throw new Error('Carousel card requires image() or video()')
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const media = {
|
|
157
|
+
[_media.type]: _media.media,
|
|
158
|
+
..._media.options
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const prepared = await prepareWAMessageMedia(media, {
|
|
162
|
+
upload: this.parent.sock.waUploadToServer
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
card.header.hasMediaAttachment = true
|
|
166
|
+
card.header[`${_media.type}Message`] = prepared[`${_media.type}Message`]
|
|
167
|
+
|
|
168
|
+
return card
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
add() {
|
|
172
|
+
this.parent._cards.push(this)
|
|
173
|
+
return this.parent
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
end() {
|
|
177
|
+
return this.add()
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Carousel } from '../Carousel.js'
|
|
2
|
+
import { CardBuilder } from './CardBuilder.js'
|
|
3
|
+
|
|
4
|
+
const aliases = {
|
|
5
|
+
title: 'setTitle',
|
|
6
|
+
subtitle: 'setSubtitle',
|
|
7
|
+
body: 'setBody',
|
|
8
|
+
text: 'setBody',
|
|
9
|
+
footer: 'setFooter',
|
|
10
|
+
context: 'setContextInfo',
|
|
11
|
+
payload: 'addPayload'
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class CarouselBuilder {
|
|
15
|
+
constructor(sock, ...args) {
|
|
16
|
+
if (!sock) throw new Error('Socket is required')
|
|
17
|
+
|
|
18
|
+
this.sock = sock
|
|
19
|
+
this.raw = new Carousel(sock, ...args)
|
|
20
|
+
this._cards = []
|
|
21
|
+
this._rawCards = []
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
card(options = {}) {
|
|
25
|
+
return new CardBuilder(this, options)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
addCard(card) {
|
|
29
|
+
if (card instanceof CardBuilder) {
|
|
30
|
+
if (!this._cards.includes(card)) this._cards.push(card)
|
|
31
|
+
return this
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
this._rawCards.push(card)
|
|
35
|
+
return this
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
cards(cards = []) {
|
|
39
|
+
if (!Array.isArray(cards)) {
|
|
40
|
+
throw new TypeError('Cards must be an array')
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
for (const card of cards) this.addCard(card)
|
|
44
|
+
return this
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
clear() {
|
|
48
|
+
this._cards = []
|
|
49
|
+
this._rawCards = []
|
|
50
|
+
this.raw._cards = []
|
|
51
|
+
return this
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async _prepareCards() {
|
|
55
|
+
this.raw._cards = []
|
|
56
|
+
|
|
57
|
+
for (const card of this._rawCards) {
|
|
58
|
+
this.raw.addCard(card)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
for (const card of this._cards) {
|
|
62
|
+
this.raw.addCard(await card.build())
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return this.raw
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async build(jid, options = {}) {
|
|
69
|
+
await this._prepareCards()
|
|
70
|
+
return this.raw.build(jid, options)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async send(jid, options = {}) {
|
|
74
|
+
await this._prepareCards()
|
|
75
|
+
return this.raw.send(jid, options)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
loadFrom(message) {
|
|
79
|
+
this.raw.loadFrom(message)
|
|
80
|
+
this._cards = []
|
|
81
|
+
this._rawCards = [...this.raw._cards]
|
|
82
|
+
return this
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
for (const [name, method] of Object.entries(aliases)) {
|
|
87
|
+
CarouselBuilder.prototype[name] = function (...args) {
|
|
88
|
+
const value = this.raw[method](...args)
|
|
89
|
+
return value === this.raw ? this : value
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export { Carousel, CardBuilder }
|
|
94
|
+
|
|
95
|
+
export function createCarouselBuilder(sock, ...args) {
|
|
96
|
+
return new CarouselBuilder(sock, ...args)
|
|
97
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Foad } from '../Foad.js'
|
|
2
|
+
import { Foad2 } from '../Foad2.js'
|
|
3
|
+
import { proxyBuilder } from './SimpleBuilder.js'
|
|
4
|
+
|
|
5
|
+
const foadAliases = {
|
|
6
|
+
title: 'addTitle',
|
|
7
|
+
html: 'addHtml'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function createFoadBuilder(sock, ...args) {
|
|
11
|
+
return proxyBuilder({ sock, raw: new Foad(sock, ...args) }, foadAliases)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function createFoad2Builder(sock, ...args) {
|
|
15
|
+
return proxyBuilder({ sock, raw: new Foad2(sock, ...args) }, foadAliases)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { Foad, Foad2 }
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { downloadMediaMessage } from '../../Utils/messages.js'
|
|
2
|
+
|
|
3
|
+
export class KyyMessage {
|
|
4
|
+
constructor(sock, message) {
|
|
5
|
+
if (!sock) throw new Error('Socket is required')
|
|
6
|
+
if (!message) throw new TypeError('A WhatsApp message is required')
|
|
7
|
+
this.sock = sock
|
|
8
|
+
this.message = message
|
|
9
|
+
this.key = message.key || message
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get id() { return this.key?.id }
|
|
13
|
+
get jid() { return this.key?.remoteJid }
|
|
14
|
+
get sender() { return this.key?.participant || this.key?.remoteJid }
|
|
15
|
+
get fromMe() { return Boolean(this.key?.fromMe) }
|
|
16
|
+
|
|
17
|
+
reply(content, options = {}) {
|
|
18
|
+
const message = typeof content === 'string' ? { text: content } : { ...(content || {}) }
|
|
19
|
+
const sendOptions = { ...(options || {}), quoted: this.message }
|
|
20
|
+
return this.sock.sendMessage(this.jid, message, sendOptions)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
react(text = '') {
|
|
24
|
+
return this.sock.sendMessage(this.jid, { react: { text: String(text), key: this.key } })
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
edit(content, options = {}) {
|
|
28
|
+
const message = typeof content === 'string' ? { text: content } : { ...(content || {}) }
|
|
29
|
+
message.edit = this.key
|
|
30
|
+
return this.sock.sendMessage(this.jid, message, options)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
delete() {
|
|
34
|
+
return this.sock.sendMessage(this.jid, { delete: this.key })
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
forward(jid = this.jid, force = false) {
|
|
38
|
+
return this.sock.sendMessage(jid, { forward: this.message, force })
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
download(type = 'buffer', options = {}, ctx) {
|
|
42
|
+
return downloadMediaMessage(this.message, type, options, ctx)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
raw() { return this.message }
|
|
46
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { applyAutoMentions, resolveMedia } from './messageUtils.js'
|
|
2
|
+
|
|
3
|
+
export class MediaBuilder {
|
|
4
|
+
constructor(sock, type, media) {
|
|
5
|
+
this.sock = sock
|
|
6
|
+
this.type = type
|
|
7
|
+
this.content = { [type]: resolveMedia(media) }
|
|
8
|
+
this._autoMentions = true
|
|
9
|
+
this._sendOptions = {}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
caption(value) { this.content.caption = String(value ?? ''); return this }
|
|
13
|
+
fileName(value) { this.content.fileName = String(value ?? ''); return this }
|
|
14
|
+
mimetype(value) { this.content.mimetype = value; return this }
|
|
15
|
+
context(value) { this.content.contextInfo = value || {}; return this }
|
|
16
|
+
mentions(value) { this.content.mentions = Array.isArray(value) ? [...value] : []; return this }
|
|
17
|
+
autoMentions(value = true) { this._autoMentions = Boolean(value); return this }
|
|
18
|
+
quoted(message) { this._sendOptions.quoted = message; return this }
|
|
19
|
+
payload(value) { Object.assign(this.content, value || {}); return this }
|
|
20
|
+
viewOnce(value = true) { this.content.viewOnce = Boolean(value); return this }
|
|
21
|
+
ptt(value = true) { this.content.ptt = Boolean(value); return this }
|
|
22
|
+
voice(value = true) { return this.ptt(value) }
|
|
23
|
+
ptv(value = true) { this.content.ptv = Boolean(value); return this }
|
|
24
|
+
videoNote(value = true) { return this.ptv(value) }
|
|
25
|
+
gif(value = true) { this.content.gifPlayback = Boolean(value); return this }
|
|
26
|
+
animated(value = true) { this.content.isAnimated = Boolean(value); return this }
|
|
27
|
+
dimensions(width, height) {
|
|
28
|
+
if (width != null) this.content.width = Number(width)
|
|
29
|
+
if (height != null) this.content.height = Number(height)
|
|
30
|
+
return this
|
|
31
|
+
}
|
|
32
|
+
thumbnail(value) { this.content.jpegThumbnail = value; return this }
|
|
33
|
+
|
|
34
|
+
build() {
|
|
35
|
+
return applyAutoMentions({ ...this.content }, this._autoMentions)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
send(jid, options = {}) {
|
|
39
|
+
return this.sock.sendMessage(jid, this.build(), { ...this._sendOptions, ...(options || {}) })
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { applyAutoMentions, resolveMediaContent } from './messageUtils.js'
|
|
2
|
+
|
|
3
|
+
export class MessageBuilder {
|
|
4
|
+
constructor(sock, content = {}) {
|
|
5
|
+
if (!sock) throw new Error('Socket is required')
|
|
6
|
+
this.sock = sock
|
|
7
|
+
this.content = { ...content }
|
|
8
|
+
this._autoMentions = true
|
|
9
|
+
this._sendOptions = {}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
payload(value) {
|
|
13
|
+
if (!value || typeof value !== 'object') return this
|
|
14
|
+
Object.assign(this.content, value)
|
|
15
|
+
return this
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
context(value) {
|
|
19
|
+
this.content.contextInfo = value || {}
|
|
20
|
+
return this
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
mentions(value) {
|
|
24
|
+
this.content.mentions = Array.isArray(value) ? [...value] : []
|
|
25
|
+
return this
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
autoMentions(value = true) {
|
|
29
|
+
this._autoMentions = Boolean(value)
|
|
30
|
+
return this
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
quoted(message) {
|
|
34
|
+
this._sendOptions.quoted = message
|
|
35
|
+
return this
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
viewOnce(value = true) {
|
|
39
|
+
this.content.viewOnce = Boolean(value)
|
|
40
|
+
return this
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
edit(key) {
|
|
44
|
+
this.content.edit = key
|
|
45
|
+
return this
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
build() {
|
|
49
|
+
return applyAutoMentions(resolveMediaContent({ ...this.content }), this._autoMentions)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
send(jid, options = {}) {
|
|
53
|
+
return this.sock.sendMessage(jid, this.build(), { ...this._sendOptions, ...(options || {}) })
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export class SimpleBuilder {
|
|
2
|
+
constructor(client, factory) {
|
|
3
|
+
if (!client) throw new Error('Socket is required')
|
|
4
|
+
this.sock = client
|
|
5
|
+
this._factory = factory
|
|
6
|
+
this.raw = factory()
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
build(...args) { return this.raw.build(...args) }
|
|
10
|
+
send(...args) { return this.raw.send(...args) }
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function proxyBuilder(builder, aliases = {}) {
|
|
14
|
+
return new Proxy(builder, {
|
|
15
|
+
get(target, prop, receiver) {
|
|
16
|
+
if (prop in target) return Reflect.get(target, prop, receiver)
|
|
17
|
+
const mapped = aliases[prop] || prop
|
|
18
|
+
const raw = target.raw
|
|
19
|
+
if (raw && typeof raw[mapped] === 'function') {
|
|
20
|
+
return (...args) => {
|
|
21
|
+
const value = raw[mapped](...args)
|
|
22
|
+
return value === raw ? receiver : value
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return undefined
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { TextBuilder } from './TextBuilder.js'
|
|
2
|
+
import { MediaBuilder } from './MediaBuilder.js'
|
|
3
|
+
import { MessageBuilder } from './MessageBuilder.js'
|
|
4
|
+
import { createButtonBuilder, createButtonV2Builder } from './ButtonBuilder.js'
|
|
5
|
+
import { createCarouselBuilder } from './CarouselBuilder.js'
|
|
6
|
+
import { createAIBuilder } from './AIBuilder.js'
|
|
7
|
+
import { createFoadBuilder, createFoad2Builder } from './FoadBuilder.js'
|
|
8
|
+
import { Toolkit, Button, ButtonV2, Carousel, AIRich, Foad, Foad2 } from '../wrapper.js'
|
|
9
|
+
import { KyyMessage } from './KyyMessage.js'
|
|
10
|
+
import { UniversalMediaBuilder } from './UniversalMediaBuilder.js'
|
|
11
|
+
import { parseMessage } from './parseMessage.js'
|
|
12
|
+
import { applyAutoMentions, extractMentions, resolveMedia, resolveMediaContent, quotedOptions } from './messageUtils.js'
|
|
13
|
+
import { parseJid, normalizeJid, jidUser, jidServer, jidDevice, isGroupJid, isPrivateJid, isBroadcastJid, isStatusJid, isNewsletterJid, isLidJid, makeJid } from './jid.js'
|
|
14
|
+
|
|
15
|
+
export class SimpleClient {
|
|
16
|
+
constructor(sock) {
|
|
17
|
+
if (!sock || (typeof sock !== 'object' && typeof sock !== 'function')) {
|
|
18
|
+
throw new TypeError('A Baileys socket is required')
|
|
19
|
+
}
|
|
20
|
+
this.sock = sock
|
|
21
|
+
this.raw = Object.freeze({ Toolkit, Button, ButtonV2, Carousel, AIRich, Foad, Foad2 })
|
|
22
|
+
this.wrapper = this.raw
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
text(text = '') { return new TextBuilder(this.sock, text) }
|
|
26
|
+
media(media) { return new UniversalMediaBuilder(this.sock, media) }
|
|
27
|
+
wrapMessage(message) { return new KyyMessage(this.sock, message) }
|
|
28
|
+
parseMessage(message, options = {}) { return parseMessage(message, options) }
|
|
29
|
+
send(jid, content, options = {}) {
|
|
30
|
+
const { autoMentions = true, ...sendOptions } = options || {}
|
|
31
|
+
const message = typeof content === 'string' ? { text: content } : resolveMediaContent({ ...(content || {}) })
|
|
32
|
+
return this.sock.sendMessage(jid, applyAutoMentions(message, autoMentions !== false), sendOptions)
|
|
33
|
+
}
|
|
34
|
+
quoted(message, content, options = {}) {
|
|
35
|
+
return this.send(this.wrapMessage(message).jid, content, quotedOptions(message, options))
|
|
36
|
+
}
|
|
37
|
+
mentions(text) { return extractMentions(text) }
|
|
38
|
+
resolveMedia(media) { return resolveMedia(media) }
|
|
39
|
+
resolveMediaContent(content) { return resolveMediaContent(content) }
|
|
40
|
+
jid(value) { return normalizeJid(value) }
|
|
41
|
+
parseJid(value) { return parseJid(value) }
|
|
42
|
+
jidUser(value) { return jidUser(value) }
|
|
43
|
+
jidServer(value) { return jidServer(value) }
|
|
44
|
+
jidDevice(value) { return jidDevice(value) }
|
|
45
|
+
isGroup(value) { return isGroupJid(value) }
|
|
46
|
+
isPrivate(value) { return isPrivateJid(value) }
|
|
47
|
+
isBroadcast(value) { return isBroadcastJid(value) }
|
|
48
|
+
isStatus(value) { return isStatusJid(value) }
|
|
49
|
+
isNewsletter(value) { return isNewsletterJid(value) }
|
|
50
|
+
isLid(value) { return isLidJid(value) }
|
|
51
|
+
makeJid(user, server = 's.whatsapp.net', device = null) { return makeJid(user, server, device) }
|
|
52
|
+
reply(message, content, options = {}) { return this.wrapMessage(message).reply(content, options) }
|
|
53
|
+
reactTo(message, text = '') { return this.wrapMessage(message).react(text) }
|
|
54
|
+
editMessage(message, content, options = {}) { return this.wrapMessage(message).edit(content, options) }
|
|
55
|
+
deleteMessage(message) { return this.wrapMessage(message).delete() }
|
|
56
|
+
forwardMessage(message, jid, force = false) { return this.wrapMessage(message).forward(jid, force) }
|
|
57
|
+
downloadMessage(message, type = 'buffer', options = {}, ctx) { return this.wrapMessage(message).download(type, options, ctx) }
|
|
58
|
+
image(media) { return new MediaBuilder(this.sock, 'image', media) }
|
|
59
|
+
video(media) { return new MediaBuilder(this.sock, 'video', media) }
|
|
60
|
+
audio(media) { return new MediaBuilder(this.sock, 'audio', media) }
|
|
61
|
+
voice(media) { return new MediaBuilder(this.sock, 'audio', media).ptt(true) }
|
|
62
|
+
document(media) { return new MediaBuilder(this.sock, 'document', media) }
|
|
63
|
+
sticker(media) { return new MediaBuilder(this.sock, 'sticker', media) }
|
|
64
|
+
ptv(media) { return new MediaBuilder(this.sock, 'video', media).ptv(true) }
|
|
65
|
+
gif(media) { return new MediaBuilder(this.sock, 'video', media).gif(true) }
|
|
66
|
+
|
|
67
|
+
message(content = {}) { return new MessageBuilder(this.sock, content) }
|
|
68
|
+
poll(name, values = [], selectableCount = 1) {
|
|
69
|
+
return new MessageBuilder(this.sock, {
|
|
70
|
+
poll: { name, values, selectableCount }
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
event(options = {}) { return new MessageBuilder(this.sock, { event: options }) }
|
|
74
|
+
album(options = {}) { return new MessageBuilder(this.sock, { album: options }) }
|
|
75
|
+
contacts(displayName, contacts = []) {
|
|
76
|
+
return new MessageBuilder(this.sock, {
|
|
77
|
+
contacts: { displayName, contacts }
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
location(location = {}) { return new MessageBuilder(this.sock, { location }) }
|
|
81
|
+
buttonReply(displayText, id, index = 0) {
|
|
82
|
+
return new MessageBuilder(this.sock, {
|
|
83
|
+
buttonReply: { displayText, id, index },
|
|
84
|
+
type: 'plain'
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
listReply(reply = {}) { return new MessageBuilder(this.sock, { listReply: reply }) }
|
|
88
|
+
react(messageKey, text = '') {
|
|
89
|
+
return new MessageBuilder(this.sock, {
|
|
90
|
+
react: { key: messageKey, text }
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
groupInvite(info = {}) { return new MessageBuilder(this.sock, { groupInvite: info }) }
|
|
94
|
+
product(product, options = {}) {
|
|
95
|
+
return new MessageBuilder(this.sock, { product, ...options })
|
|
96
|
+
}
|
|
97
|
+
requestPhoneNumber(value = true) {
|
|
98
|
+
return new MessageBuilder(this.sock, { requestPhoneNumber: Boolean(value) })
|
|
99
|
+
}
|
|
100
|
+
sharePhoneNumber(value = true) {
|
|
101
|
+
return new MessageBuilder(this.sock, { sharePhoneNumber: Boolean(value) })
|
|
102
|
+
}
|
|
103
|
+
pin(messageKey, type, time) {
|
|
104
|
+
const payload = { pin: messageKey, type }
|
|
105
|
+
if (time != null) payload.time = time
|
|
106
|
+
return new MessageBuilder(this.sock, payload)
|
|
107
|
+
}
|
|
108
|
+
forward(message, force = false) {
|
|
109
|
+
return new MessageBuilder(this.sock, { forward: message, force })
|
|
110
|
+
}
|
|
111
|
+
delete(messageKey) { return new MessageBuilder(this.sock, { delete: messageKey }) }
|
|
112
|
+
disappearing(value) { return new MessageBuilder(this.sock, { disappearingMessagesInChat: value }) }
|
|
113
|
+
limitSharing(value = true) { return new MessageBuilder(this.sock, { limitSharing: Boolean(value) }) }
|
|
114
|
+
button(...args) { return createButtonBuilder(this.sock, ...args) }
|
|
115
|
+
buttonV2(...args) { return createButtonV2Builder(this.sock, ...args) }
|
|
116
|
+
carousel(...args) { return createCarouselBuilder(this.sock, ...args) }
|
|
117
|
+
ai(...args) { return createAIBuilder(this.sock, ...args) }
|
|
118
|
+
foad(...args) { return createFoadBuilder(this.sock, ...args) }
|
|
119
|
+
foad2(...args) { return createFoad2Builder(this.sock, ...args) }
|
|
120
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { applyAutoMentions } from './messageUtils.js'
|
|
2
|
+
|
|
3
|
+
export class TextBuilder {
|
|
4
|
+
constructor(sock, text = '') {
|
|
5
|
+
this.sock = sock
|
|
6
|
+
this.content = { text: String(text ?? '') }
|
|
7
|
+
this._autoMentions = true
|
|
8
|
+
this._sendOptions = {}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
text(value) { this.content.text = String(value ?? ''); return this }
|
|
12
|
+
footer(value) { this.content.footer = String(value ?? ''); return this }
|
|
13
|
+
context(value) { this.content.contextInfo = value || {}; return this }
|
|
14
|
+
mentions(value) { this.content.mentions = Array.isArray(value) ? [...value] : []; return this }
|
|
15
|
+
autoMentions(value = true) { this._autoMentions = Boolean(value); return this }
|
|
16
|
+
quoted(message) { this._sendOptions.quoted = message; return this }
|
|
17
|
+
viewOnce(value = true) { this.content.viewOnce = Boolean(value); return this }
|
|
18
|
+
edit(key) { this.content.edit = key; return this }
|
|
19
|
+
payload(value) { Object.assign(this.content, value || {}); return this }
|
|
20
|
+
|
|
21
|
+
build() {
|
|
22
|
+
return applyAutoMentions({ ...this.content }, this._autoMentions)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
send(jid, options = {}) {
|
|
26
|
+
return this.sock.sendMessage(jid, this.build(), { ...this._sendOptions, ...(options || {}) })
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MediaBuilder } from './MediaBuilder.js'
|
|
2
|
+
|
|
3
|
+
export class UniversalMediaBuilder extends MediaBuilder {
|
|
4
|
+
constructor(sock, media) {
|
|
5
|
+
super(sock, 'image', media)
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
_setType(type) {
|
|
9
|
+
const current = this.content[this.type]
|
|
10
|
+
delete this.content[this.type]
|
|
11
|
+
this.type = type
|
|
12
|
+
this.content[type] = current
|
|
13
|
+
return this
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
asImage() { return this._setType('image') }
|
|
17
|
+
asVideo() { return this._setType('video') }
|
|
18
|
+
asAudio() { return this._setType('audio') }
|
|
19
|
+
asDocument() { return this._setType('document') }
|
|
20
|
+
asSticker() { return this._setType('sticker') }
|
|
21
|
+
}
|