fix(fix/buttons-deprecation): initial/final commit (#956)

This commit is contained in:
Rajeh Taher
2024-08-14 12:07:12 +03:00
committed by GitHub
parent e91501026c
commit 35f6d75cf8
3 changed files with 10 additions and 138 deletions

View File

@@ -4,6 +4,7 @@ import type { Readable } from 'stream'
import type { URL } from 'url'
import { proto } from '../../WAProto'
import { MEDIA_HKDF_KEY_MAPPING } from '../Defaults'
import { BinaryNode } from '../WABinary'
import type { GroupMetadata } from './GroupMetadata'
import { CacheStore } from './Socket'
@@ -60,29 +61,9 @@ type ViewOnce = {
viewOnce?: boolean
}
type Buttonable = {
/** add buttons to the message */
buttons?: proto.Message.ButtonsMessage.IButton[]
}
type Templatable = {
/** add buttons to the message (conflicts with normal buttons)*/
templateButtons?: proto.IHydratedTemplateButton[]
footer?: string
}
type Editable = {
edit?: WAMessageKey
}
type Listable = {
/** Sections of the List */
sections?: proto.Message.ListMessage.ISection[]
/** Title of a List Message only */
title?: string
/** Text of the bnutton on the list (required) */
buttonText?: string
}
type WithDimensions = {
width?: number
height?: number
@@ -111,7 +92,7 @@ export type AnyMediaMessageContent = (
image: WAMediaUpload
caption?: string
jpegThumbnail?: string
} & Mentionable & Contextable & Buttonable & Templatable & WithDimensions)
} & Mentionable & Contextable & WithDimensions)
| ({
video: WAMediaUpload
caption?: string
@@ -119,7 +100,7 @@ export type AnyMediaMessageContent = (
jpegThumbnail?: string
/** if set to true, will send as a `video note` */
ptv?: boolean
} & Mentionable & Contextable & Buttonable & Templatable & WithDimensions)
} & Mentionable & Contextable & WithDimensions)
| {
audio: WAMediaUpload
/** if set to true, will send as a `voice note` */
@@ -135,7 +116,7 @@ export type AnyMediaMessageContent = (
mimetype: string
fileName?: string
caption?: string
} & Contextable & Buttonable & Templatable))
} & Contextable))
& { mimetype?: string } & Editable
export type ButtonReplyInfo = {
@@ -153,11 +134,11 @@ export type AnyRegularMessageContent = (
text: string
linkPreview?: WAUrlInfo | null
}
& Mentionable & Contextable & Buttonable & Templatable & Listable & Editable)
& Mentionable & Contextable & Editable)
| AnyMediaMessageContent
| ({
poll: PollMessageOptions
} & Mentionable & Contextable & Buttonable & Templatable & Editable)
} & Mentionable & Contextable & Editable)
| {
contacts: {
displayName?: string
@@ -207,6 +188,7 @@ export type MessageRelayOptions = MinimalRelayOptions & {
participant?: { jid: string, count: number }
/** additional attributes to add to the WA binary node */
additionalAttributes?: { [_: string]: string }
additionalNodes?: BinaryNode[]
/** should we use the devices cache, or fetch afresh from the server; default assumed to be "true" */
useUserDevicesCache?: boolean
/** jid list of participants for status@broadcast */