From 7aac53e44cdcfbe500bbcd3312217cd5912ad87f Mon Sep 17 00:00:00 2001 From: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> Date: Sun, 4 Apr 2021 00:42:02 +0000 Subject: [PATCH] fix: imports from mod.ts are bad --- src/helpers/channels/create_channel.ts | 21 ++++++++++--------- src/helpers/channels/delete_channel.ts | 2 +- .../channels/edit_channel_overwrite.ts | 2 +- src/helpers/channels/follow_channel.ts | 2 +- src/helpers/channels/get_channel.ts | 2 +- src/helpers/channels/get_channel_webhooks.ts | 2 +- src/helpers/channels/get_channels.ts | 2 +- src/helpers/channels/get_pins.ts | 2 +- src/helpers/channels/swap_channels.ts | 2 +- src/ws/shard_manager.ts | 2 +- 10 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/helpers/channels/create_channel.ts b/src/helpers/channels/create_channel.ts index daf1b2040..6292308fa 100644 --- a/src/helpers/channels/create_channel.ts +++ b/src/helpers/channels/create_channel.ts @@ -1,12 +1,10 @@ import { cacheHandlers } from "../../cache.ts"; import { rest } from "../../rest/rest.ts"; import { structures } from "../../structures/mod.ts"; -import { - CreateGuildChannel, - DiscordChannel, - DiscordChannelTypes, - PermissionStrings, -} from "../../types/mod.ts"; +import { DiscordChannel } from "../../types/channels/channel.ts"; +import { DiscordChannelTypes } from "../../types/channels/channel_types.ts"; +import { CreateGuildChannel } from "../../types/guilds/create_guild_channel.ts"; +import { PermissionStrings } from "../../types/permissions/permission_strings.ts"; import { endpoints } from "../../util/constants.ts"; import { calculateBits, @@ -17,7 +15,7 @@ import { export async function createChannel( guildId: string, name: string, - options?: CreateGuildChannel, + options?: CreateGuildChannel ) { const requiredPerms: Set = new Set(["MANAGE_CHANNELS"]); @@ -28,8 +26,10 @@ export async function createChannel( await requireBotGuildPermissions(guildId, [...requiredPerms]); - const result = - (await rest.runMethod("post", endpoints.GUILD_CHANNELS(guildId), { + const result = (await rest.runMethod( + "post", + endpoints.GUILD_CHANNELS(guildId), + { ...options, name, permission_overwrites: options?.permissionOverwrites?.map((perm) => ({ @@ -39,7 +39,8 @@ export async function createChannel( deny: calculateBits(perm.deny), })), type: options?.type || DiscordChannelTypes.GUILD_TEXT, - })) as DiscordChannel; + } + )) as DiscordChannel; const channelStruct = await structures.createChannelStruct(result); await cacheHandlers.set("channels", channelStruct.id, channelStruct); diff --git a/src/helpers/channels/delete_channel.ts b/src/helpers/channels/delete_channel.ts index 3a2e92797..764c73844 100644 --- a/src/helpers/channels/delete_channel.ts +++ b/src/helpers/channels/delete_channel.ts @@ -1,6 +1,6 @@ import { cacheHandlers } from "../../cache.ts"; import { rest } from "../../rest/rest.ts"; -import { Errors } from "../../types/mod.ts"; +import { Errors } from "../../types/misc/errors.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/channels/edit_channel_overwrite.ts b/src/helpers/channels/edit_channel_overwrite.ts index e68b357e6..451dd6f08 100644 --- a/src/helpers/channels/edit_channel_overwrite.ts +++ b/src/helpers/channels/edit_channel_overwrite.ts @@ -1,5 +1,5 @@ import { rest } from "../../rest/rest.ts"; -import { Overwrite } from "../../types/mod.ts"; +import { Overwrite } from "../../types/channels/overwrite.ts"; import { endpoints } from "../../util/constants.ts"; import { calculateBits, diff --git a/src/helpers/channels/follow_channel.ts b/src/helpers/channels/follow_channel.ts index bd44d8bc7..b8c9e7e27 100644 --- a/src/helpers/channels/follow_channel.ts +++ b/src/helpers/channels/follow_channel.ts @@ -1,5 +1,5 @@ import { rest } from "../../rest/rest.ts"; -import { DiscordFollowedChannel } from "../../types/mod.ts"; +import { DiscordFollowedChannel } from "../../types/channels/followed_channel.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotChannelPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/channels/get_channel.ts b/src/helpers/channels/get_channel.ts index 8badc5ac8..bd5e880bb 100644 --- a/src/helpers/channels/get_channel.ts +++ b/src/helpers/channels/get_channel.ts @@ -1,7 +1,7 @@ import { cacheHandlers } from "../../cache.ts"; import { rest } from "../../rest/rest.ts"; import { structures } from "../../structures/mod.ts"; -import { DiscordChannel } from "../../types/mod.ts"; +import { DiscordChannel } from "../../types/channels/channel.ts"; import { endpoints } from "../../util/constants.ts"; /** Fetches a single channel object from the api. diff --git a/src/helpers/channels/get_channel_webhooks.ts b/src/helpers/channels/get_channel_webhooks.ts index 050c21e01..2fd0ecd4b 100644 --- a/src/helpers/channels/get_channel_webhooks.ts +++ b/src/helpers/channels/get_channel_webhooks.ts @@ -1,5 +1,5 @@ import { rest } from "../../rest/rest.ts"; -import { DiscordWebhook } from "../../types/mod.ts"; +import { DiscordWebhook } from "../../types/webhooks/webhook.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotChannelPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/channels/get_channels.ts b/src/helpers/channels/get_channels.ts index c62c91256..21b0999d0 100644 --- a/src/helpers/channels/get_channels.ts +++ b/src/helpers/channels/get_channels.ts @@ -1,7 +1,7 @@ import { cacheHandlers } from "../../cache.ts"; import { rest } from "../../rest/rest.ts"; import { structures } from "../../structures/mod.ts"; -import { DiscordChannel } from "../../types/mod.ts"; +import { DiscordChannel } from "../../types/channels/channel.ts"; import { endpoints } from "../../util/constants.ts"; /** Returns a list of guild channel objects. diff --git a/src/helpers/channels/get_pins.ts b/src/helpers/channels/get_pins.ts index d47b93a5d..6f6d12a2d 100644 --- a/src/helpers/channels/get_pins.ts +++ b/src/helpers/channels/get_pins.ts @@ -1,6 +1,6 @@ import { rest } from "../../rest/rest.ts"; import { structures } from "../../structures/mod.ts"; -import { DiscordMessage } from "../../types/mod.ts"; +import { DiscordMessage } from "../../types/messages/message.ts"; import { endpoints } from "../../util/constants.ts"; /** Get pinned messages in this channel. */ diff --git a/src/helpers/channels/swap_channels.ts b/src/helpers/channels/swap_channels.ts index a85b8ca07..8b3662278 100644 --- a/src/helpers/channels/swap_channels.ts +++ b/src/helpers/channels/swap_channels.ts @@ -1,5 +1,5 @@ import { rest } from "../../rest/rest.ts"; -import { ModifyGuildChannelPositions } from "../../types/mod.ts"; +import { ModifyGuildChannelPositions } from "../../types/guilds/modify_guild_channel_position.ts"; import { endpoints } from "../../util/constants.ts"; /** Modify the positions of channels on the guild. Requires MANAGE_CHANNELS permisison. */ diff --git a/src/ws/shard_manager.ts b/src/ws/shard_manager.ts index 7789baa01..e02a93c21 100644 --- a/src/ws/shard_manager.ts +++ b/src/ws/shard_manager.ts @@ -2,7 +2,7 @@ import { eventHandlers } from "../bot.ts"; import { cache } from "../cache.ts"; import { handlers } from "../handlers/mod.ts"; import { Member } from "../structures/mod.ts"; -import { DiscordGatewayOpcodes } from "../types/mod.ts"; +import { DiscordGatewayOpcodes } from "../types/codes/gateway_opcodes.ts"; import { Collection } from "../util/collection.ts"; import { delay } from "../util/utils.ts"; import { createShard, requestGuildMembers } from "./mod.ts";