Skip to content

Guild

Guild wraps a Discord guild object, exposing server metadata, CDN image URL helpers, and feature flag checks.

import { Guild } from "lunibee";
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.
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.

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;
}

Returns the guild icon URL, or null if no icon is set.

const icon = guild.iconURL({ size: 256, extension: "png" });

Returns the invite splash URL, or null.

Returns the banner URL, or null.

Returns the discovery splash URL, or null.

Returns a guild widget image URL.

const widget = guild.widgetImageURL("banner3");

Returns true if the guild has a specific feature flag.

if (guild.hasFeature("MONETIZATION_ENABLED")) {
console.log("Subscriptions are enabled!");
}

Returns the guild name.

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}`);
});

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] });
});