diff --git a/packages/api-types/CHANGELOG.md b/packages/api-types/CHANGELOG.md index c9fc723..0487e33 100644 --- a/packages/api-types/CHANGELOG.md +++ b/packages/api-types/CHANGELOG.md @@ -1,7 +1,7 @@ # @biscuitland/api-types -## 2.0.0 +## 2.0.1 ### Major Changes -- publish +- publish diff --git a/packages/api-types/README.md b/packages/api-types/README.md index 3c013b7..ef9490b 100644 --- a/packages/api-types/README.md +++ b/packages/api-types/README.md @@ -25,7 +25,7 @@ import type { DiscordUser } from '@biscuitland/api-types'; ## Example for [Deno](https://deno.land/) ```ts -import type { DiscordUser } from "https://unpkg.com/@biscuitland/api-types@1.3.2/dist/index.d.ts"; +import type { DiscordUser } from "https://unpkg.com/@biscuitland/api-types@2.0.1/dist/index.d.ts"; ``` We deliver this package through [unpkg](https://unpkg.com/) and it does contain constants and routes too diff --git a/packages/api-types/package.json b/packages/api-types/package.json index 259fa28..4af5361 100644 --- a/packages/api-types/package.json +++ b/packages/api-types/package.json @@ -1,6 +1,6 @@ { "name": "@biscuitland/api-types", - "version": "2.0.0", + "version": "2.0.1", "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", diff --git a/packages/api-types/src/utils/constants.ts b/packages/api-types/src/utils/constants.ts index 901a70a..4cb0bd7 100644 --- a/packages/api-types/src/utils/constants.ts +++ b/packages/api-types/src/utils/constants.ts @@ -5,7 +5,7 @@ export const BASE_URL = 'https://discord.com/api'; export const API_VERSION = 10; /** https://github.com/oasisjs/biscuit/releases */ -export const BISCUIT_VERSION = '1.3.2'; +export const BISCUIT_VERSION = '2.0.1'; /** https://discord.com/developers/docs/reference#user-agent */ export const USER_AGENT = `DiscordBot (https://github.com/oasisjs/biscuit, v${BISCUIT_VERSION})`; diff --git a/packages/cache/CHANGELOG.md b/packages/cache/CHANGELOG.md index d2e26e0..5249454 100644 --- a/packages/cache/CHANGELOG.md +++ b/packages/cache/CHANGELOG.md @@ -1,12 +1,12 @@ # @biscuitland/cache -## 2.0.0 +## 2.0.1 ### Major Changes -- publish +- publish ### Patch Changes -- Updated dependencies - - @biscuitland/api-types@2.0.0 +- Updated dependencies + - @biscuitland/api-types@2.0.1 diff --git a/packages/cache/package.json b/packages/cache/package.json index fcf143a..1c91db3 100644 --- a/packages/cache/package.json +++ b/packages/cache/package.json @@ -1,6 +1,6 @@ { "name": "@biscuitland/cache", - "version": "2.0.0", + "version": "2.0.1", "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", @@ -23,7 +23,7 @@ } }, "dependencies": { - "@biscuitland/api-types": "^2.0.0", + "@biscuitland/api-types": "^2.0.1", "ioredis": "^5.2.2" }, "devDependencies": { diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 5ddea37..08b0139 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,14 +1,14 @@ # @biscuitland/core -## 2.0.0 +## 2.0.1 ### Major Changes -- publish +- publish ### Patch Changes -- Updated dependencies - - @biscuitland/api-types@2.0.0 - - @biscuitland/rest@2.0.0 - - @biscuitland/ws@2.0.0 +- Updated dependencies + - @biscuitland/api-types@2.0.1 + - @biscuitland/rest@2.0.1 + - @biscuitland/ws@2.0.1 diff --git a/packages/core/package.json b/packages/core/package.json index 12ef2fe..0c5b17b 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@biscuitland/core", - "version": "2.0.0", + "version": "2.0.1", "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", @@ -23,9 +23,9 @@ } }, "dependencies": { - "@biscuitland/api-types": "^2.0.0", - "@biscuitland/rest": "^2.0.0", - "@biscuitland/ws": "^2.0.0" + "@biscuitland/api-types": "^2.0.1", + "@biscuitland/rest": "^2.0.1", + "@biscuitland/ws": "^2.0.1" }, "devDependencies": { "tsup": "^6.1.3" diff --git a/packages/helpers/CHANGELOG.md b/packages/helpers/CHANGELOG.md index ff3dfdf..b5d06e9 100644 --- a/packages/helpers/CHANGELOG.md +++ b/packages/helpers/CHANGELOG.md @@ -1,9 +1,9 @@ # @biscuitland/helpers -## 1.3.3 +## 2.0.1 ### Patch Changes -- Updated dependencies - - @biscuitland/api-types@2.0.0 - - @biscuitland/core@2.0.0 +- Updated dependencies + - @biscuitland/api-types@2.0.1 + - @biscuitland/core@2.0.1 diff --git a/packages/helpers/package.json b/packages/helpers/package.json index 89f06d1..5d547f2 100644 --- a/packages/helpers/package.json +++ b/packages/helpers/package.json @@ -1,6 +1,6 @@ { "name": "@biscuitland/helpers", - "version": "1.3.3", + "version": "2.0.1", "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", @@ -23,8 +23,8 @@ } }, "dependencies": { - "@biscuitland/api-types": "^2.0.0", - "@biscuitland/core": "^2.0.0" + "@biscuitland/api-types": "^2.0.1", + "@biscuitland/core": "^2.0.1" }, "devDependencies": { "tsup": "^6.1.3" diff --git a/packages/rest/CHANGELOG.md b/packages/rest/CHANGELOG.md index 24e5f3b..dc21694 100644 --- a/packages/rest/CHANGELOG.md +++ b/packages/rest/CHANGELOG.md @@ -1,12 +1,12 @@ # @biscuitland/rest -## 2.0.0 +## 2.0.1 ### Major Changes -- publish +- publish ### Patch Changes -- Updated dependencies - - @biscuitland/api-types@2.0.0 +- Updated dependencies + - @biscuitland/api-types@2.0.1 diff --git a/packages/rest/package.json b/packages/rest/package.json index 46837d2..dc59849 100644 --- a/packages/rest/package.json +++ b/packages/rest/package.json @@ -1,6 +1,6 @@ { "name": "@biscuitland/rest", - "version": "2.0.0", + "version": "2.0.1", "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", @@ -23,7 +23,7 @@ } }, "dependencies": { - "@biscuitland/api-types": "^2.0.0" + "@biscuitland/api-types": "^2.0.1" }, "devDependencies": { "tsup": "^6.1.3" diff --git a/packages/ws/CHANGELOG.md b/packages/ws/CHANGELOG.md index f435ce2..3c68104 100644 --- a/packages/ws/CHANGELOG.md +++ b/packages/ws/CHANGELOG.md @@ -1,12 +1,12 @@ # @biscuitland/ws -## 2.0.0 +## 2.0.1 ### Major Changes -- publish +- publish ### Patch Changes -- Updated dependencies - - @biscuitland/api-types@2.0.0 +- Updated dependencies + - @biscuitland/api-types@2.0.1 diff --git a/packages/ws/package.json b/packages/ws/package.json index 4ff6c84..500ad3a 100644 --- a/packages/ws/package.json +++ b/packages/ws/package.json @@ -1,6 +1,6 @@ { "name": "@biscuitland/ws", - "version": "2.0.0", + "version": "2.0.1", "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", @@ -23,7 +23,7 @@ } }, "dependencies": { - "@biscuitland/api-types": "^2.0.0", + "@biscuitland/api-types": "^2.0.1", "ws": "^8.8.1" }, "devDependencies": { diff --git a/packages/ws/src/utils/bucket-util.ts b/packages/ws/src/utils/bucket-util.ts index 180e4a2..3a7b97c 100644 --- a/packages/ws/src/utils/bucket-util.ts +++ b/packages/ws/src/utils/bucket-util.ts @@ -40,6 +40,14 @@ export interface LeakyBucket { waiting: ((_?: unknown) => void)[]; } +export function delay(ms: number): Promise { + return new Promise(result => + setTimeout(() => { + result(); + }, ms) + ); +} + /** Update the tokens of that bucket. * @returns {number} The amount of current available tokens. */ @@ -100,9 +108,7 @@ async function acquire( const refillsNeeded = Math.ceil(tokensNeeded / bucket.refillAmount); const waitTime = bucket.refillInterval * refillsNeeded; - // await delay(waitTime); - - await new Promise(() => setTimeout((): null => null, waitTime)); + await delay(waitTime); // Update the tokens again to ensure nothing has been missed. updateTokens(bucket);