diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-11 19:43:14 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-11 19:43:14 +0200 |
commit | 9e39b568c5680800296babad2c9ce4276471df85 (patch) | |
tree | 718a805c6f571be846ef17e5dcf8e1944218c087 | |
parent | :pencil2: fix typo (diff) | |
download | server-9e39b568c5680800296babad2c9ce4276471df85.tar.xz |
fix events: only send on id
6 files changed, 1 insertions, 15 deletions
diff --git a/src/routes/channels/#channel_id/index.ts b/src/routes/channels/#channel_id/index.ts index 434f61a5..81e5054e 100644 --- a/src/routes/channels/#channel_id/index.ts +++ b/src/routes/channels/#channel_id/index.ts @@ -30,7 +30,7 @@ router.delete("/", async (req: Request, res: Response) => { // TODO: Dm channel "close" not delete const data = toObject(channel); - await emitEvent({ event: "CHANNEL_DELETE", data, guild_id: channel?.guild_id, channel_id } as ChannelDeleteEvent); + await emitEvent({ event: "CHANNEL_DELETE", data, channel_id } as ChannelDeleteEvent); await ChannelModel.deleteOne({ id: channel_id }); @@ -51,7 +51,6 @@ router.patch("/", check(ChannelModifySchema), async (req: Request, res: Response await emitEvent({ event: "CHANNEL_UPDATE", data, - guild_id: channel.guild_id, channel_id } as ChannelUpdateEvent); 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 9cd63d26..a7c23d2f 100644 --- a/src/routes/channels/#channel_id/messages/#message_id/index.ts +++ b/src/routes/channels/#channel_id/messages/#message_id/index.ts @@ -35,7 +35,6 @@ router.patch("/", check(MessageCreateSchema), async (req: Request, res: Response await emitEvent({ event: "MESSAGE_UPDATE", channel_id, - guild_id: message.guild_id, data: { ...toObject(message), nonce: undefined } } as MessageUpdateEvent); @@ -60,7 +59,6 @@ router.delete("/", async (req: Request, res: Response) => { await emitEvent({ event: "MESSAGE_DELETE", channel_id, - guild_id: channel.guild_id, data: { id: message_id, channel_id, diff --git a/src/routes/channels/#channel_id/messages/#message_id/reactions.ts b/src/routes/channels/#channel_id/messages/#message_id/reactions.ts index 9f68b5cd..168a870f 100644 --- a/src/routes/channels/#channel_id/messages/#message_id/reactions.ts +++ b/src/routes/channels/#channel_id/messages/#message_id/reactions.ts @@ -48,7 +48,6 @@ router.delete("/", async (req: Request, res: Response) => { await emitEvent({ event: "MESSAGE_REACTION_REMOVE_ALL", channel_id, - guild_id: channel.guild_id, data: { channel_id, message_id, @@ -79,7 +78,6 @@ router.delete("/:emoji", async (req: Request, res: Response) => { await emitEvent({ event: "MESSAGE_REACTION_REMOVE_EMOJI", channel_id, - guild_id: channel.guild_id, data: { channel_id, message_id, @@ -140,7 +138,6 @@ router.put("/:emoji/:user_id", async (req: Request, res: Response) => { await emitEvent({ event: "MESSAGE_REACTION_ADD", channel_id, - guild_id: channel.guild_id, data: { user_id: req.user_id, channel_id, @@ -179,7 +176,6 @@ router.delete("/:emoji/:user_id", async (req: Request, res: Response) => { await emitEvent({ event: "MESSAGE_REACTION_REMOVE", channel_id, - guild_id: channel.guild_id, data: { user_id: req.user_id, channel_id, diff --git a/src/routes/channels/#channel_id/permissions.ts b/src/routes/channels/#channel_id/permissions.ts index f3cef53e..12364293 100644 --- a/src/routes/channels/#channel_id/permissions.ts +++ b/src/routes/channels/#channel_id/permissions.ts @@ -44,7 +44,6 @@ router.put("/:overwrite_id", check({ allow: String, deny: String, type: Number, await emitEvent({ event: "CHANNEL_UPDATE", channel_id, - guild_id: channel.guild_id, data: channel } as ChannelUpdateEvent); @@ -64,7 +63,6 @@ router.delete("/:overwrite_id", async (req: Request, res: Response) => { await emitEvent({ event: "CHANNEL_UPDATE", channel_id, - guild_id: channel.guild_id, data: channel } as ChannelUpdateEvent); diff --git a/src/routes/channels/#channel_id/pins.ts b/src/routes/channels/#channel_id/pins.ts index f5bd2ef7..65d6b975 100644 --- a/src/routes/channels/#channel_id/pins.ts +++ b/src/routes/channels/#channel_id/pins.ts @@ -32,14 +32,12 @@ router.put("/:message_id", async (req: Request, res: Response) => { await emitEvent({ event: "MESSAGE_UPDATE", channel_id, - guild_id: channel.guild_id, data: message } as MessageUpdateEvent); await emitEvent({ event: "CHANNEL_PINS_UPDATE", channel_id, - guild_id: channel.guild_id, data: { channel_id, guild_id: channel.guild_id, @@ -64,14 +62,12 @@ router.delete("/:message_id", async (req: Request, res: Response) => { await emitEvent({ event: "MESSAGE_UPDATE", channel_id, - guild_id: channel.guild_id, data: message } as MessageUpdateEvent); await emitEvent({ event: "CHANNEL_PINS_UPDATE", channel_id, - guild_id: channel.guild_id, data: { channel_id, guild_id: channel.guild_id, diff --git a/src/routes/channels/#channel_id/typing.ts b/src/routes/channels/#channel_id/typing.ts index 2c2b9bc9..de549883 100644 --- a/src/routes/channels/#channel_id/typing.ts +++ b/src/routes/channels/#channel_id/typing.ts @@ -16,7 +16,6 @@ router.post("/", async (req: Request, res: Response) => { await emitEvent({ event: "TYPING_START", channel_id: channel_id, - guild_id: channel.guild_id, data: { // this is the paylod member: toObject(member), |