Add author and mentions relation to fetching messages

This commit is contained in:
Rory&
2025-09-29 18:33:18 +02:00
parent 2d2d787f61
commit c00d13a5bd
2 changed files with 7 additions and 0 deletions
@@ -129,6 +129,8 @@ router.get(
"sticker_items",
"attachments",
"referenced_message",
"referenced_message.author",
"referenced_message.mentions",
],
};
+5
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[]) {