mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-11 13:14:06 +01:00
🐛 fix Channel + Invite Model
This commit is contained in:
parent
2c77dcb933
commit
0abee6dca4
@ -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[];
|
||||
|
@ -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");
|
||||
|
@ -145,7 +145,7 @@ export class Permissions extends BitField {
|
||||
guild: { roles: Role[] };
|
||||
channel?: {
|
||||
overwrites?: ChannelPermissionOverwrite[];
|
||||
recipients?: string[];
|
||||
recipients?: string[] | null;
|
||||
owner_id?: string;
|
||||
};
|
||||
}) {
|
||||
|
Loading…
Reference in New Issue
Block a user