Add author and mentions relation to fetching messages
This commit is contained in:
parent
871880996b
commit
2f1b131b0f
@ -129,6 +129,8 @@ router.get(
|
||||
"sticker_items",
|
||||
"attachments",
|
||||
"referenced_message",
|
||||
"referenced_message.author",
|
||||
"referenced_message.mentions",
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@ -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[]) {
|
||||
|
||||
Reference in New Issue
Block a user