diff --git a/mod.ts b/mod.ts index ff4bcf6..797f8d7 100644 --- a/mod.ts +++ b/mod.ts @@ -5,4 +5,6 @@ export default Session; export * from './packages/biscuit/mod.ts'; export * from './packages/discordeno/mod.ts'; export * from './packages/cache/mod.ts'; +export * from './packages/api-types/discord.ts'; +export * from './packages/api-types/shared.ts'; export { default as enableCache } from './packages/cache/mod.ts'; diff --git a/packages/discordeno/types/discord.ts b/packages/api-types/discord.ts similarity index 100% rename from packages/discordeno/types/discord.ts rename to packages/api-types/discord.ts diff --git a/packages/discordeno/types/shared.ts b/packages/api-types/shared.ts similarity index 100% rename from packages/discordeno/types/shared.ts rename to packages/api-types/shared.ts diff --git a/packages/biscuit/Routes.ts b/packages/biscuit/Routes.ts index eb8e219..5a0e632 100644 --- a/packages/biscuit/Routes.ts +++ b/packages/biscuit/Routes.ts @@ -426,19 +426,19 @@ export function GUILD_STICKERS(guildId: Snowflake, stickerId?: Snowflake): strin return `/guilds/${guildId}/stickers`; } -/** +/** * Return the widget for the guild. - * @link https://discord.com/developers/docs/resources/guild#get-guild-widget-settings + * @link https://discord.com/developers/docs/resources/guild#get-guild-widget-settings */ export interface GetWidget { get: 'json' | 'image' | 'settings'; } -/** - * /guilds/{guildId}/widget +/** + * /guilds/{guildId}/widget * @link https://discord.com/developers/docs/resources/guild#get-guild-widget-settings */ -export function GUILD_WIDGET(guildId: Snowflake, options: GetWidget = {get: 'settings'}): string { +export function GUILD_WIDGET(guildId: Snowflake, options: GetWidget = { get: 'settings' }): string { let url = `/guilds/${guildId}/widget`; if (options.get === 'json') { url += '.json'; @@ -446,5 +446,5 @@ export function GUILD_WIDGET(guildId: Snowflake, options: GetWidget = {get: 'set url += '.png'; } - return url -} \ No newline at end of file + return url; +} diff --git a/packages/biscuit/structures/channels.ts b/packages/biscuit/structures/channels.ts index 007eb40..a4c7b07 100644 --- a/packages/biscuit/structures/channels.ts +++ b/packages/biscuit/structures/channels.ts @@ -33,7 +33,7 @@ import ThreadMember from './ThreadMember.ts'; /** * Abstract class that represents the base for creating a new channel. -*/ + */ export abstract class BaseChannel implements Model { constructor(session: Session, data: DiscordChannel) { this.id = data.id; @@ -93,7 +93,7 @@ export abstract class BaseChannel implements Model { /** * @link https://discord.com/developers/docs/resources/channel#create-channel-invite-json-params * Represents the options object to create an invitation -*/ + */ export interface DiscordInviteOptions { /** duration of invite in seconds before expiry, or 0 for never. between 0 and 604800 (7 days) */ maxAge?: number; @@ -122,7 +122,7 @@ export interface CreateWebhook { } /** Available text-channel-types list */ -export const textBasedChannels:ChannelTypes[] = [ +export const textBasedChannels: ChannelTypes[] = [ ChannelTypes.DM, ChannelTypes.GroupDm, ChannelTypes.GuildPrivateThread, @@ -208,7 +208,7 @@ export class TextChannel { } } - /** + /** * fetchPins makes an asynchronous request and gets the current channel pins. * @returns A promise that resolves with an array of Message objects. */ @@ -221,7 +221,7 @@ export class TextChannel { return messages[0] ? messages.map((x: DiscordMessage) => new Message(this.session, x)) : []; } - /** + /** * createInvite makes an asynchronous request to create a new invitation. * @param options - The options to create the invitation * @returns The created invite @@ -247,10 +247,10 @@ export class TextChannel { return new Invite(this.session, invite); } - /** + /** * fetchMessages makes an asynchronous request and gets the channel messages * @param options - The options to get the messages - * @returns The messages + * @returns The messages */ async fetchMessages(options?: Routes.GetMessagesOptions): Promise { if (options?.limit! > 100) throw Error('Values must be between 0-100'); @@ -271,7 +271,7 @@ export class TextChannel { ); } - /** + /** * pinMessage pins a channel message. * Same as Message.pin(). * @param messageId - The id of the message to pin @@ -281,7 +281,7 @@ export class TextChannel { await Message.prototype.pin.call({ id: messageId, channelId: this.id, session: this.session }); } - /** + /** * unpinMessage unpin a channel message. * Same as Message.unpin() * @param messageId - The id of the message to unpin @@ -291,7 +291,7 @@ export class TextChannel { await Message.prototype.unpin.call({ id: messageId, channelId: this.id, session: this.session }); } - /** + /** * addReaction adds a reaction to the message. * Same as Message.addReaction(). * @param messageId - The message to add the reaction to @@ -305,7 +305,7 @@ export class TextChannel { ); } - /** + /** * removeReaction removes a reaction from the message. * Same as Message.removeReaction(). * @param messageId - The id of the message to remove the reaction from @@ -324,7 +324,7 @@ export class TextChannel { ); } - /** + /** * removeReactionEmoji removes an emoji reaction from the messageId provided. * Same as Message.removeReactionEmoji(). * @param messageId - The message id to remove the reaction from. @@ -347,7 +347,7 @@ export class TextChannel { await Message.prototype.nukeReactions.call({ channelId: this.id, id: messageId }); } - /** + /** * fetchReactions gets the users who reacted with this emoji on the message. * Same as Message.fetchReactions(). * @param messageId - The message id to get the reactions from. diff --git a/packages/discordeno/gateway/manager/gatewayManager.ts b/packages/discordeno/gateway/manager/gatewayManager.ts index 48b75c2..742f590 100644 --- a/packages/discordeno/gateway/manager/gatewayManager.ts +++ b/packages/discordeno/gateway/manager/gatewayManager.ts @@ -1,5 +1,5 @@ -import { DiscordGatewayPayload } from '../../types/discord.ts'; -import { GatewayBot, PickPartial } from '../../types/shared.ts'; +import { DiscordGatewayPayload } from '../../../api-types/discord.ts'; +import { GatewayBot, PickPartial } from '../../../api-types/shared.ts'; import { LeakyBucket } from '../../util/bucket.ts'; import { CreateShard, createShard } from '../shard/createShard.ts'; import { Shard, ShardGatewayConfig } from '../shard/types.ts'; diff --git a/packages/discordeno/gateway/manager/shardManager.ts b/packages/discordeno/gateway/manager/shardManager.ts index 79cbb34..af22f65 100644 --- a/packages/discordeno/gateway/manager/shardManager.ts +++ b/packages/discordeno/gateway/manager/shardManager.ts @@ -1,5 +1,5 @@ -import { DiscordGatewayPayload } from '../../types/discord.ts'; -import { PickPartial } from '../../types/shared.ts'; +import { DiscordGatewayPayload } from '../../../api-types/discord.ts'; +import { PickPartial } from '../../../api-types/shared.ts'; import { CreateShard, createShard } from '../shard/createShard.ts'; import { Shard, ShardGatewayConfig } from '../shard/types.ts'; diff --git a/packages/discordeno/gateway/manager/spawnShards.ts b/packages/discordeno/gateway/manager/spawnShards.ts index b897284..581ee1a 100644 --- a/packages/discordeno/gateway/manager/spawnShards.ts +++ b/packages/discordeno/gateway/manager/spawnShards.ts @@ -1,4 +1,4 @@ -import { GatewayIntents } from '../../types/shared.ts'; +import { GatewayIntents } from '../../../api-types/shared.ts'; import { createLeakyBucket } from '../../util/bucket.ts'; import { createShard } from '../shard/createShard.ts'; import { Shard } from '../shard/types.ts'; diff --git a/packages/discordeno/gateway/manager/tellWorkerToIdentify.ts b/packages/discordeno/gateway/manager/tellWorkerToIdentify.ts index 38955cf..87e1363 100644 --- a/packages/discordeno/gateway/manager/tellWorkerToIdentify.ts +++ b/packages/discordeno/gateway/manager/tellWorkerToIdentify.ts @@ -1,4 +1,4 @@ -import { GatewayIntents } from '../../types/shared.ts'; +import { GatewayIntents } from '../../../api-types/shared.ts'; import { createShard } from '../shard/createShard.ts'; import { GatewayManager } from './gatewayManager.ts'; diff --git a/packages/discordeno/gateway/shard/createShard.ts b/packages/discordeno/gateway/shard/createShard.ts index 48e1f2b..44605e1 100644 --- a/packages/discordeno/gateway/shard/createShard.ts +++ b/packages/discordeno/gateway/shard/createShard.ts @@ -23,8 +23,8 @@ import { connect } from './connect.ts'; import { close } from './close.ts'; import { shutdown } from './shutdown.ts'; import { isOpen } from './isOpen.ts'; -import { DiscordGatewayPayload, DiscordStatusUpdate } from '../../types/discord.ts'; -import { GatewayIntents, PickPartial } from '../../types/shared.ts'; +import { DiscordGatewayPayload, DiscordStatusUpdate } from '../../../api-types/discord.ts'; +import { GatewayIntents, PickPartial } from '../../../api-types/shared.ts'; import { API_VERSION } from '../../util/constants.ts'; // TODO: debug diff --git a/packages/discordeno/gateway/shard/handleClose.ts b/packages/discordeno/gateway/shard/handleClose.ts index 318d8be..5642fbf 100644 --- a/packages/discordeno/gateway/shard/handleClose.ts +++ b/packages/discordeno/gateway/shard/handleClose.ts @@ -1,4 +1,4 @@ -import { GatewayCloseEventCodes } from '../../types/shared.ts'; +import { GatewayCloseEventCodes } from '../../../api-types/shared.ts'; import { Shard, ShardSocketCloseCodes, ShardState } from './types.ts'; export async function handleClose(shard: Shard, close: CloseEvent): Promise { diff --git a/packages/discordeno/gateway/shard/handleMessage.ts b/packages/discordeno/gateway/shard/handleMessage.ts index 9aa9ab4..c4cbcb2 100644 --- a/packages/discordeno/gateway/shard/handleMessage.ts +++ b/packages/discordeno/gateway/shard/handleMessage.ts @@ -1,5 +1,5 @@ -import { DiscordGatewayPayload, DiscordHello, DiscordReady } from '../../types/discord.ts'; -import { GatewayOpcodes } from '../../types/shared.ts'; +import { DiscordGatewayPayload, DiscordHello, DiscordReady } from '../../../api-types/discord.ts'; +import { GatewayOpcodes } from '../../../api-types/shared.ts'; import { createLeakyBucket } from '../../util/bucket.ts'; import { delay } from '../../util/delay.ts'; import { decompressWith } from './deps.ts'; diff --git a/packages/discordeno/gateway/shard/identify.ts b/packages/discordeno/gateway/shard/identify.ts index c494e2d..7d3c670 100644 --- a/packages/discordeno/gateway/shard/identify.ts +++ b/packages/discordeno/gateway/shard/identify.ts @@ -1,4 +1,4 @@ -import { GatewayOpcodes } from '../../types/shared.ts'; +import { GatewayOpcodes } from '../../../api-types/shared.ts'; import { Shard, ShardSocketCloseCodes, ShardState } from './types.ts'; export async function identify(shard: Shard): Promise { diff --git a/packages/discordeno/gateway/shard/resume.ts b/packages/discordeno/gateway/shard/resume.ts index 769fe77..bba5d4a 100644 --- a/packages/discordeno/gateway/shard/resume.ts +++ b/packages/discordeno/gateway/shard/resume.ts @@ -1,4 +1,4 @@ -import { GatewayOpcodes } from '../../types/shared.ts'; +import { GatewayOpcodes } from '../../../api-types/shared.ts'; import { Shard, ShardSocketCloseCodes, ShardState } from './types.ts'; export async function resume(shard: Shard): Promise { diff --git a/packages/discordeno/gateway/shard/startHeartbeating.ts b/packages/discordeno/gateway/shard/startHeartbeating.ts index df799ab..d8436c8 100644 --- a/packages/discordeno/gateway/shard/startHeartbeating.ts +++ b/packages/discordeno/gateway/shard/startHeartbeating.ts @@ -1,4 +1,4 @@ -import { GatewayOpcodes } from '../../types/shared.ts'; +import { GatewayOpcodes } from '../../../api-types/shared.ts'; import { Shard, ShardSocketCloseCodes, ShardState } from './types.ts'; export function startHeartbeating(shard: Shard, interval: number) { diff --git a/packages/discordeno/gateway/shard/types.ts b/packages/discordeno/gateway/shard/types.ts index 39dc892..0f1acee 100644 --- a/packages/discordeno/gateway/shard/types.ts +++ b/packages/discordeno/gateway/shard/types.ts @@ -1,5 +1,5 @@ -import { DiscordGatewayPayload } from '../../types/discord.ts'; -import { GatewayOpcodes } from '../../types/shared.ts'; +import { DiscordGatewayPayload } from '../../../api-types/discord.ts'; +import { GatewayOpcodes } from '../../../api-types/shared.ts'; import { createShard } from './createShard.ts'; // TODO: think whether we also need an identifiedShard function diff --git a/packages/discordeno/mod.ts b/packages/discordeno/mod.ts index 50e1a07..bb83816 100644 --- a/packages/discordeno/mod.ts +++ b/packages/discordeno/mod.ts @@ -1,5 +1,6 @@ export * from './gateway/mod.ts'; export * from './rest/mod.ts'; -export * from './types/mod.ts'; export * from './util/constants.ts'; export * from './util/token.ts'; +export * from '../api-types/discord.ts'; +export * from '../api-types/shared.ts'; diff --git a/packages/discordeno/rest/createRequestBody.ts b/packages/discordeno/rest/createRequestBody.ts index 8ed52e5..79f0163 100644 --- a/packages/discordeno/rest/createRequestBody.ts +++ b/packages/discordeno/rest/createRequestBody.ts @@ -1,5 +1,5 @@ import { RestManager } from './restManager.ts'; -import { FileContent } from '../types/shared.ts'; +import { FileContent } from '../../api-types/shared.ts'; import { USER_AGENT } from '../util/constants.ts'; import { RequestMethod, RestPayload, RestRequest } from './rest.ts'; diff --git a/packages/discordeno/rest/processGlobalQueue.ts b/packages/discordeno/rest/processGlobalQueue.ts index f0c794b..73f1782 100644 --- a/packages/discordeno/rest/processGlobalQueue.ts +++ b/packages/discordeno/rest/processGlobalQueue.ts @@ -1,5 +1,5 @@ import { RestManager } from './restManager.ts'; -import { HTTPResponseCodes } from '../types/shared.ts'; +import { HTTPResponseCodes } from '../../api-types/shared.ts'; export async function processGlobalQueue(rest: RestManager) { // IF QUEUE IS EMPTY EXIT diff --git a/packages/discordeno/rest/sendRequest.ts b/packages/discordeno/rest/sendRequest.ts index 26c7ece..7e9ec2d 100644 --- a/packages/discordeno/rest/sendRequest.ts +++ b/packages/discordeno/rest/sendRequest.ts @@ -1,4 +1,4 @@ -import { HTTPResponseCodes } from '../types/shared.ts'; +import { HTTPResponseCodes } from '../../api-types/shared.ts'; import { BASE_URL } from '../util/constants.ts'; import { RequestMethod } from './rest.ts'; import { RestManager } from './restManager.ts'; diff --git a/packages/discordeno/types/mod.ts b/packages/discordeno/types/mod.ts deleted file mode 100644 index c59b7fb..0000000 --- a/packages/discordeno/types/mod.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './discord.ts'; -export * from './shared.ts'; diff --git a/packages/discordeno/util/bucket.ts b/packages/discordeno/util/bucket.ts index 1c0af57..42d61e8 100644 --- a/packages/discordeno/util/bucket.ts +++ b/packages/discordeno/util/bucket.ts @@ -1,4 +1,4 @@ -import { PickPartial } from '../types/shared.ts'; +import { PickPartial } from '../../api-types/shared.ts'; import { delay } from './delay.ts'; /** A Leaky Bucket. diff --git a/packages/discordeno/util/mod.ts b/packages/discordeno/util/mod.ts deleted file mode 100644 index 2f6d895..0000000 --- a/packages/discordeno/util/mod.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './bucket.ts'; -export * from './collection.ts'; -export * from './constants.ts'; -export * from './delay.ts'; -export * from './token.ts';