diff --git a/.vscode/settings.json b/.vscode/settings.json index 4d22d991b..cfa053007 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,7 @@ { "deno.enable": true, - "editor.formatOnSave": true + "editor.formatOnSave": true, + "deno.import_intellisense_origins": { + "https://deno.land": true + } } diff --git a/deps.ts b/deps.ts new file mode 100644 index 000000000..c1e06a977 --- /dev/null +++ b/deps.ts @@ -0,0 +1,10 @@ +export { encode } from "https://deno.land/std@0.67.0/encoding/base64.ts"; +export { + WebSocket, + connectWebSocket, + isWebSocketCloseEvent, + isWebSocketPingEvent, + isWebSocketPongEvent, +} from "https://deno.land/std@0.67.0/ws/mod.ts"; +export { delay } from "https://deno.land/std@0.67.0/async/delay.ts"; +export { inflate } from "https://deno.land/x/zlib.es@v1.0.0/mod.ts"; diff --git a/src/controllers/misc.ts b/src/controllers/misc.ts index 7184a3584..153dcfb4e 100644 --- a/src/controllers/misc.ts +++ b/src/controllers/misc.ts @@ -9,7 +9,7 @@ import type { } from "../types/discord.ts"; import { allowNextShard } from "../module/shardingManager.ts"; -import { delay } from "https://deno.land/std@0.67.0/async/delay.ts"; +import { delay } from "../../deps.ts"; import { eventHandlers, setBotID } from "../module/client.ts"; import { structures } from "../structures/mod.ts"; import { cache } from "../utils/cache.ts"; diff --git a/src/handlers/message.ts b/src/handlers/message.ts index a1d95cdc9..d4d3f2007 100644 --- a/src/handlers/message.ts +++ b/src/handlers/message.ts @@ -3,7 +3,7 @@ import type { MessageContent } from "../types/channel.ts"; import type { UserPayload } from "../types/guild.ts"; import type { MessageCreateOptions } from "../types/message.ts"; -import { delay } from "https://deno.land/std@0.67.0/async/delay.ts"; +import { delay } from "../../deps.ts"; import { structures } from "../structures/mod.ts"; import { cacheHandlers } from "../controllers/cache.ts"; import { botID } from "../module/client.ts"; diff --git a/src/module/basicShard.ts b/src/module/basicShard.ts index d2be980f6..4955b7300 100644 --- a/src/module/basicShard.ts +++ b/src/module/basicShard.ts @@ -6,7 +6,7 @@ import { isWebSocketPingEvent, isWebSocketPongEvent, WebSocket, -} from "https://deno.land/std@0.67.0/ws/mod.ts"; +} from "../../deps.ts"; import type { DiscordHeartbeatPayload } from "../types/discord.ts"; import type { FetchMembersOptions } from "../types/guild.ts"; import type { BotStatusRequest } from "../utils/utils.ts"; @@ -17,8 +17,8 @@ import { eventHandlers, botGatewayData, } from "./client.ts"; -import { delay } from "https://deno.land/std@0.67.0/async/delay.ts"; -import { inflate } from "https://deno.land/x/zlib.es@v1.0.0/mod.ts"; +import { delay } from "../../deps.ts"; +import { inflate } from "../../deps.ts"; const basicShards = new Map(); const heartbeating = new Set(); diff --git a/src/module/requestManager.ts b/src/module/requestManager.ts index 816d57e69..e0a04b02c 100644 --- a/src/module/requestManager.ts +++ b/src/module/requestManager.ts @@ -4,7 +4,7 @@ import { baseEndpoints } from "../constants/discord.ts"; import type { RequestMethods } from "../types/fetch.ts"; import { Errors } from "../types/errors.ts"; -import { delay } from "https://deno.land/std@0.67.0/async/delay.ts"; +import { delay } from "../../deps.ts"; const pathQueues: { [key: string]: QueuedRequest[] } = {}; const ratelimitedPaths = new Map(); diff --git a/src/module/shard.ts b/src/module/shard.ts index 46ccec024..b9f24a6e1 100644 --- a/src/module/shard.ts +++ b/src/module/shard.ts @@ -1,4 +1,4 @@ -import type { WebSocket } from "https://deno.land/std@0.67.0/ws/mod.ts"; +import type { WebSocket } from "../../deps.ts"; import type { DiscordBotGatewayData, DiscordHeartbeatPayload, @@ -8,11 +8,11 @@ import type { FetchMembersOptions } from "../types/guild.ts"; import type { DebugArg } from "../types/options.ts"; import { GatewayOpcode } from "../types/discord.ts"; -import { delay } from "https://deno.land/std@0.67.0/async/delay.ts"; +import { delay } from "../../deps.ts"; import { connectWebSocket, isWebSocketCloseEvent, -} from "https://deno.land/std@0.67.0/ws/mod.ts"; +} from "../../deps.ts"; let shardSocket: WebSocket; diff --git a/src/module/shardingManager.ts b/src/module/shardingManager.ts index 815585e76..b1eba89c2 100644 --- a/src/module/shardingManager.ts +++ b/src/module/shardingManager.ts @@ -20,7 +20,7 @@ import { identifyPayload, } from "./client.ts"; import { GatewayOpcode } from "../types/discord.ts"; -import { delay } from "https://deno.land/std@0.67.0/async/delay.ts"; +import { delay } from "../../deps.ts"; let shardCounter = 0; let basicSharding = false; diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 24d0a5183..194701611 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -2,7 +2,7 @@ import type { StatusType } from "../types/discord.ts"; import { ActivityType } from "../types/activity.ts"; import { sendGatewayCommand } from "../module/shardingManager.ts"; -import { encode } from "https://deno.land/std@0.67.0/encoding/base64.ts"; +import { encode } from "../../deps.ts"; export const sleep = (timeout: number) => { return new Promise((resolve) => setTimeout(resolve, timeout));