diff --git a/src/controllers/bans.ts b/src/controllers/bans.ts index 67d026031..be689ade5 100644 --- a/src/controllers/bans.ts +++ b/src/controllers/bans.ts @@ -1,6 +1,5 @@ import { eventHandlers } from "../module/client.ts"; -import { DiscordPayload } from "../types/discord.ts"; -import { GuildBanPayload } from "../types/guild.ts"; +import { DiscordPayload, GuildBanPayload } from "../types/types.ts"; import { cacheHandlers } from "./cache.ts"; export async function handleInternalGuildBanAdd(data: DiscordPayload) { diff --git a/src/controllers/cache.ts b/src/controllers/cache.ts index 6577bef04..e6cbdfc58 100644 --- a/src/controllers/cache.ts +++ b/src/controllers/cache.ts @@ -1,8 +1,5 @@ -import { Channel } from "../structures/channel.ts"; -import { Guild } from "../structures/guild.ts"; -import { Member } from "../structures/member.ts"; -import { Message } from "../structures/message.ts"; -import { PresenceUpdatePayload } from "../types/discord.ts"; +import { Channel, Guild, Member, Message } from "../structures/structures.ts"; +import { PresenceUpdatePayload } from "../types/types.ts"; import { cache } from "../utils/cache.ts"; import { Collection } from "../utils/collection.ts"; diff --git a/src/controllers/channels.ts b/src/controllers/channels.ts index f34887ed1..b9dc88ebc 100644 --- a/src/controllers/channels.ts +++ b/src/controllers/channels.ts @@ -1,7 +1,10 @@ import { eventHandlers } from "../module/client.ts"; -import { structures } from "../structures/mod.ts"; -import { ChannelCreatePayload, ChannelTypes } from "../types/channel.ts"; -import { DiscordPayload } from "../types/discord.ts"; +import { structures } from "../structures/structures.ts"; +import { + ChannelCreatePayload, + ChannelTypes, + DiscordPayload, +} from "../types/types.ts"; import { cacheHandlers } from "./cache.ts"; export async function handleInternalChannelCreate(data: DiscordPayload) { diff --git a/src/controllers/guilds.ts b/src/controllers/guilds.ts index 306ebedc5..1d93068c9 100644 --- a/src/controllers/guilds.ts +++ b/src/controllers/guilds.ts @@ -1,13 +1,13 @@ import { eventHandlers } from "../module/client.ts"; -import { structures } from "../structures/mod.ts"; -import { DiscordPayload } from "../types/discord.ts"; +import { structures } from "../structures/structures.ts"; import { CreateGuildPayload, + DiscordPayload, GuildDeletePayload, GuildEmojisUpdatePayload, + GuildUpdateChange, UpdateGuildPayload, -} from "../types/guild.ts"; -import { GuildUpdateChange } from "../types/options.ts"; +} from "../types/types.ts"; import { cache } from "../utils/cache.ts"; import { cacheHandlers } from "./cache.ts"; diff --git a/src/controllers/members.ts b/src/controllers/members.ts index 4bf966d17..04a6608b3 100644 --- a/src/controllers/members.ts +++ b/src/controllers/members.ts @@ -1,12 +1,12 @@ import { eventHandlers } from "../module/client.ts"; -import { structures } from "../structures/mod.ts"; -import { DiscordPayload } from "../types/discord.ts"; +import { structures } from "../structures/structures.ts"; import { + DiscordPayload, GuildBanPayload, GuildMemberAddPayload, GuildMemberChunkPayload, GuildMemberUpdatePayload, -} from "../types/guild.ts"; +} from "../types/types.ts"; import { cache } from "../utils/cache.ts"; import { cacheHandlers } from "./cache.ts"; diff --git a/src/controllers/messages.ts b/src/controllers/messages.ts index f82c7a3b7..db8b48482 100644 --- a/src/controllers/messages.ts +++ b/src/controllers/messages.ts @@ -1,11 +1,11 @@ import { eventHandlers } from "../module/client.ts"; -import { structures } from "../structures/mod.ts"; -import { DiscordPayload } from "../types/discord.ts"; +import { structures } from "../structures/structures.ts"; import { + DiscordPayload, MessageCreateOptions, MessageDeleteBulkPayload, MessageDeletePayload, -} from "../types/message.ts"; +} from "../types/types.ts"; import { cacheHandlers } from "./cache.ts"; export async function handleInternalMessageCreate(data: DiscordPayload) { diff --git a/src/controllers/misc.ts b/src/controllers/misc.ts index 2a950a420..7ef4ffa87 100644 --- a/src/controllers/misc.ts +++ b/src/controllers/misc.ts @@ -2,16 +2,16 @@ import { delay } from "../../deps.ts"; import { initialMemberLoadQueue } from "../../mod.ts"; import { eventHandlers, setBotID } from "../module/client.ts"; import { allowNextShard } from "../module/shardingManager.ts"; -import { structures } from "../structures/mod.ts"; +import { structures } from "../structures/structures.ts"; import { DiscordPayload, PresenceUpdatePayload, ReadyPayload, TypingStartPayload, + UserPayload, VoiceStateUpdatePayload, WebhookUpdatePayload, -} from "../types/discord.ts"; -import { UserPayload } from "../types/guild.ts"; +} from "../types/types.ts"; import { cache } from "../utils/cache.ts"; import { cacheHandlers } from "./cache.ts"; diff --git a/src/controllers/reactions.ts b/src/controllers/reactions.ts index b8a075eee..1738c736b 100644 --- a/src/controllers/reactions.ts +++ b/src/controllers/reactions.ts @@ -1,11 +1,11 @@ import { botID, eventHandlers } from "../module/client.ts"; -import { structures } from "../structures/mod.ts"; -import { DiscordPayload } from "../types/discord.ts"; +import { structures } from "../structures/structures.ts"; import { BaseMessageReactionPayload, + DiscordPayload, MessageReactionPayload, MessageReactionRemoveEmojiPayload, -} from "../types/message.ts"; +} from "../types/types.ts"; import { cacheHandlers } from "./cache.ts"; export async function handleInternalMessageReactionAdd(data: DiscordPayload) { diff --git a/src/controllers/roles.ts b/src/controllers/roles.ts index 229556788..d45132ae6 100644 --- a/src/controllers/roles.ts +++ b/src/controllers/roles.ts @@ -1,7 +1,10 @@ import { eventHandlers } from "../module/client.ts"; -import { structures } from "../structures/mod.ts"; -import { DiscordPayload } from "../types/discord.ts"; -import { GuildRoleDeletePayload, GuildRolePayload } from "../types/guild.ts"; +import { structures } from "../structures/structures.ts"; +import { + DiscordPayload, + GuildRoleDeletePayload, + GuildRolePayload, +} from "../types/types.ts"; import { cacheHandlers } from "./cache.ts"; export async function handleInternalGuildRoleCreate(data: DiscordPayload) { diff --git a/src/handlers/channel.ts b/src/handlers/channel.ts index 2c5a1f219..c3daa3ccd 100644 --- a/src/handlers/channel.ts +++ b/src/handlers/channel.ts @@ -1,22 +1,23 @@ import { cacheHandlers } from "../controllers/cache.ts"; import { RequestManager } from "../module/requestManager.ts"; -import { structures } from "../structures/mod.ts"; +import { structures } from "../structures/structures.ts"; import { ChannelEditOptions, ChannelTypes, CreateInviteOptions, + Errors, FollowedChannelPayload, GetMessages, GetMessagesAfter, GetMessagesAround, GetMessagesBefore, MessageContent, -} from "../types/channel.ts"; -import { Errors } from "../types/errors.ts"; -import { RawOverwrite } from "../types/guild.ts"; -import { MessageCreateOptions } from "../types/message.ts"; -import { Permission, Permissions } from "../types/permission.ts"; -import { WebhookPayload } from "../types/webhook.ts"; + MessageCreateOptions, + Permission, + Permissions, + RawOverwrite, + WebhookPayload, +} from "../types/types.ts"; import { endpoints } from "../utils/constants.ts"; import { botHasChannelPermissions } from "../utils/permissions.ts"; diff --git a/src/handlers/guild.ts b/src/handlers/guild.ts index 877a9f2cb..5da9d86bc 100644 --- a/src/handlers/guild.ts +++ b/src/handlers/guild.ts @@ -2,18 +2,19 @@ import { cacheHandlers } from "../controllers/cache.ts"; import { identifyPayload } from "../module/client.ts"; import { RequestManager } from "../module/requestManager.ts"; import { requestAllMembers } from "../module/shardingManager.ts"; -import { Guild } from "../structures/guild.ts"; -import { Member } from "../structures/member.ts"; -import { structures } from "../structures/mod.ts"; -import { Template } from "../structures/template.ts"; -import { ImageFormats, ImageSize } from "../types/cdn.ts"; -import { ChannelCreatePayload, ChannelTypes } from "../types/channel.ts"; -import { Errors } from "../types/errors.ts"; +import { + Guild, + Member, + structures, + Template, +} from "../structures/structures.ts"; import { AuditLogs, BannedUser, BanOptions, ChannelCreateOptions, + ChannelCreatePayload, + ChannelTypes, CreateEmojisOptions, CreateGuildFromTemplate, CreateGuildPayload, @@ -23,20 +24,23 @@ import { EditEmojisOptions, EditGuildTemplate, EditIntegrationOptions, + Errors, FetchMembersOptions, GetAuditLogsOptions, GuildEditOptions, GuildTemplate, + ImageFormats, + ImageSize, + Intents, + MemberCreatePayload, + Permissions, PositionSwap, PruneOptions, PrunePayload, + RoleData, UpdateGuildPayload, UserPayload, -} from "../types/guild.ts"; -import { MemberCreatePayload } from "../types/member.ts"; -import { Intents } from "../types/options.ts"; -import { Permissions } from "../types/permission.ts"; -import { RoleData } from "../types/role.ts"; +} from "../types/types.ts"; import { formatImageURL } from "../utils/cdn.ts"; import { Collection } from "../utils/collection.ts"; import { endpoints } from "../utils/constants.ts"; diff --git a/src/handlers/member.ts b/src/handlers/member.ts index 0a4c3b2a7..52911e28d 100644 --- a/src/handlers/member.ts +++ b/src/handlers/member.ts @@ -1,12 +1,15 @@ import { cacheHandlers } from "../controllers/cache.ts"; import { botID } from "../module/client.ts"; import { RequestManager } from "../module/requestManager.ts"; -import { Member } from "../structures/member.ts"; -import { structures } from "../structures/mod.ts"; -import { ImageFormats, ImageSize } from "../types/cdn.ts"; -import { DMChannelCreatePayload, MessageContent } from "../types/channel.ts"; -import { Errors } from "../types/errors.ts"; -import { EditMemberOptions } from "../types/member.ts"; +import { Member, structures } from "../structures/structures.ts"; +import { + DMChannelCreatePayload, + EditMemberOptions, + Errors, + ImageFormats, + ImageSize, + MessageContent, +} from "../types/types.ts"; import { formatImageURL } from "../utils/cdn.ts"; import { endpoints } from "../utils/constants.ts"; import { diff --git a/src/handlers/message.ts b/src/handlers/message.ts index 3118b245a..d8a26a0af 100644 --- a/src/handlers/message.ts +++ b/src/handlers/message.ts @@ -2,12 +2,13 @@ import { delay } from "../../deps.ts"; import { cacheHandlers } from "../controllers/cache.ts"; import { botID } from "../module/client.ts"; import { RequestManager } from "../module/requestManager.ts"; -import { Message } from "../structures/message.ts"; -import { structures } from "../structures/mod.ts"; -import { MessageContent } from "../types/channel.ts"; -import { Errors } from "../types/errors.ts"; -import { UserPayload } from "../types/guild.ts"; -import { MessageCreateOptions } from "../types/message.ts"; +import { Message, structures } from "../structures/structures.ts"; +import { + Errors, + MessageContent, + MessageCreateOptions, + UserPayload, +} from "../types/types.ts"; import { endpoints } from "../utils/constants.ts"; import { botHasChannelPermissions } from "../utils/permissions.ts"; diff --git a/src/handlers/webhook.ts b/src/handlers/webhook.ts index 6c0a0bee3..f59a403ff 100644 --- a/src/handlers/webhook.ts +++ b/src/handlers/webhook.ts @@ -1,12 +1,12 @@ import { RequestManager } from "../module/requestManager.ts"; -import { structures } from "../structures/mod.ts"; -import { Errors } from "../types/errors.ts"; -import { MessageCreateOptions } from "../types/message.ts"; +import { structures } from "../structures/structures.ts"; import { + Errors, ExecuteWebhookOptions, + MessageCreateOptions, WebhookCreateOptions, WebhookPayload, -} from "../types/webhook.ts"; +} from "../types/types.ts"; import { endpoints } from "../utils/constants.ts"; import { botHasChannelPermissions } from "../utils/permissions.ts"; import { urlToBase64 } from "../utils/utils.ts"; diff --git a/src/module/client.ts b/src/module/client.ts index 21ab49219..66b4bd5c3 100644 --- a/src/module/client.ts +++ b/src/module/client.ts @@ -1,5 +1,8 @@ -import { DiscordBotGatewayData } from "../types/discord.ts"; -import { ClientOptions, EventHandlers } from "../types/options.ts"; +import { + ClientOptions, + DiscordBotGatewayData, + EventHandlers, +} from "../types/types.ts"; import { baseEndpoints, endpoints } from "../utils/constants.ts"; import { RequestManager } from "./requestManager.ts"; import { spawnShards } from "./shardingManager.ts"; diff --git a/src/module/requestManager.ts b/src/module/requestManager.ts index bdec45be9..164a485b7 100644 --- a/src/module/requestManager.ts +++ b/src/module/requestManager.ts @@ -1,7 +1,5 @@ import { delay } from "../../deps.ts"; -import { HttpResponseCode } from "../types/discord.ts"; -import { Errors } from "../types/errors.ts"; -import { RequestMethods } from "../types/fetch.ts"; +import { Errors, HttpResponseCode, RequestMethods } from "../types/types.ts"; import { baseEndpoints, discordAPIURLS } from "../utils/constants.ts"; import { authorization, eventHandlers } from "./client.ts"; diff --git a/src/module/shard.ts b/src/module/shard.ts index 71475aa03..f18298f80 100644 --- a/src/module/shard.ts +++ b/src/module/shard.ts @@ -3,10 +3,10 @@ import { eventHandlers } from "../../mod.ts"; import { DiscordBotGatewayData, DiscordHeartbeatPayload, + FetchMembersOptions, GatewayOpcode, ReadyPayload, -} from "../types/discord.ts"; -import { FetchMembersOptions } from "../types/guild.ts"; +} from "../types/types.ts"; import { BotStatusRequest } from "../utils/utils.ts"; import { IdentifyPayload, proxyWSURL } from "./client.ts"; import { handleDiscordPayload } from "./shardingManager.ts"; diff --git a/src/module/shardingManager.ts b/src/module/shardingManager.ts index 42a1f69b9..2c456cfb5 100644 --- a/src/module/shardingManager.ts +++ b/src/module/shardingManager.ts @@ -1,12 +1,12 @@ import { delay } from "../../deps.ts"; import { controllers } from "../controllers/mod.ts"; -import { Guild } from "../structures/guild.ts"; +import { Guild } from "../structures/structures.ts"; import { DiscordBotGatewayData, DiscordPayload, + FetchMembersOptions, GatewayOpcode, -} from "../types/discord.ts"; -import { FetchMembersOptions } from "../types/guild.ts"; +} from "../types/types.ts"; import { cache } from "../utils/cache.ts"; import { BotStatusRequest } from "../utils/utils.ts"; import { diff --git a/src/structures/channel.ts b/src/structures/channel.ts index ce90156cc..fa3029636 100644 --- a/src/structures/channel.ts +++ b/src/structures/channel.ts @@ -1,6 +1,5 @@ import { cacheHandlers } from "../controllers/cache.ts"; -import { ChannelCreatePayload } from "../types/channel.ts"; -import { Unpromise } from "../types/misc.ts"; +import { ChannelCreatePayload, Unpromise } from "../types/types.ts"; export async function createChannel( data: ChannelCreatePayload, diff --git a/src/structures/guild.ts b/src/structures/guild.ts index c6febf732..f0c9ab4aa 100644 --- a/src/structures/guild.ts +++ b/src/structures/guild.ts @@ -1,6 +1,8 @@ -import { CreateGuildPayload } from "../types/guild.ts"; -import { MemberCreatePayload } from "../types/member.ts"; -import { Unpromise } from "../types/misc.ts"; +import { + CreateGuildPayload, + MemberCreatePayload, + Unpromise, +} from "../types/types.ts"; import { Collection } from "../utils/collection.ts"; import { structures } from "./mod.ts"; diff --git a/src/structures/member.ts b/src/structures/member.ts index 917713dc7..a85ae2c37 100644 --- a/src/structures/member.ts +++ b/src/structures/member.ts @@ -1,6 +1,5 @@ import { cacheHandlers } from "../controllers/cache.ts"; -import { GuildMember, MemberCreatePayload } from "../types/member.ts"; -import { Unpromise } from "../types/misc.ts"; +import { GuildMember, MemberCreatePayload, Unpromise } from "../types/types.ts"; import { Collection } from "../utils/collection.ts"; export async function createMember(data: MemberCreatePayload, guildID: string) { diff --git a/src/structures/message.ts b/src/structures/message.ts index 7dd515a01..193ed9304 100644 --- a/src/structures/message.ts +++ b/src/structures/message.ts @@ -1,5 +1,4 @@ -import { MessageCreateOptions } from "../types/message.ts"; -import { Unpromise } from "../types/misc.ts"; +import { MessageCreateOptions, Unpromise } from "../types/types.ts"; export async function createMessage(data: MessageCreateOptions) { const { diff --git a/src/structures/role.ts b/src/structures/role.ts index 87dd84f60..51ace0370 100644 --- a/src/structures/role.ts +++ b/src/structures/role.ts @@ -1,5 +1,4 @@ -import { Unpromise } from "../types/misc.ts"; -import { RoleData } from "../types/role.ts"; +import { RoleData, Unpromise } from "../types/types.ts"; export async function createRole(data: RoleData) { const { tags, ...rest } = data; diff --git a/src/structures/structures.ts b/src/structures/structures.ts new file mode 100644 index 000000000..5c2bdd66c --- /dev/null +++ b/src/structures/structures.ts @@ -0,0 +1,7 @@ +export * from "./channel.ts"; +export * from "./guild.ts"; +export * from "./member.ts"; +export * from "./message.ts"; +export * from "./mod.ts"; +export * from "./role.ts"; +export * from "./template.ts"; diff --git a/src/structures/template.ts b/src/structures/template.ts index 59d84a99a..bb199a20b 100644 --- a/src/structures/template.ts +++ b/src/structures/template.ts @@ -1,4 +1,4 @@ -import { GuildTemplate } from "../types/guild.ts"; +import { GuildTemplate } from "../types/types.ts"; export function createTemplate( data: GuildTemplate, diff --git a/src/types/guild.ts b/src/types/guild.ts index 5addee40d..e4a3be36a 100644 --- a/src/types/guild.ts +++ b/src/types/guild.ts @@ -1,4 +1,4 @@ -import { Guild } from "../structures/guild.ts"; +import { Guild } from "../structures/structures.ts"; import { ChannelCreatePayload, ChannelTypes } from "./channel.ts"; import { Emoji, StatusType } from "./discord.ts"; import { MemberCreatePayload } from "./member.ts"; diff --git a/src/types/message.ts b/src/types/message.ts index 807030996..ebedb18bb 100644 --- a/src/types/message.ts +++ b/src/types/message.ts @@ -1,4 +1,4 @@ -import { Channel } from "../structures/channel.ts"; +import { Channel } from "../structures/structures.ts"; import { ChannelType } from "./channel.ts"; import { UserPayload } from "./guild.ts"; import { MemberCreatePayload } from "./member.ts"; diff --git a/src/types/options.ts b/src/types/options.ts index 268e97d3d..efa8fc408 100644 --- a/src/types/options.ts +++ b/src/types/options.ts @@ -1,8 +1,10 @@ -import { Channel } from "../structures/channel.ts"; -import { Guild } from "../structures/guild.ts"; -import { Member } from "../structures/member.ts"; -import { Message } from "../structures/message.ts"; -import { Role } from "../structures/role.ts"; +import { + Channel, + Guild, + Member, + Message, + Role, +} from "../structures/structures.ts"; import { DiscordPayload, Emoji, diff --git a/src/types/types.ts b/src/types/types.ts new file mode 100644 index 000000000..30de803b8 --- /dev/null +++ b/src/types/types.ts @@ -0,0 +1,15 @@ +export * from "./activity.ts"; +export * from "./cdn.ts"; +export * from "./channel.ts"; +export * from "./discord.ts"; +export * from "./errors.ts"; +export * from "./fetch.ts"; +export * from "./guild.ts"; +export * from "./member.ts"; +export * from "./message.ts"; +export * from "./misc.ts"; +export * from "./options.ts"; +export * from "./permission.ts"; +export * from "./presence.ts"; +export * from "./role.ts"; +export * from "./webhook.ts"; diff --git a/src/utils/cache.ts b/src/utils/cache.ts index d897e4b3e..6126b1f69 100644 --- a/src/utils/cache.ts +++ b/src/utils/cache.ts @@ -1,8 +1,5 @@ -import { Channel } from "../structures/channel.ts"; -import { Guild } from "../structures/guild.ts"; -import { Member } from "../structures/member.ts"; -import { Message } from "../structures/message.ts"; -import { PresenceUpdatePayload } from "../types/discord.ts"; +import { Channel, Guild, Member, Message } from "../structures/structures.ts"; +import { PresenceUpdatePayload } from "../types/types.ts"; import { Collection } from "./collection.ts"; export interface CacheData { diff --git a/src/utils/cdn.ts b/src/utils/cdn.ts index 6c5275ac5..670bef910 100644 --- a/src/utils/cdn.ts +++ b/src/utils/cdn.ts @@ -1,4 +1,4 @@ -import { ImageFormats, ImageSize } from "../types/cdn.ts"; +import { ImageFormats, ImageSize } from "../types/types.ts"; export const formatImageURL = ( url: string, diff --git a/src/utils/permissions.ts b/src/utils/permissions.ts index c932ee987..9b9ed6664 100644 --- a/src/utils/permissions.ts +++ b/src/utils/permissions.ts @@ -1,9 +1,7 @@ import { cacheHandlers } from "../controllers/cache.ts"; import { botID } from "../module/client.ts"; -import { Guild } from "../structures/guild.ts"; -import { Role } from "../structures/role.ts"; -import { RawOverwrite } from "../types/guild.ts"; -import { Permission, Permissions } from "../types/permission.ts"; +import { Guild, Role } from "../structures/structures.ts"; +import { Permission, Permissions, RawOverwrite } from "../types/types.ts"; /** Checks if the member has this permission. If the member is an owner or has admin perms it will always be true. */ export async function memberIDHasPermission( diff --git a/src/utils/utils.ts b/src/utils/utils.ts index c73a6033f..bacaf4c6c 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -1,7 +1,6 @@ import { encode } from "../../deps.ts"; import { sendGatewayCommand } from "../module/shardingManager.ts"; -import { ActivityType } from "../types/activity.ts"; -import { StatusType } from "../types/discord.ts"; +import { ActivityType, StatusType } from "../types/types.ts"; export const sleep = (timeout: number) => { return new Promise((resolve) => setTimeout(resolve, timeout));