@getsolara/solara.js
Version:
A lightweight and modular Discord bot framework built on discord.js v14, with truly optional feature packages.
17 lines • 746 B
JavaScript
module.exports = {
name: "$serverBanner",
description: "Returns the banner URL of the current guild or the guild specified by ID.",
takesBrackets: true,
execute: async (context, args) => {
const guildId = args[0]?.trim();
let targetGuild = null;
if (guildId) {
try { targetGuild = await context.client.guilds.fetch(guildId); }
catch (e) { return `[Error: Could not find guild with ID ${guildId}]`; }
} else {
targetGuild = context.guild;
}
if (targetGuild) return targetGuild.bannerURL({ dynamic: true, size: 4096 }) || "";
return "[Error: $serverBanner - Could not determine guild context or fetch guild by ID]";
}
};