mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: add button reply
This commit is contained in:
@@ -100,6 +100,12 @@ export type AnyMediaMessageContent = (
|
|||||||
} & Buttonable & Templatable)) &
|
} & Buttonable & Templatable)) &
|
||||||
{ mimetype?: string }
|
{ mimetype?: string }
|
||||||
|
|
||||||
|
export type ButtonReplyInfo = {
|
||||||
|
displayText: string
|
||||||
|
id: string
|
||||||
|
index: number
|
||||||
|
}
|
||||||
|
|
||||||
export type AnyRegularMessageContent = (
|
export type AnyRegularMessageContent = (
|
||||||
({
|
({
|
||||||
text: string
|
text: string
|
||||||
@@ -117,6 +123,9 @@ export type AnyRegularMessageContent = (
|
|||||||
location: WALocationMessage
|
location: WALocationMessage
|
||||||
} | {
|
} | {
|
||||||
react: proto.IReactionMessage
|
react: proto.IReactionMessage
|
||||||
|
} | {
|
||||||
|
buttonReply: ButtonReplyInfo
|
||||||
|
type: 'template' | 'plain'
|
||||||
}
|
}
|
||||||
) & ViewOnce
|
) & ViewOnce
|
||||||
|
|
||||||
|
|||||||
@@ -307,6 +307,23 @@ export const generateWAMessageContent = async(
|
|||||||
(message.disappearingMessagesInChat ? WA_DEFAULT_EPHEMERAL : 0) :
|
(message.disappearingMessagesInChat ? WA_DEFAULT_EPHEMERAL : 0) :
|
||||||
message.disappearingMessagesInChat
|
message.disappearingMessagesInChat
|
||||||
m = prepareDisappearingMessageSettingContent(exp)
|
m = prepareDisappearingMessageSettingContent(exp)
|
||||||
|
} else if('buttonReply' in message) {
|
||||||
|
switch (message.type) {
|
||||||
|
case 'template':
|
||||||
|
m.templateButtonReplyMessage = {
|
||||||
|
selectedDisplayText: message.buttonReply.displayText,
|
||||||
|
selectedId: message.buttonReply.id,
|
||||||
|
selectedIndex: message.buttonReply.index,
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'plain':
|
||||||
|
m.buttonsResponseMessage = {
|
||||||
|
selectedButtonId: message.buttonReply.id,
|
||||||
|
selectedDisplayText: message.buttonReply.displayText,
|
||||||
|
type: proto.ButtonsResponseMessage.ButtonsResponseMessageType.DISPLAY_TEXT,
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
m = await prepareWAMessageMedia(
|
m = await prepareWAMessageMedia(
|
||||||
message,
|
message,
|
||||||
|
|||||||
Reference in New Issue
Block a user