mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: add contextInfo support
This commit is contained in:
@@ -52,6 +52,10 @@ type Mentionable = {
|
|||||||
/** list of jids that are mentioned in the accompanying text */
|
/** list of jids that are mentioned in the accompanying text */
|
||||||
mentions?: string[]
|
mentions?: string[]
|
||||||
}
|
}
|
||||||
|
type Contextable = {
|
||||||
|
/** add contextInfo to the message */
|
||||||
|
contextInfo?: proto.IContextInfo
|
||||||
|
}
|
||||||
type ViewOnce = {
|
type ViewOnce = {
|
||||||
viewOnce?: boolean
|
viewOnce?: boolean
|
||||||
}
|
}
|
||||||
@@ -98,13 +102,13 @@ export type AnyMediaMessageContent = (
|
|||||||
image: WAMediaUpload
|
image: WAMediaUpload
|
||||||
caption?: string
|
caption?: string
|
||||||
jpegThumbnail?: string
|
jpegThumbnail?: string
|
||||||
} & Mentionable & Buttonable & Templatable & WithDimensions)
|
} & Mentionable & Contextable & Buttonable & Templatable & WithDimensions)
|
||||||
| ({
|
| ({
|
||||||
video: WAMediaUpload
|
video: WAMediaUpload
|
||||||
caption?: string
|
caption?: string
|
||||||
gifPlayback?: boolean
|
gifPlayback?: boolean
|
||||||
jpegThumbnail?: string
|
jpegThumbnail?: string
|
||||||
} & Mentionable & Buttonable & Templatable & WithDimensions)
|
} & Mentionable & Contextable & Buttonable & Templatable & WithDimensions)
|
||||||
| {
|
| {
|
||||||
audio: WAMediaUpload
|
audio: WAMediaUpload
|
||||||
/** if set to true, will send as a `voice note` */
|
/** if set to true, will send as a `voice note` */
|
||||||
@@ -120,7 +124,7 @@ export type AnyMediaMessageContent = (
|
|||||||
mimetype: string
|
mimetype: string
|
||||||
fileName?: string
|
fileName?: string
|
||||||
caption?: string
|
caption?: string
|
||||||
} & Buttonable & Templatable))
|
} & Contextable & Buttonable & Templatable))
|
||||||
& { mimetype?: string } & Editable
|
& { mimetype?: string } & Editable
|
||||||
|
|
||||||
export type ButtonReplyInfo = {
|
export type ButtonReplyInfo = {
|
||||||
@@ -138,11 +142,11 @@ export type AnyRegularMessageContent = (
|
|||||||
text: string
|
text: string
|
||||||
linkPreview?: WAUrlInfo | null
|
linkPreview?: WAUrlInfo | null
|
||||||
}
|
}
|
||||||
& Mentionable & Buttonable & Templatable & Listable & Editable)
|
& Mentionable & Contextable & Buttonable & Templatable & Listable & Editable)
|
||||||
| AnyMediaMessageContent
|
| AnyMediaMessageContent
|
||||||
| ({
|
| ({
|
||||||
poll: PollMessageOptions
|
poll: PollMessageOptions
|
||||||
} & Mentionable & Buttonable & Templatable & Editable)
|
} & Mentionable & Contextable & Buttonable & Templatable & Editable)
|
||||||
| {
|
| {
|
||||||
contacts: {
|
contacts: {
|
||||||
displayName?: string
|
displayName?: string
|
||||||
|
|||||||
@@ -498,6 +498,12 @@ export const generateWAMessageContent = async(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if('contextInfo' in message && !!message.contextInfo) {
|
||||||
|
const [messageType] = Object.keys(m)
|
||||||
|
m[messageType] = m[messageType] || {}
|
||||||
|
m[messageType].contextInfo = message.contextInfo
|
||||||
|
}
|
||||||
|
|
||||||
return WAProto.Message.fromObject(m)
|
return WAProto.Message.fromObject(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user