@tryforge/forgescript
Version:
ForgeScript is a comprehensive package that empowers you to effortlessly interact with Discord's API. It ensures scripting remains easy to learn and consistently effective.
28 lines • 1.02 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const structures_1 = require("../../structures");
exports.default = new structures_1.NativeFunction({
name: "$applicationCommandID",
version: "1.0.7",
description: "Returns the application command id",
brackets: false,
args: [
{
name: "name",
description: "The name of the command to pull its id",
rest: false,
required: true,
type: structures_1.ArgType.String,
},
],
output: structures_1.ArgType.String,
unwrap: true,
async execute(ctx, [name]) {
if (this.hasFields) {
const commands = await ctx.client.application.commands.fetch().catch(ctx.noop);
return this.success(commands?.find((x) => x.name === name)?.id);
}
return this.success(ctx.interaction && "command" in ctx.interaction ? ctx.interaction.commandId : undefined);
},
});
//# sourceMappingURL=applicationCommandID.js.map
;