discord-guildpeek
Version:
Get a public preview of a Discord server from its invite code, without authentication.
87 lines (86 loc) • 3.24 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DiscordInviteSchemaV9 = void 0;
const zod_1 = require("zod");
const ClanSchema = zod_1.z.object({
identity_guild_id: zod_1.z.string(),
identity_enabled: zod_1.z.boolean(),
tag: zod_1.z.string(),
badge: zod_1.z.string(),
});
const AvatarDecorationSchema = zod_1.z.object({
asset: zod_1.z.string(),
sku_id: zod_1.z.string(),
expires_at: zod_1.z.number(),
});
const UserSchema = zod_1.z.object({
id: zod_1.z.string(),
username: zod_1.z.string(),
avatar: zod_1.z.string(),
discriminator: zod_1.z.string(),
public_flags: zod_1.z.number(),
flags: zod_1.z.number(),
banner: zod_1.z.string().nullable(),
accent_color: zod_1.z.number().nullable(),
global_name: zod_1.z.string().nullable(),
avatar_decoration_data: AvatarDecorationSchema.optional().nullable(),
collectibles: zod_1.z.unknown().nullable(), // unknown type for collectibles
display_name_styles: zod_1.z.unknown().nullable(), // unknown type for display name styles
banner_color: zod_1.z.string().nullable(),
clan: ClanSchema.optional().nullable(),
primary_guild: ClanSchema.optional().nullable(),
});
const GuildSchema = zod_1.z.object({
id: zod_1.z.string(),
name: zod_1.z.string(),
splash: zod_1.z.string().nullable(),
banner: zod_1.z.string().nullable(),
description: zod_1.z.string().nullable(),
icon: zod_1.z.string(),
features: zod_1.z.array(zod_1.z.string()),
verification_level: zod_1.z.number(),
vanity_url_code: zod_1.z.string().nullable(),
nsfw_level: zod_1.z.number(),
nsfw: zod_1.z.boolean(),
premium_subscription_count: zod_1.z.number(),
premium_tier: zod_1.z.number(),
});
const ChannelSchema = zod_1.z.object({
id: zod_1.z.string(),
type: zod_1.z.number(),
name: zod_1.z.string(),
});
const ProfileSchema = zod_1.z.object({
id: zod_1.z.string(),
name: zod_1.z.string(),
icon_hash: zod_1.z.string().nullable(),
member_count: zod_1.z.number(),
online_count: zod_1.z.number(),
description: zod_1.z.string().nullable(),
banner_hash: zod_1.z.string().nullable(),
game_application_ids: zod_1.z.array(zod_1.z.string()),
game_activity: zod_1.z.unknown(), // unknown type for game activity
tag: zod_1.z.string().nullable(),
badge: zod_1.z.number(),
badge_color_primary: zod_1.z.string(),
badge_color_secondary: zod_1.z.string(),
badge_hash: zod_1.z.string().nullable(),
traits: zod_1.z.array(zod_1.z.unknown()),
features: zod_1.z.array(zod_1.z.string()),
visibility: zod_1.z.number(),
custom_banner_hash: zod_1.z.string().nullable(),
premium_subscription_count: zod_1.z.number(),
premium_tier: zod_1.z.number(),
});
exports.DiscordInviteSchemaV9 = zod_1.z.object({
type: zod_1.z.number(),
code: zod_1.z.string(),
inviter: UserSchema.optional(),
expires_at: zod_1.z.union([zod_1.z.string(), zod_1.z.null()]),
guild: GuildSchema,
guild_id: zod_1.z.string(),
channel: ChannelSchema,
profile: ProfileSchema,
approximate_member_count: zod_1.z.number().optional(),
approximate_presence_count: zod_1.z.number().optional(),
});