From d52d9c62fc30e31e2c01bf6b63f9aedebdde216f Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Mon, 8 Aug 2022 04:27:28 +0200 Subject: Bunch of fixes and improvements, everything appears to work now --- api/src/util/handlers/Message.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'api/src/util') diff --git a/api/src/util/handlers/Message.ts b/api/src/util/handlers/Message.ts index 7035bc5c..34fb3d05 100644 --- a/api/src/util/handlers/Message.ts +++ b/api/src/util/handlers/Message.ts @@ -47,7 +47,7 @@ export async function handleMessage(opts: MessageOptions): Promise { const channel = await Channel.findOneOrFail({ where: { id: opts.channel_id }, relations: ["recipients"] }); if (!channel || !opts.channel_id) throw new HTTPError("Channel not found", 404); - const message = new Message({ + const message = Object.assign(new Message(), { ...opts, sticker_items: opts.sticker_ids?.map((x) => ({ id: x })), guild_id: channel.guild_id, @@ -132,9 +132,9 @@ export async function handleMessage(opts: MessageOptions): Promise { } } - message.mention_channels = mention_channel_ids.map((x) => new Channel({ id: x })); - message.mention_roles = mention_role_ids.map((x) => new Role({ id: x })); - message.mentions = mention_user_ids.map((x) => new User({ id: x })); + message.mention_channels = mention_channel_ids.map((x) => Object.assign(new Channel(), { id: x })); + message.mention_roles = mention_role_ids.map((x) => Object.assign(new Role(), { id: x })); + message.mentions = mention_user_ids.map((x) => Object.assign(new User(), { id: x })); message.mention_everyone = mention_everyone; // TODO: check and put it all in the body -- cgit 1.5.1