diff options
Diffstat (limited to 'src/models/Guild.ts')
-rw-r--r-- | src/models/Guild.ts | 57 |
1 files changed, 47 insertions, 10 deletions
diff --git a/src/models/Guild.ts b/src/models/Guild.ts index 348f8c7c..c9a55301 100644 --- a/src/models/Guild.ts +++ b/src/models/Guild.ts @@ -1,9 +1,7 @@ -import { GuildChannel } from "./Channel"; -import { Emoji } from "./Emoji"; -import { Member } from "./Member"; -import { Role } from "./Role"; +import { Schema, model, Types, Document } from "mongoose"; -export interface Guild { +export interface Guild extends Document { + id: bigint; afk_channel_id?: bigint; afk_timeout?: number; application_id?: bigint; @@ -11,12 +9,9 @@ export interface Guild { default_message_notifications?: number; description?: string; discovery_splash?: string; - emojis: Emoji[]; explicit_content_filter?: number; features: string[]; icon?: string; - id: bigint; - // joined_at?: number; \n // owner?: boolean; // ! member specific should be removed large?: boolean; max_members?: number; // e.g. default 100.000 max_presences?: number; @@ -24,8 +19,9 @@ export interface Guild { member_count?: number; presence_count?: number; // users online // members?: Member[]; // * Members are stored in a seperate collection - // roles: Role[]; // * Role are stroed in a seperate collection - // channels: GuildChannel[]; // * Channels are stroed in a seperate collection + // roles: Role[]; // * Role are stored in a seperate collection + // channels: GuildChannel[]; // * Channels are stored in a seperate collection + // emojis: Emoji[]; // * Emojis are stored in a seperate collection mfa_level?: number; name: string; owner_id: bigint; @@ -46,3 +42,44 @@ export interface Guild { widget_channel_id?: bigint; widget_enabled?: boolean; } + +export const GuildSchema = new Schema({ + afk_channel_id: Types.Long, + afk_timeout: Number, + application_id: Types.Long, + banner: String, + default_message_notifications: Number, + description: String, + discovery_splash: String, + explicit_content_filter: Number, + features: { type: [String], default: [] }, + icon: String, + id: { type: Types.Long, required: true }, + large: Boolean, + max_members: { type: Number, default: 100000 }, + max_presences: Number, + max_video_channel_users: { type: Number, default: 25 }, + member_count: Number, + presence_count: Number, + mfa_level: Number, + name: { type: String, required: true }, + owner_id: { type: Types.Long, required: true }, + preferred_locale: String, + premium_subscription_count: Number, + premium_tier: Number, + public_updates_channel_id: Types.Long, + region: String, + rules_channel_id: Types.Long, + splash: String, + system_channel_flags: Number, + system_channel_id: Types.Long, + unavailable: Boolean, + vanity_url_code: String, + verification_level: Number, + voice_states: { type: [Object], default: [] }, + welcome_screen: { type: [Object], default: [] }, + widget_channel_id: Types.Long, + widget_enabled: Boolean, +}); + +export const GuildModel = model<Guild>("Guild", GuildSchema, "guilds"); |