protected async process(event: InteractionEvent) {
if (event.interaction.member.user.bot) {
return;
}
if(event.interaction.isButton()) {
event.interaction.deferUpdate();
return;
}
if (event.interaction.isChatInputCommand()) {
const interactionOptions: CommandInteractionOptionResolver = event.interaction.options as CommandInteractionOptionResolver;
const commandName: string = event.interaction.commandName;
const commandID: string = event.instance.commands.commandsNames.get(commandName);
if(commandID) {
// event.instance.commands.executeByName() -> command.run() -> command.renderResponceMessage()
await event.instance.commands.executeByName(commandID, {
interaction: event.interaction,
options: interactionOptions,
member: event.member,
})
}
}
}