1
1
import { setTimeout } from 'node:timers' ;
2
- import { Collection , MessageComponentInteraction } from 'discord.js' ;
2
+ import { Collection , InteractionType , MessageComponentInteraction , ModalSubmitInteraction } from 'discord.js' ;
3
3
import { AutoDeferType , GClient } from '../lib/GClient' ;
4
4
import { Components } from '../lib/managers/ComponentManager' ;
5
5
import { Handlers } from '../lib/managers/HandlerManager' ;
@@ -11,7 +11,7 @@ import { Events, Logger } from '../lib/util/logger/Logger';
11
11
const cooldowns = new Collection < string , Collection < string , number > > ( ) ;
12
12
13
13
export async function ComponentHandler (
14
- interaction : MessageComponentInteraction ,
14
+ interaction : MessageComponentInteraction | ModalSubmitInteraction ,
15
15
) {
16
16
const client = interaction . client as GClient ;
17
17
@@ -66,9 +66,9 @@ export async function ComponentHandler(
66
66
customId : interaction . customId ,
67
67
arguments : args ,
68
68
values : interaction . isSelectMenu ( ) ? interaction . values : undefined ,
69
- fields : interaction . isModalSubmit ( ) ? interaction . fields : undefined ,
69
+ fields : interaction . type === InteractionType . ModalSubmit ? interaction . fields : undefined ,
70
70
deferReply : interaction . deferReply . bind ( interaction ) ,
71
- deferUpdate : interaction . deferUpdate . bind ( interaction ) ,
71
+ deferUpdate : interaction . type !== InteractionType . ModalSubmit ? interaction . deferUpdate . bind ( interaction ) : ( ) => { throw new Error ( 'Cannot defer update in modal submit interaction' ) ; } ,
72
72
deleteReply : interaction . deleteReply . bind ( interaction ) ,
73
73
editReply : interaction . editReply . bind ( interaction ) ,
74
74
fetchReply : interaction . fetchReply . bind ( interaction ) ,
0 commit comments