summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
authorMathMan05 <mathmanrm@gmail.com>2026-03-03 20:33:47 -0600
committerRory& <root@rory.gay>2026-03-07 01:42:27 +0100
commita8ba2d655339021951620c0a67fecc668e889f81 (patch)
treebd2b679f76ebb7e6e273a3be8b14f1a1e7a3dca9 /src/util
parentwhen guild region is misconfigured, fallback to default region (diff)
downloadserver-ts-a8ba2d655339021951620c0a67fecc668e889f81.tar.xz
sticker impl
Diffstat (limited to 'src/util')
-rw-r--r--src/util/entities/Guild.ts39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/util/entities/Guild.ts b/src/util/entities/Guild.ts

index d5a24632..29d4de58 100644 --- a/src/util/entities/Guild.ts +++ b/src/util/entities/Guild.ts
@@ -304,6 +304,45 @@ export class Guild extends BaseClass { @Column() discovery_excluded: boolean = false; + async ToGuildSource() { + if (!this.features.includes("DISCOVERABLE")) { + return null; + } + return { + id: this.id, + name: this.name, + icon: this.icon, + description: this.description, + banner: this.banner, + splash: this.splash, + discovery_splash: this.discovery_splash, + features: this.features, + vanity_url_code: null, + preferred_locale: this.preferred_locale || "en", + premium_subscription_count: this.premium_subscription_count, + approximate_member_count: await Member.countBy({ + guild_id: this.id, + }), + approximate_presence_count: await Member.countBy({ + guild_id: this.id, + user: { + sessions: { + status: "online", + }, + }, + }), + emojis: this.emojis ?? undefined, + emoji_count: this.emojis ? this.emojis.length : undefined, + stickers: this.stickers ?? undefined, + sticker_count: this.stickers ? this.stickers.length : undefined, + auto_removed: false, + primary_category_id: this.primary_category_id, + keywords: [], + is_published: false, + reasons_to_join: [], + }; + } + static async createGuild(body: { name?: string; icon?: string | null;