Files
discordeno/packages/benchmark/src/utils/db.ts
T
dependabot[bot]andFleny e31c4d0a8a build(deps-dev): bump eslint-config-standard-with-typescript from 40.0.0 to 42.0.0 (#3297)
* build(deps-dev): bump eslint-config-standard-with-typescript

Bumps [eslint-config-standard-with-typescript](https://github.com/standard/eslint-config-standard-with-typescript) from 40.0.0 to 42.0.0.
- [Release notes](https://github.com/standard/eslint-config-standard-with-typescript/releases)
- [Changelog](https://github.com/standard/eslint-config-standard-with-typescript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/standard/eslint-config-standard-with-typescript/compare/v40.0.0...v42.0.0)

---
updated-dependencies:
- dependency-name: eslint-config-standard-with-typescript
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Disable @typescript-eslint/no-unsafe-argument for the logger

* Fix eslint errors

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Fleny <Fleny113@outlook.com>
2023-12-11 22:04:40 +00:00

35 lines
1015 B
TypeScript

/* eslint-disable @typescript-eslint/no-unsafe-argument */
import type { DiscordGatewayPayload } from '@discordeno/types'
import fetch from 'node-fetch'
import fs from 'node:fs/promises'
export const events: Array<{
shardId: number
payload: DiscordGatewayPayload
}> = []
try {
const files = await fs.readdir('db/events')
for await (const file of files) {
const eventsInFile: Array<
| {
shardId: number
payload: DiscordGatewayPayload
}
| string
> = Object.values(await fs.readFile(`db/events/${file}`, 'utf8').then((text) => JSON.parse(text)))
eventsInFile.forEach((eventInFile) => {
if (typeof eventInFile === 'string') return
events.push(eventInFile)
})
}
} catch {
const event = await fetch('https://raw.githubusercontent.com/discordeno/benchmarks/main/db/events/10.json')
.then(async (res) => await res.json())
.then((eventsInFile: any) => eventsInFile['0'])
for (let i = 0; i < 10; i++) {
events.push(event)
}
}