Deprecation: Use object-based relations for typeorm

This commit is contained in:
Rory&
2025-12-19 21:06:12 +01:00
parent 7c247aedb9
commit 6162fbd520
55 changed files with 151 additions and 137 deletions
+11 -2
View File
@@ -61,7 +61,7 @@ const LINK_REGEX = /<?https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-
export async function handleMessage(opts: MessageOptions): Promise<Message> {
const channel = await Channel.findOneOrFail({
where: { id: opts.channel_id },
relations: ["recipients"],
relations: { recipients: true },
});
if (!channel || !opts.channel_id) throw new HTTPError("Channel not found", 404);
@@ -242,7 +242,16 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> {
where: {
id: opts.message_reference.message_id,
},
relations: ["author", "webhook", "application", "mentions", "mention_roles", "mention_channels", "sticker_items", "attachments"],
relations: {
author: true,
webhook: true,
application: true,
mentions: true,
mention_roles: true,
mention_channels: true,
sticker_items: true,
attachments: true,
},
});
if (message.referenced_message.channel_id && message.referenced_message.channel_id !== opts.message_reference.channel_id)
+1 -1
View File
@@ -14,7 +14,7 @@ export const executeWebhook = async (req: Request, res: Response) => {
where: {
id: webhook_id,
},
relations: ["channel", "guild", "application"],
relations: { channel: true, guild: true, application: true },
});
if (!webhook) {