File tree Expand file tree Collapse file tree 2 files changed +19
-12
lines changed Expand file tree Collapse file tree 2 files changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -1158,7 +1158,10 @@ declare namespace WAWebJS {
11581158 /** Sticker author, if sendMediaAsSticker is true */
11591159 stickerAuthor ?: string
11601160 /** Sticker categories, if sendMediaAsSticker is true */
1161- stickerCategories ?: string [ ]
1161+ stickerCategories ?: string [ ] ,
1162+ /** Should the bot send a quoted message without the quoted message if it fails to get the quote?
1163+ * @default false (disabled) */
1164+ ignoreQuoteErrors ?: boolean
11621165 }
11631166
11641167 /** Options for editing a message */
Original file line number Diff line number Diff line change @@ -46,20 +46,24 @@ exports.LoadUtils = () => {
4646 if ( options . quotedMessageId ) {
4747 let quotedMessage = await window . Store . Msg . getMessagesById ( [ options . quotedMessageId ] ) ;
4848
49- if ( quotedMessage [ 'messages' ] . length != 1 ) {
50- throw new Error ( 'Could not get the quoted message.' ) ;
51- }
52-
53- quotedMessage = quotedMessage [ 'messages' ] [ 0 ] ;
49+ if ( quotedMessage [ 'messages' ] . length == 1 ) {
50+ quotedMessage = quotedMessage [ 'messages' ] [ 0 ] ;
5451
55- // TODO remove .canReply() once all clients are updated to >= v2.2241.6
56- const canReply = window . Store . ReplyUtils ?
57- window . Store . ReplyUtils . canReplyMsg ( quotedMessage . unsafe ( ) ) :
58- quotedMessage . canReply ( ) ;
52+ // TODO remove .canReply() once all clients are updated to >= v2.2241.6
53+ const canReply = window . Store . ReplyUtils ?
54+ window . Store . ReplyUtils . canReplyMsg ( quotedMessage . unsafe ( ) ) :
55+ quotedMessage . canReply ( ) ;
5956
60- if ( canReply ) {
61- quotedMsgOptions = quotedMessage . msgContextInfo ( chat ) ;
57+ if ( canReply ) {
58+ quotedMsgOptions = quotedMessage . msgContextInfo ( chat ) ;
59+ }
60+ } else {
61+ if ( ! options . ignoreQuoteErrors ) {
62+ throw new Error ( 'Could not get the quoted message.' ) ;
63+ }
6264 }
65+
66+ delete options . ignoreQuoteErrors ;
6367 delete options . quotedMessageId ;
6468 }
6569
You can’t perform that action at this time.
0 commit comments