Guild
Guild wraps a Discord guild object, exposing server metadata, CDN image URL helpers, and feature flag checks.
Import
Section titled “Import”import { Guild } from "lunibee";import { Guild } from "lunibee";Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
id |
string |
Snowflake ID. |
name |
string |
Server name. |
icon |
string | null |
Icon hash. Use iconURL() to get the full URL. |
splash |
string | null |
Invite splash hash. |
banner |
string | null |
Banner hash. |
description |
string | null |
Server description. |
ownerId |
string | undefined |
Snowflake of the guild owner. |
features |
string[] |
List of guild feature flags (e.g. "COMMUNITY"). |
verificationLevel |
number |
Verification level (0–4). |
premiumTier |
number |
Boost level (0–3). |
premiumSubscriptionCount |
number |
Total boosts. |
memberCount |
number | undefined |
Approximate member count. |
vanityUrlCode |
string | null |
Custom invite slug. |
preferredLocale |
string |
Server locale (e.g. "en-US"). |
nsfwLevel |
number |
NSFW level (0–3). |
rulesChannelId |
string | null |
Rules channel (Community guilds). |
systemChannelId |
string | null |
System messages channel. |
maxMembers |
number |
Member cap. |
mfaLevel |
number |
MFA requirement for moderators. |
Boolean Getters
Section titled “Boolean Getters”| Getter | Description |
|---|---|
isCommunity |
true if the guild is a Community server. |
isPartnered |
true if the guild is a Discord Partner. |
isVerified |
true if the guild is Discord Verified. |
isBoosted |
true if there are any active boosts. |
hasVanityUrl |
true if a vanity URL is configured. |
boostLevel |
Boost tier (alias of premiumTier). |
vanityURL |
Full vanity URL string, or null. |
CDN Image Methods
Section titled “CDN Image Methods”All image methods accept an optional ImageURLOptions object:
interface ImageURLOptions { extension?: "png" | "jpg" | "webp" | "gif" | "jpeg"; size?: 16 | 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096; forceStatic?: boolean;} extension?: "png" | "jpg" | "webp" | "gif" | "jpeg"; size?: 16 | 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096; forceStatic?: boolean;}iconURL(options?)
Section titled “iconURL(options?)”Returns the guild icon URL, or null if no icon is set.
const icon = guild.iconURL({ size: 256, extension: "png" });const icon = guild.iconURL({ size , extension: "png" });splashURL(options?)
Section titled “splashURL(options?)”Returns the invite splash URL, or null.
bannerURL(options?)
Section titled “bannerURL(options?)”Returns the banner URL, or null.
discoverySplashURL(options?)
Section titled “discoverySplashURL(options?)”Returns the discovery splash URL, or null.
widgetImageURL(style?)
Section titled “widgetImageURL(style?)”Returns a guild widget image URL.
const widget = guild.widgetImageURL("banner3");const widget = guild.widgetImageURL("banner3");hasFeature(feature)
Section titled “hasFeature(feature)”Returns true if the guild has a specific feature flag.
if (guild.hasFeature("MONETIZATION_ENABLED")) { console.log("Subscriptions are enabled!");}if (guild.hasFeature("MONETIZATION_ENABLED")) { console.log("Subscriptions are enabled!");}toString()
Section titled “toString()”Returns the guild name.
Examples
Section titled “Examples”Log guild info on join
client.on("guildCreate", (guild) => { console.log(`Joined: ${guild.name} (${guild.id}) — ${guild.memberCount} members`); if (guild.isCommunity) console.log(" → Community server"); if (guild.isBoosted) console.log(` → Boost Level ${guild.boostLevel}`);});client.on("guildCreate", (guild) => { console.log(`Joined: ${guild.name} (${guild.id}) — ${guild.memberCount} members`); if (guild.isCommunity) console.log(" → Community server"); if (guild.isBoosted) console.log(` → Boost Level ${guild.boostLevel}`);});Guild info command
client.on("interactionCreate", async (interaction) => { if (!interaction.isChatInputCommand() || interaction.commandName !== "serverinfo") return; const guild = client.guilds.get(interaction.guildId!); if (!guild) return; const embed = new EmbedBuilder() .setTitle(guild.name) .setThumbnail(guild.iconURL({ size: 128 }) ?? "") .addFields( { name: "Members", value: String(guild.memberCount ?? "?"), inline: true }, { name: "Boost Level", value: String(guild.boostLevel), inline: true }, { name: "Locale", value: guild.preferredLocale, inline: true }, ) .setColor(0xf59e0b); await interaction.reply({ embeds: [embed] });});client.on("interactionCreate", async (interaction) => { if (!interaction.isChatInputCommand() || interaction.commandName !== "serverinfo") return; const guild = client.guilds.get(interaction.guildId); if (!guild) return; const embed = new EmbedBuilder() .setTitle(guild.name) .setThumbnail(guild.iconURL({ size: 128 }) ?? "") .addFields( { name: "Members", value: String(guild.memberCount ?? "?"), inline: true }, { name: "Boost Level", value: String(guild.boostLevel), inline: true }, { name: "Locale", value: guild.preferredLocale, inline: true }, ) .setColor(0xf59e0b); await interaction.reply({ embeds: [embed] });});