@getsolara/solara.js
Version:
A lightweight and modular Discord bot framework built on discord.js v14, with truly optional feature packages.
11 lines • 431 B
JavaScript
module.exports = {
name: "$sqrt",
description: "Calculates the square root of a number.",
takesBrackets: true,
execute: async (context, args) => {
if (!args[0]) return "[Error: $sqrt requires a number]";
const num = parseFloat(args[0]);
if (isNaN(num) || num < 0) return "[Error: Invalid number for $sqrt (must be non-negative)]";
return Math.sqrt(num).toString();
}
};