feat: Edit message (#2254)

* function edit message
This commit is contained in:
tofers 2023-06-15 18:49:38 +03:00 • committed by GitHub
commit 8e8d0c9b3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 138 additions and 3 deletions

27
index.d.ts vendored
View file

@ -242,6 +242,16 @@ declare namespace WAWebJS {
ack: MessageAck
) => void): this
/** Emitted when an ack event occurrs on message type */
on(event: 'message_edit', listener: (
/** The message that was affected */
message: Message,
/** New text message */
newBody: String,
/** Prev text message */
prevBody: String
) => void): this
/** Emitted when a chat unread count changes */
on(event: 'unread_count', listener: (
/** The chat that was affected */
@ -567,6 +577,7 @@ declare namespace WAWebJS {
MESSAGE_REVOKED_EVERYONE = 'message_revoke_everyone',
MESSAGE_REVOKED_ME = 'message_revoke_me',
MESSAGE_ACK = 'message_ack',
MESSAGE_EDIT = 'message_edit',
MEDIA_UPLOADED = 'media_uploaded',
CONTACT_CHANGED = 'contact_changed',
GROUP_JOIN = 'group_join',
@ -789,6 +800,10 @@ declare namespace WAWebJS {
businessOwnerJid?: string,
/** Product JID */
productId?: string,
/** Last edit time */
latestEditSenderTimestampMs?: number,
/** Last edit message author */
latestEditMsgKey?: MessageId,
/** Message buttons */
dynamicReplyButtons?: object,
/** Selected button ID */
@ -846,6 +861,8 @@ declare namespace WAWebJS {
* Gets the reactions associated with the given message
*/
getReactions: () => Promise<ReactionList[]>,
/** Edits the current message */
edit: (content: MessageContent, options?: MessageEditOptions) => Promise<Message | null>,
}
/** ID that represents a message */
@ -911,6 +928,16 @@ declare namespace WAWebJS {
stickerCategories?: string[]
}
/** Options for editing a message */
export interface MessageEditOptions {
/** Show links preview. Has no effect on multi-device accounts. */
linkPreview?: boolean
/** Contacts that are being mentioned in the message */
mentions?: Contact[]
/** Extra options */
extra?: any
}
export interface MediaFromURLOptions {
client?: Client
filename?: string