@@ -5,11 +5,12 @@ import {
55 ButtonInteraction ,
66 ButtonStyle ,
77 ChatInputCommandInteraction ,
8- Collection ,
98 type ColorResolvable ,
109 type ComponentEmojiResolvable ,
1110 ComponentType ,
1211 Message ,
12+ MessageFlags ,
13+ ReadonlyCollection ,
1314 User
1415} from 'discord.js' ;
1516import { Button } from './Button.js' ;
@@ -75,19 +76,21 @@ export class Confirmation {
7576 row . _components ( this . buttons ) ;
7677 let msg : Message < boolean > ;
7778 if ( message instanceof Message ) {
79+ if ( ! message . channel . isSendable ( ) ) return ;
7880 msg = await message . channel . send ( {
7981 content : this . options . content ,
8082 embeds : this . options ?. content ? [ ] : [ embed ] ,
8183 components : [ row ]
8284 } ) ;
8385 } else {
84- msg = ( await message . reply ( {
86+ const interactionResponse = await message . reply ( {
8587 content : this . options . content ,
8688 embeds : this . options ?. content ? [ ] : [ embed ] ,
8789 components : [ row ] ,
88- fetchReply : true ,
89- ephemeral : this . options . ephemeral
90- } ) ) as Message ;
90+ withResponse : true ,
91+ flags : this . options . ephemeral ? MessageFlags . Ephemeral : undefined
92+ } ) ;
93+ msg = message . channel ?. messages . cache . get ( interactionResponse . interaction . responseMessageId ! ) as Message < boolean > ;
9194 }
9295
9396 const collector = msg . createMessageComponentCollector ( {
@@ -174,7 +177,7 @@ interface payload {
174177}
175178
176179interface endPayload {
177- collection : Collection < string , ButtonInteraction > ;
180+ collection : ReadonlyCollection < string , ButtonInteraction > ;
178181 msg : Message ;
179182}
180183
0 commit comments