summary refs log tree commit diff
path: root/api/src/util/handlers/Message.ts
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-08 04:27:28 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-09 23:28:27 +0200
commitd52d9c62fc30e31e2c01bf6b63f9aedebdde216f (patch)
treee0f7fd130aeeecb9964e1f359eea6b4e124de7da /api/src/util/handlers/Message.ts
parentClean dependencies (diff)
downloadserver-d52d9c62fc30e31e2c01bf6b63f9aedebdde216f.tar.xz
Bunch of fixes and improvements, everything appears to work now
Diffstat (limited to 'api/src/util/handlers/Message.ts')
-rw-r--r--api/src/util/handlers/Message.ts8
1 files changed, 4 insertions, 4 deletions
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<Message> { 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> { } } - 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