Skip to main content

Defer command

Interceptor added interaction.deferReply() to the beiginning of the code

Usage

src/app.service.ts
import {
Context,
SlashCommand,
SlashCommandContext,
DeferCommandInterceptor,
} from '@globalart/nestcord';

@Injectable()
export class AppService {
@UseInterceptors(DeferCommandInterceptor)
@SlashCommand({
name: 'ping',
description: 'pong',
})
async execute(@Context() [interaction]: SlashCommandContext) {
setTimeout(() => interaction.followUp({ content: 'Pong!' }), 5000);
}
}