mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-11 05:02:37 +01:00
🐛 add event for Message Delete route
This commit is contained in:
parent
371dbf25c9
commit
6722c1556c
@ -1,6 +1,7 @@
|
||||
import { ChannelModel, getPermission, MessageModel } from "@fosscord/server-util";
|
||||
import { ChannelModel, getPermission, MessageDeleteEvent, MessageModel } from "@fosscord/server-util";
|
||||
import { Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { emitEvent } from "../../../../../util/Event";
|
||||
import { check } from "../../../../../util/instanceOf";
|
||||
|
||||
const router = Router();
|
||||
@ -17,6 +18,17 @@ router.delete("/", async (req, res) => {
|
||||
|
||||
await MessageModel.deleteOne({ id: message_id }).exec();
|
||||
|
||||
await emitEvent({
|
||||
event: "MESSAGE_DELETE",
|
||||
channel_id,
|
||||
guild_id: channel.guild_id,
|
||||
data: {
|
||||
id: message_id,
|
||||
channel_id,
|
||||
guild_id: channel.guild_id,
|
||||
},
|
||||
} as MessageDeleteEvent);
|
||||
|
||||
res.sendStatus(204);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user