@@ -17,7 +17,8 @@ import {
1717 Collection ,
1818 type APIRole ,
1919 ChannelSelectMenuBuilder ,
20- InteractionContextType
20+ InteractionContextType ,
21+ MessageFlags
2122} from 'discord.js' ;
2223
2324@ApplyOptions < RadonCommand . Options > ( {
@@ -29,9 +30,9 @@ import {
2930export class UserCommand extends RadonCommand {
3031 public override async chatInputRun ( interaction : RadonCommand . ChatInputCommandInteraction ) {
3132 let stage = 0 ;
32- let msg = ( await interaction . reply ( {
33+ let interactionResponse = await interaction . reply ( {
3334 embeds : [ this . welcome ( ) ] ,
34- fetchReply : true ,
35+ withResponse : true ,
3536 components : [
3637 new Row < Button > ( ) . _components ( [
3738 new Button ( ) //
@@ -46,7 +47,12 @@ export class UserCommand extends RadonCommand {
4647 . _emoji ( '<a:poggershype:879074649781174272>' )
4748 ] )
4849 ]
49- } ) ) as Message ;
50+ } ) ;
51+
52+ const msg_id = interactionResponse . interaction . responseMessageId ;
53+ if ( ! msg_id ) return ;
54+ let msg = ( await interaction . channel ?. messages . fetch ( msg_id ) ) as Message < boolean > ;
55+ if ( ! msg ) return ;
5056
5157 const collector = msg . createMessageComponentCollector ( { time : mins ( 3 ) } ) ;
5258
@@ -60,7 +66,7 @@ export class UserCommand extends RadonCommand {
6066 if ( i . user . id !== interaction . user . id ) {
6167 await i . followUp ( {
6268 content : `This maze isn't for you mate!` ,
63- ephemeral : true
69+ flags : MessageFlags . Ephemeral
6470 } ) ;
6571 return ;
6672 }
@@ -97,7 +103,7 @@ export class UserCommand extends RadonCommand {
97103 if ( adminRoles . some ( ( r ) => modRoles . has ( r . id ) ) ) {
98104 await i . reply ( {
99105 content : `Moderation roles and Administration roles cannot be the same!` ,
100- ephemeral : true
106+ flags : MessageFlags . Ephemeral
101107 } ) ;
102108 break ;
103109 }
@@ -116,17 +122,18 @@ export class UserCommand extends RadonCommand {
116122 modLogChannel = i . channels . first ( ) as TextChannel ;
117123 case 'confirm_modlog' :
118124 stage = 4 ;
119- // eslint-disable-next-line no-case-declarations
120125 const edit = await modLogChannel !
121126 . edit ( {
122127 permissionOverwrites : permissions (
123128 ! modLogChannel ! . permissionsFor ( interaction . guild . roles . everyone ) . has ( PermissionFlagsBits . ViewChannel )
124129 )
125130 } )
126131 . catch ( async ( ) => {
127- await i . channel ! . send (
128- `I am unable to edit permissions of ${ modLogChannel } . Please grant me admin permission or click on "Make a new modlog"`
129- ) ;
132+ i . channel &&
133+ i . channel . isSendable ( ) &&
134+ ( await i . channel . send (
135+ `I am unable to edit permissions of ${ modLogChannel } . Please grant me admin permission or click on "Make a new modlog"`
136+ ) ) ;
130137 return null ;
131138 } ) ;
132139 if ( edit ) {
@@ -143,7 +150,7 @@ export class UserCommand extends RadonCommand {
143150 if ( ! interaction . guild . members . me ?. permissions . has ( PermissionFlagsBits . ManageChannels ) ) {
144151 await i . followUp ( {
145152 content : `I don't have the permissions to create channels!\nPlease give me the \`Manage Channels\` permission!` ,
146- ephemeral : true
153+ flags : MessageFlags . Ephemeral
147154 } ) ;
148155 return ;
149156 }
@@ -163,7 +170,7 @@ export class UserCommand extends RadonCommand {
163170 `\`Manage Channels\` [Creation of Channel], \`Manage Roles\` [To configure channel permissions], \`Embed Links and Send Messages\` [To send modlogs] permissions to me!\n` +
164171 `**Note:** I need a role other than @everyone with the mentioned permissions!` +
165172 `If you are still having issues run </about me:970217477126643752> and join our support server!` ,
166- ephemeral : true
173+ flags : MessageFlags . Ephemeral
167174 } ) ;
168175 return undefined ;
169176 } ) ;
0 commit comments