@getsolara/solara.js
Version:
A lightweight and modular Discord bot framework built on discord.js v14, with truly optional feature packages.
11 lines • 508 B
JavaScript
module.exports = {
name: "$userExists",
description: "Checks if a user exists (can be fetched). Args: userID",
takesBrackets: true,
execute: async (context, args) => {
if (!args[0]) return "[Error: $userExists requires a user ID]";
const userId = args[0]; if (!/^\d{17,19}$/.test(userId)) return "false";
try { await context.client.users.fetch(userId); return "true"; }
catch (err) { if (err.code === 10013) return "false"; return "false"; }
}
};