@getsolara/solara.js
Version:
A lightweight and modular Discord bot framework built on discord.js v14, with truly optional feature packages.
16 lines • 742 B
JavaScript
module.exports = {
name: "$commandTrigger",
description: "Returns the trigger used for the command (name or alias for messages, command name for interactions).",
takesBrackets: false,
execute: async (context, args) => {
if (context.interaction) {
return context.interaction.commandName;
} else if (context.message) {
const prefix = context.client.SolaraOptions?.prefix || "!";
const contentWithoutPrefix = context.message.content.slice(prefix.length);
const trigger = contentWithoutPrefix.trim().split(/ +/)[0];
return trigger?.toLowerCase() || "";
}
return "[Error: Could not determine command trigger]";
}
};