summary refs log tree commit diff
path: root/src/api/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/util')
-rw-r--r--src/api/util/handlers/Message.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts

index 14efa95b..c3658668 100644 --- a/src/api/util/handlers/Message.ts +++ b/src/api/util/handlers/Message.ts
@@ -117,6 +117,12 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> { const guild = await Guild.findOneOrFail({ where: { id: channel.guild_id }, }); + + if (!opts.message_reference.guild_id) + opts.message_reference.guild_id = channel.guild_id; + if (!opts.message_reference.channel_id) + opts.message_reference.channel_id = opts.channel_id; + if (!guild.features.includes("CROSS_CHANNEL_REPLIES")) { if (opts.message_reference.guild_id !== channel.guild_id) throw new HTTPError( @@ -127,6 +133,8 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> { "You can only reference messages from this channel", ); } + + message.message_reference = opts.message_reference; } /** Q: should be checked if the referenced message exists? ANSWER: NO otherwise backfilling won't work **/