Add author and mentions relation to fetching messages

This commit is contained in:
Rory& 2025-09-28 23:44:00 +02:00
parent 871880996b
commit 2f1b131b0f
2 changed files with 7 additions and 0 deletions

View File

@ -129,6 +129,8 @@ router.get(
"sticker_items",
"attachments",
"referenced_message",
"referenced_message.author",
"referenced_message.mentions",
],
};

View File

@ -21,6 +21,7 @@ declare global {
containsAll(target: T[]): boolean;
partition(filter: (elem: T) => boolean): [T[], T[]];
single(filter: (elem: T) => boolean): T | null;
forEachAsync(callback: (elem: T, index: number, array: T[]) => Promise<void>): Promise<void>;
}
}
@ -43,6 +44,10 @@ export function single<T>(array: T[], filter: (elem: T) => boolean): T | null {
return results[0];
}
export async function forEachAsync<T>(array: T[], callback: (elem: T, index: number, array: T[]) => Promise<void>): Promise<void> {
await Promise.all(array.map(callback));
}
// register extensions
if (!Array.prototype.containsAll)
Array.prototype.containsAll = function <T>(this: T[], target: T[]) {