mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: Edit messages
Editing of messages natively.
This commit is contained in:
@@ -55,6 +55,7 @@ type Mentionable = {
|
|||||||
type ViewOnce = {
|
type ViewOnce = {
|
||||||
viewOnce?: boolean
|
viewOnce?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
type Buttonable = {
|
type Buttonable = {
|
||||||
/** add buttons to the message */
|
/** add buttons to the message */
|
||||||
buttons?: proto.Message.ButtonsMessage.IButton[]
|
buttons?: proto.Message.ButtonsMessage.IButton[]
|
||||||
@@ -65,6 +66,9 @@ type Templatable = {
|
|||||||
|
|
||||||
footer?: string
|
footer?: string
|
||||||
}
|
}
|
||||||
|
type Editable = {
|
||||||
|
edit?: WAMessageKey
|
||||||
|
}
|
||||||
type Listable = {
|
type Listable = {
|
||||||
/** Sections of the List */
|
/** Sections of the List */
|
||||||
sections?: proto.Message.ListMessage.ISection[]
|
sections?: proto.Message.ListMessage.ISection[]
|
||||||
@@ -117,7 +121,7 @@ export type AnyMediaMessageContent = (
|
|||||||
fileName?: string
|
fileName?: string
|
||||||
caption?: string
|
caption?: string
|
||||||
} & Buttonable & Templatable))
|
} & Buttonable & Templatable))
|
||||||
& { mimetype?: string }
|
& { mimetype?: string } & Editable
|
||||||
|
|
||||||
export type ButtonReplyInfo = {
|
export type ButtonReplyInfo = {
|
||||||
displayText: string
|
displayText: string
|
||||||
@@ -134,11 +138,11 @@ export type AnyRegularMessageContent = (
|
|||||||
text: string
|
text: string
|
||||||
linkPreview?: WAUrlInfo | null
|
linkPreview?: WAUrlInfo | null
|
||||||
}
|
}
|
||||||
& Mentionable & Buttonable & Templatable & Listable)
|
& Mentionable & Buttonable & Templatable & Listable & Editable)
|
||||||
| AnyMediaMessageContent
|
| AnyMediaMessageContent
|
||||||
| ({
|
| ({
|
||||||
poll: PollMessageOptions
|
poll: PollMessageOptions
|
||||||
} & Mentionable & Buttonable & Templatable)
|
} & Mentionable & Buttonable & Templatable & Editable)
|
||||||
| {
|
| {
|
||||||
contacts: {
|
contacts: {
|
||||||
displayName?: string
|
displayName?: string
|
||||||
|
|||||||
@@ -488,6 +488,16 @@ export const generateWAMessageContent = async(
|
|||||||
m[messageType].contextInfo.mentionedJid = message.mentions
|
m[messageType].contextInfo.mentionedJid = message.mentions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if('edit' in message) {
|
||||||
|
m = {
|
||||||
|
protocolMessage: {
|
||||||
|
key: message.edit,
|
||||||
|
editedMessage: m,
|
||||||
|
type: WAProto.Message.ProtocolMessage.Type.MESSAGE_EDIT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return WAProto.Message.fromObject(m)
|
return WAProto.Message.fromObject(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -886,4 +896,4 @@ export const assertMediaContent = (content: proto.IMessage | null | undefined) =
|
|||||||
}
|
}
|
||||||
|
|
||||||
return mediaContent
|
return mediaContent
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,5 +4,6 @@
|
|||||||
"excludeProtected": true,
|
"excludeProtected": true,
|
||||||
"excludeExternals": true,
|
"excludeExternals": true,
|
||||||
"includeVersion": false,
|
"includeVersion": false,
|
||||||
|
"declaration": false,
|
||||||
"out": "docs"
|
"out": "docs"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user