diff --git a/src/routes/channels/#channel_id/messages/#message_id/index.ts b/src/routes/channels/#channel_id/messages/#message_id/index.ts index b01a5af2..19efc823 100644 --- a/src/routes/channels/#channel_id/messages/#message_id/index.ts +++ b/src/routes/channels/#channel_id/messages/#message_id/index.ts @@ -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); });