mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-11 13:14:06 +01:00
Message reply
This commit is contained in:
parent
9b3f1f5a64
commit
ae1fc50c84
@ -342,6 +342,15 @@ MessageSchema.virtual("mention_channels", {
|
|||||||
autopopulate: { select: { id: true, guild_id: true, type: true, name: true } },
|
autopopulate: { select: { id: true, guild_id: true, type: true, name: true } },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
MessageSchema.virtual("referenced_message", {
|
||||||
|
ref: "Message",
|
||||||
|
localField: "message_reference.message_id",
|
||||||
|
foreignField: "id",
|
||||||
|
justOne: true,
|
||||||
|
autopopulate: true,
|
||||||
|
});
|
||||||
|
|
||||||
MessageSchema.virtual("created_at").get(function (this: MessageDocument) {
|
MessageSchema.virtual("created_at").get(function (this: MessageDocument) {
|
||||||
return new Date(Snowflake.deconstruct(this.id).timestamp);
|
return new Date(Snowflake.deconstruct(this.id).timestamp);
|
||||||
});
|
});
|
||||||
@ -358,3 +367,4 @@ MessageSchema.set("removeResponse", ["mention_channel_ids", "mention_role_ids",
|
|||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export const MessageModel = db.model<MessageDocument>("Message", MessageSchema, "messages");
|
export const MessageModel = db.model<MessageDocument>("Message", MessageSchema, "messages");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user