mirror of
https://github.com/koreanbots/core.git
synced 2025-12-16 14:30:22 +00:00
20 lines
478 B
TypeScript
20 lines
478 B
TypeScript
import DataLoader from 'dataloader'
|
|
import * as Query from './Query'
|
|
|
|
const Fetch = {
|
|
bot: new DataLoader(
|
|
async (ids: string[]) => await Promise.all(ids.map((el: string) => Query.getBot(el))),
|
|
{
|
|
batchScheduleFn: callback => setTimeout(callback, 1000),
|
|
}
|
|
),
|
|
user: new DataLoader(
|
|
async (ids: string[]) => await Promise.all(ids.map((el: string) => Query.getUser(el))),
|
|
{
|
|
batchScheduleFn: callback => setTimeout(callback, 1000),
|
|
}
|
|
),
|
|
}
|
|
|
|
export default Fetch
|