summary refs log tree commit diff
path: root/src/util/schemas
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-09-29 02:19:20 +0200
committerRory& <root@rory.gay>2025-09-29 18:38:06 +0200
commit2620a5551803734c6f498dfd00b6539e60e52bcf (patch)
treec300789be7ead8293b7b8bf353cdde2cb810a59b /src/util/schemas
parentSet nick/pronouns to undefined if attempting to set to empty string. Fixes #1246 (diff)
downloadserver-ts-2620a5551803734c6f498dfd00b6539e60e52bcf.tar.xz
Add fetching guild profiles
Diffstat (limited to 'src/util/schemas')
-rw-r--r--src/util/schemas/responses/GuildProfileResponse.ts96
-rw-r--r--src/util/schemas/responses/index.ts1
2 files changed, 97 insertions, 0 deletions
diff --git a/src/util/schemas/responses/GuildProfileResponse.ts b/src/util/schemas/responses/GuildProfileResponse.ts
new file mode 100644

index 00000000..58e4b485 --- /dev/null +++ b/src/util/schemas/responses/GuildProfileResponse.ts
@@ -0,0 +1,96 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2025 Spacebar and Spacebar Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +export interface GuildProfileResponse { + id: string; + name: string; + icon_hash: string | null; + member_count: number; + online_count: number; + description: string; + brand_color_primary: string; + banner_hash: string | null; + game_application_ids: string[]; + game_activity: {[id: string]: GameActivity}; + tag: string | null; + badge: GuildBadgeType; + badge_color_primary: string; + badge_color_secondary: string; + badge_hash: string; + traits: GuildTrait[]; + features: string[]; + visibility: GuildVisibilityLevel; + custom_banner_hash: string | null; + premium_subscription_count: number; + premium_tier: number; +} + +export interface GameActivity { + activity_level: number; + activity_score: number; +} + +export interface GuildTrait { + emoji_id: string | null; + emoji_name: string | null; + emoji_animated: boolean; + label: string; + position: number; +} + +// TODO: move +export enum GuildVisibilityLevel { + PUBLIC = 1, + RESTRICTED = 2, + PUBLIC_WITH_RECRUITMENT = 3 +} + +export enum GuildBadgeType { + SWORD = 0, + WATER_DROP = 1, + SKULL = 2, + TOADSTOOL = 3, + MOON = 4, + LIGHTNING = 5, + LEAF = 6, + HEART = 7, + FIRE = 8, + COMPASS = 9, + CROSSHAIRS = 10, + FLOWER = 11, + FORCE = 12, + GEM = 13, + LAVA = 14, + PSYCHIC = 15, + SMOKE = 16, + SNOW = 17, + SOUND = 18, + SUN = 19, + WIND = 20, + BUNNY = 21, + DOG = 22, + FROG = 23, + GOAT = 24, + CAT = 25, + DIAMOND = 26, + CROWN = 27, + TROPHY = 28, + MONEY_BAG = 29, + DOLLAR_SIGN = 30, +} + diff --git a/src/util/schemas/responses/index.ts b/src/util/schemas/responses/index.ts
index 561af184..dcf49f3c 100644 --- a/src/util/schemas/responses/index.ts +++ b/src/util/schemas/responses/index.ts
@@ -36,6 +36,7 @@ export * from "./GuildBansResponse"; export * from "./GuildCreateResponse"; export * from "./GuildDiscoveryRequirements"; export * from "./GuildMessagesSearchResponse"; +export * from "./GuildProfileResponse"; export * from "./GuildPruneResponse"; export * from "./GuildRecommendationsResponse"; export * from "./GuildVanityUrl";