✨ AuditLog
This commit is contained in:
@@ -7,7 +7,7 @@ export interface AuditLogResponse {
|
||||
webhooks: []; // TODO:
|
||||
users: PublicUser[];
|
||||
audit_log_entries: AuditLogEntries[];
|
||||
integrations: [];
|
||||
integrations: []; // TODO:
|
||||
}
|
||||
|
||||
export interface AuditLogEntries {
|
||||
|
||||
+1
-1
@@ -49,6 +49,7 @@ export interface Guild {
|
||||
}
|
||||
|
||||
export const GuildSchema = new Schema({
|
||||
id: { type: Types.Long, required: true },
|
||||
afk_channel_id: Types.Long,
|
||||
afk_timeout: Number,
|
||||
application_id: Types.Long,
|
||||
@@ -59,7 +60,6 @@ export const GuildSchema = new Schema({
|
||||
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,
|
||||
|
||||
@@ -75,7 +75,7 @@ export const MemberSchema = new Schema({
|
||||
},
|
||||
});
|
||||
|
||||
exports.MemberSchema.virtual("user", {
|
||||
MemberSchema.virtual("user", {
|
||||
ref: UserModel,
|
||||
localField: "id",
|
||||
foreignField: "id",
|
||||
|
||||
+56
-21
@@ -1,10 +1,13 @@
|
||||
import { Schema, model, Types, Document } from "mongoose";
|
||||
import { ChannelType } from "./Channel";
|
||||
import { Schema, Types, Document } from "mongoose";
|
||||
import db from "../util/Database";
|
||||
import { UserModel } from "./User";
|
||||
import { MemberModel } from "./Member";
|
||||
import { RoleModel } from "./Role";
|
||||
|
||||
export interface Message extends Document {
|
||||
id: bigint;
|
||||
channel_id: bigint;
|
||||
guild_id?: bigint;
|
||||
author_id?: bigint;
|
||||
webhook_id?: bigint;
|
||||
application_id: bigint;
|
||||
@@ -13,14 +16,9 @@ export interface Message extends Document {
|
||||
edited_timestamp: number;
|
||||
tts: boolean;
|
||||
mention_everyone: boolean;
|
||||
mentions: bigint[];
|
||||
mention_roles: bigint[];
|
||||
mention_channels?: {
|
||||
id: bigint;
|
||||
guild_id: bigint;
|
||||
type: ChannelType;
|
||||
name: string;
|
||||
}[];
|
||||
mention_user_ids: bigint[];
|
||||
mention_role_ids: bigint[];
|
||||
mention_channels_ids: bigint[];
|
||||
attachments: Attachment[];
|
||||
embeds: Embed[];
|
||||
reactions?: Reaction[];
|
||||
@@ -154,7 +152,7 @@ const Reaction = {
|
||||
},
|
||||
};
|
||||
|
||||
const Embed = {
|
||||
export const Embed = {
|
||||
title: String, //title of embed
|
||||
type: String, // type of embed (always "rich" for webhook embeds)
|
||||
description: String, // description of embed
|
||||
@@ -193,22 +191,16 @@ export const MessageSchema = new Schema({
|
||||
channel_id: Types.Long,
|
||||
author_id: Types.Long,
|
||||
webhook_id: Types.Long,
|
||||
guild_id: Types.Long,
|
||||
application_id: Types.Long,
|
||||
content: String,
|
||||
timestamp: Number,
|
||||
edited_timestamp: Number,
|
||||
tts: Boolean,
|
||||
mention_everyone: Boolean,
|
||||
mentions: [Types.Long],
|
||||
mention_roles: [Types.Long],
|
||||
mention_channels: [
|
||||
{
|
||||
id: Types.Long,
|
||||
guild_id: Types.Long,
|
||||
type: { type: Number },
|
||||
name: String,
|
||||
},
|
||||
],
|
||||
mention_user_ids: [Types.Long],
|
||||
mention_role_ids: [Types.Long],
|
||||
mention_channel_ids: [Types.Long],
|
||||
attachments: [Attachment],
|
||||
embeds: [Embed],
|
||||
reactions: [Reaction],
|
||||
@@ -228,5 +220,48 @@ export const MessageSchema = new Schema({
|
||||
},
|
||||
});
|
||||
|
||||
MessageSchema.virtual("author", {
|
||||
ref: UserModel,
|
||||
localField: "author_id",
|
||||
foreignField: "id",
|
||||
justOne: true,
|
||||
});
|
||||
|
||||
MessageSchema.virtual("member", {
|
||||
ref: MemberModel,
|
||||
localField: "author_id",
|
||||
foreignField: "id",
|
||||
justOne: true,
|
||||
});
|
||||
|
||||
MessageSchema.virtual("mentions", {
|
||||
ref: UserModel,
|
||||
localField: "mention_user_ids",
|
||||
foreignField: "id",
|
||||
justOne: true,
|
||||
});
|
||||
|
||||
MessageSchema.virtual("mention_roles", {
|
||||
ref: RoleModel,
|
||||
localField: "mention_role_ids",
|
||||
foreignField: "id",
|
||||
justOne: true,
|
||||
});
|
||||
|
||||
MessageSchema.virtual("mention_channels", {
|
||||
ref: RoleModel,
|
||||
localField: "mention_role_ids",
|
||||
foreignField: "id",
|
||||
justOne: true,
|
||||
});
|
||||
|
||||
// TODO: missing Application Model
|
||||
// MessageSchema.virtual("application", {
|
||||
// ref: Application,
|
||||
// localField: "mention_role_ids",
|
||||
// foreignField: "id",
|
||||
// justOne: true,
|
||||
// });
|
||||
|
||||
// @ts-ignore
|
||||
export const MessageModel = db.model<Message>("Message", MessageSchema, "messages");
|
||||
|
||||
+3
-1
@@ -21,7 +21,7 @@ export interface User {
|
||||
mfa_enabled: boolean; // if multi factor authentication is enabled
|
||||
created_at: number; // registration date
|
||||
verified: boolean; // if the user is offically verified
|
||||
email: string; // email of the user
|
||||
email?: string; // email of the user
|
||||
flags: bigint; // UserFlags
|
||||
public_flags: bigint;
|
||||
hash: string; // hash of the password, salt is saved in password (bcrypt)
|
||||
@@ -88,6 +88,7 @@ export interface UserSettings {
|
||||
enable_tts_command: boolean;
|
||||
explicit_content_filter: number;
|
||||
friend_source_flags: { all: boolean };
|
||||
gateway_connected: boolean;
|
||||
gif_auto_play: boolean;
|
||||
guild_folders: // every top guild is displayed as a "folder"
|
||||
{
|
||||
@@ -155,6 +156,7 @@ export const UserSchema = new Schema({
|
||||
enable_tts_command: Boolean,
|
||||
explicit_content_filter: Number,
|
||||
friend_source_flags: { all: Boolean },
|
||||
gateway_connected: Boolean,
|
||||
gif_auto_play: Boolean,
|
||||
// every top guild is displayed as a "folder"
|
||||
guild_folders: [
|
||||
|
||||
Reference in New Issue
Block a user