🐛 fix message post
This commit is contained in:
parent
e902b805c1
commit
76d800209e
@ -111,6 +111,9 @@ router.post("/", check(MessageCreateSchema), async (req, res) => {
|
|||||||
// TODO: should it be checked if the message exists?
|
// TODO: should it be checked if the message exists?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const embeds = [];
|
||||||
|
if (body.embed) embeds.push(body.embed);
|
||||||
|
|
||||||
const message: Message = {
|
const message: Message = {
|
||||||
id: Snowflake.generate(),
|
id: Snowflake.generate(),
|
||||||
channel_id,
|
channel_id,
|
||||||
@ -118,9 +121,11 @@ router.post("/", check(MessageCreateSchema), async (req, res) => {
|
|||||||
author_id: req.user_id,
|
author_id: req.user_id,
|
||||||
content: req.body,
|
content: req.body,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
embeds,
|
||||||
|
attachments: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
await new MessageModel().save();
|
await new MessageModel(message).save();
|
||||||
|
|
||||||
await emitEvent({ event: "MESSAGE_CREATE", channel_id, data: {} } as MessageCreateEvent);
|
await emitEvent({ event: "MESSAGE_CREATE", channel_id, data: {} } as MessageCreateEvent);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user