@@ -34,15 +34,14 @@ export default class EditMessage extends BaseCommand {
3434 const isOnCooldown = await this . checkAndSetCooldown ( interaction ) ;
3535 if ( isOnCooldown ) return ;
3636
37+ await interaction . deferReply ( { ephemeral : true } ) ;
38+
3739 const target = interaction . targetMessage ;
40+ const { locale } = interaction . user ;
3841
3942 if ( ! checkIfStaff ( interaction . user . id ) && ! ( await userVotedToday ( interaction . user . id ) ) ) {
40- await interaction . reply ( {
41- content : t (
42- { phrase : 'errors.mustVote' , locale : interaction . user . locale } ,
43- { emoji : emojis . no } ,
44- ) ,
45- ephemeral : true ,
43+ await interaction . editReply ( {
44+ content : t ( { phrase : 'errors.mustVote' , locale } , { emoji : emojis . no } ) ,
4645 } ) ;
4746 return ;
4847 }
@@ -58,25 +57,14 @@ export default class EditMessage extends BaseCommand {
5857 } ) ;
5958
6059 if ( ! messageInDb ) {
61- await interaction . reply ( {
62- content : t (
63- {
64- phrase : 'errors.unknownNetworkMessage' ,
65- locale : interaction . user . locale ,
66- } ,
67- { emoji : emojis . no } ,
68- ) ,
69- ephemeral : true ,
60+ await interaction . editReply ( {
61+ content : t ( { phrase : 'errors.unknownNetworkMessage' , locale } , { emoji : emojis . no } ) ,
7062 } ) ;
7163 return ;
7264 }
7365 else if ( interaction . user . id !== messageInDb . authorId ) {
74- await interaction . reply ( {
75- content : t (
76- { phrase : 'errors.notMessageAuthor' , locale : interaction . user . locale } ,
77- { emoji : emojis . no } ,
78- ) ,
79- ephemeral : true ,
66+ await interaction . editReply ( {
67+ content : t ( { phrase : 'errors.notMessageAuthor' , locale } , { emoji : emojis . no } ) ,
8068 } ) ;
8169 return ;
8270 }
@@ -107,12 +95,16 @@ export default class EditMessage extends BaseCommand {
10795
10896 @RegisterInteractionHandler ( 'editMsg' )
10997 static async handleModals ( interaction : ModalSubmitInteraction ) : Promise < void > {
98+ await interaction . deferReply ( { ephemeral : true } ) ;
99+
110100 const customId = CustomID . parseCustomId ( interaction . customId ) ;
111101 const messageId = customId . args [ 0 ] ;
112102
113103 const target = await interaction . channel ?. messages . fetch ( messageId ) . catch ( ( ) => null ) ;
114104 if ( ! target ) {
115- await interaction . reply ( t ( { phrase : 'errors.unknownNetworkMessage' } , { emoji : emojis . no } ) ) ;
105+ await interaction . editReply (
106+ t ( { phrase : 'errors.unknownNetworkMessage' } , { emoji : emojis . no } ) ,
107+ ) ;
116108 return ;
117109 }
118110
@@ -124,7 +116,7 @@ export default class EditMessage extends BaseCommand {
124116 } ) ;
125117
126118 if ( ! messageInDb ?. hub ) {
127- await interaction . reply (
119+ await interaction . editReply (
128120 t (
129121 { phrase : 'errors.unknownNetworkMessage' , locale : interaction . user . locale } ,
130122 { emoji : emojis . no } ,
@@ -133,9 +125,6 @@ export default class EditMessage extends BaseCommand {
133125 return ;
134126 }
135127
136- // defer it because it takes a while to edit the message
137- await interaction . deferReply ( { ephemeral : true } ) ;
138-
139128 // get the new message input by user
140129 const userInput = interaction . fields . getTextInputValue ( 'newMessage' ) ;
141130 const hubSettings = new HubSettingsBitField ( messageInDb . hub . settings ) ;
0 commit comments