diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-05-22 12:01:07 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-05-22 12:01:07 +0200 |
commit | 0abee6dca4822237626d6dd2767a33c9b9aa295e (patch) | |
tree | 2219cedfefa00f6b7c3e7e8bc40afee5718d4682 /src | |
parent | 1.2.2 (diff) | |
download | server-0abee6dca4822237626d6dd2767a33c9b9aa295e.tar.xz |
:bug: fix Channel + Invite Model
Diffstat (limited to 'src')
-rw-r--r-- | src/models/Channel.ts | 14 | ||||
-rw-r--r-- | src/models/Invite.ts | 12 | ||||
-rw-r--r-- | src/util/Permissions.ts | 2 |
3 files changed, 20 insertions, 8 deletions
diff --git a/src/models/Channel.ts b/src/models/Channel.ts index 1b9a167c..bde5256a 100644 --- a/src/models/Channel.ts +++ b/src/models/Channel.ts @@ -2,7 +2,10 @@ import { Schema, model, Types, Document } from "mongoose"; import db from "../util/Database"; import toBigInt from "../util/toBigInt"; -export interface AnyChannel extends Channel, DMChannel, TextChannel, VoiceChannel {} +// @ts-ignore +export interface AnyChannel extends Channel, DMChannel, TextChannel, VoiceChannel { + recipients: null | string[]; +} export interface ChannelDocument extends Document, AnyChannel { id: string; @@ -46,6 +49,7 @@ export interface Channel { export interface TextBasedChannel { last_message_id?: string; last_pin_timestamp?: number; + recipients: null; } export interface GuildChannel extends Channel { @@ -67,14 +71,18 @@ export enum ChannelPermissionOverwriteType { member = 1, } -export interface VoiceChannel extends GuildChannel {} +export interface VoiceChannel extends GuildChannel { + video_quality_mode?: number; + bitrate?: number; + user_limit?: number; +} export interface TextChannel extends GuildChannel, TextBasedChannel { nsfw: boolean; rate_limit_per_user: number; topic?: string; } - +// @ts-ignore export interface DMChannel extends Channel, TextBasedChannel { owner_id: string; recipients: string[]; diff --git a/src/models/Invite.ts b/src/models/Invite.ts index 41f33a02..d6e8536e 100644 --- a/src/models/Invite.ts +++ b/src/models/Invite.ts @@ -4,22 +4,25 @@ import { ChannelModel } from "./Channel"; import { UserModel } from "./User"; import { GuildModel } from "./Guild"; -export interface Invite extends Document { +export interface Invite { code: string; temporary: boolean; uses: number; max_uses: number; max_age: number; created_at: Date; + expires_at: Date; guild_id: string; channel_id: string; inviter_id: string; - // ? What the fucking shit is this + // ? What is this? target_user_id?: string; target_user_type?: number; } +export interface InviteDocument extends Invite, Document {} + export const InviteSchema = new Schema({ code: String, temporary: Boolean, @@ -27,11 +30,12 @@ export const InviteSchema = new Schema({ max_uses: Number, max_age: Number, created_at: Date, + expires_at: Date, guild_id: String, channel_id: String, inviter_id: String, - // ? What the fucking shit is this + // ? What is this? target_user_id: String, target_user_type: Number, }); @@ -94,4 +98,4 @@ InviteSchema.virtual("guild", { }); // @ts-ignore -export const InviteModel = db.model<Invite>("Invite", InviteSchema, "invites"); +export const InviteModel = db.model<InviteDocument>("Invite", InviteSchema, "invites"); diff --git a/src/util/Permissions.ts b/src/util/Permissions.ts index e9dd6f4d..d358851c 100644 --- a/src/util/Permissions.ts +++ b/src/util/Permissions.ts @@ -145,7 +145,7 @@ export class Permissions extends BitField { guild: { roles: Role[] }; channel?: { overwrites?: ChannelPermissionOverwrite[]; - recipients?: string[]; + recipients?: string[] | null; owner_id?: string; }; }) { |