Deferring a command reply
Some commands that are ran could take longer time to respond. However, Discord only allows a maximum of 3 seconds for the bot to respond.
What is deferReply?
deferReply?Why?
const { NoCliCommandType } = require("nocli-handler.js");
/**
* @type {import("nocli-handler.js").ICommand}
*/
const Command = {
deferReply: true, // <-- Delays the response
type: NoCliCommandType.Both,
description: "Checks client latency",
callback: ({ client, message, args, text }) => {
return `π Pong! \`${client.ws.ping}ms\``;
}
}
module.exports = Command;import { ICommand, NoCliCommandType } from "nocli-handler.js";
export default {
deferReply: true, // <-- Delays the response
description: "Checks client latency",
type: NoCliCommandType.Both,
callback: ({ client, message, args, text }) => {
return `π Pong! \`${client.ws.ping}ms\``;
}
} as ICommand;End Result:
Before bot replies:
Last updated

