From c91c9d0870080f6ce81338dfaf417f09a2f87b60 Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Tue, 23 Mar 2021 15:14:26 +0000 Subject: [PATCH] types: remove entire types (#684) --- mod.ts | 1 - src/bot.ts | 35 - src/cache.ts | 20 - src/handlers/channels/CHANNEL_CREATE.ts | 1 - src/handlers/channels/CHANNEL_DELETE.ts | 5 - src/handlers/channels/CHANNEL_PINS_UPDATE.ts | 4 - src/handlers/channels/CHANNEL_UPDATE.ts | 1 - .../commands/APPLICATION_COMMAND_CREATE.ts | 1 - .../commands/APPLICATION_COMMAND_DELETE.ts | 1 - .../commands/APPLICATION_COMMAND_UPDATE.ts | 1 - src/handlers/emojis/GUILD_EMOJIS_UPDATE.ts | 1 - src/handlers/guilds/GUILD_BAN_ADD.ts | 1 - src/handlers/guilds/GUILD_BAN_REMOVE.ts | 1 - src/handlers/guilds/GUILD_CREATE.ts | 1 - src/handlers/guilds/GUILD_DELETE.ts | 1 - .../guilds/GUILD_INTEGRATIONS_UPDATE.ts | 4 - src/handlers/guilds/GUILD_UPDATE.ts | 5 - .../integrations/INTEGRATION_CREATE.ts | 4 - .../integrations/INTEGRATION_DELETE.ts | 1 - .../integrations/INTEGRATION_UPDATE.ts | 4 - .../interactions/INTERACTION_CREATE.ts | 1 - src/handlers/invites/INVITE_CREATE.ts | 1 - src/handlers/invites/INVITE_DELETE.ts | 1 - src/handlers/members/GUILD_MEMBERS_CHUNK.ts | 1 - src/handlers/members/GUILD_MEMBER_ADD.ts | 1 - src/handlers/members/GUILD_MEMBER_REMOVE.ts | 1 - src/handlers/members/GUILD_MEMBER_UPDATE.ts | 1 - src/handlers/messages/MESSAGE_CREATE.ts | 1 - src/handlers/messages/MESSAGE_DELETE.ts | 1 - src/handlers/messages/MESSAGE_DELETE_BULK.ts | 1 - src/handlers/messages/MESSAGE_REACTION_ADD.ts | 1 - .../messages/MESSAGE_REACTION_REMOVE.ts | 1 - .../messages/MESSAGE_REACTION_REMOVE_ALL.ts | 1 - .../messages/MESSAGE_REACTION_REMOVE_EMOJI.ts | 4 - src/handlers/messages/MESSAGE_UPDATE.ts | 1 - src/handlers/misc/PRESENCE_UPDATE.ts | 1 - src/handlers/misc/READY.ts | 1 - src/handlers/misc/TYPING_START.ts | 1 - src/handlers/misc/USER_UPDATE.ts | 1 - src/handlers/roles/GUILD_ROLE_CREATE.ts | 1 - src/handlers/roles/GUILD_ROLE_DELETE.ts | 1 - src/handlers/roles/GUILD_ROLE_UPDATE.ts | 1 - src/handlers/voice/VOICE_SERVER_UPDATE.ts | 4 - src/handlers/voice/VOICE_STATE_UPDATE.ts | 1 - src/handlers/webhooks/WEBHOOKS_UPDATE.ts | 1 - .../channel_overwrite_has_permission.ts | 2 - src/helpers/channels/create_channel.ts | 6 - src/helpers/channels/delete_channel.ts | 1 - src/helpers/channels/edit_channel.ts | 11 - .../channels/edit_channel_overwrite.ts | 1 - src/helpers/channels/follow_channel.ts | 1 - src/helpers/channels/get_channel.ts | 1 - src/helpers/channels/get_channel_webhooks.ts | 1 - src/helpers/channels/get_channels.ts | 1 - src/helpers/channels/get_pins.ts | 1 - src/helpers/channels/start_typing.ts | 1 - src/helpers/channels/swap_channels.ts | 1 - src/helpers/commands/create_slash_command.ts | 1 - src/helpers/commands/edit_slash_response.ts | 5 - src/helpers/commands/get_slash_command.ts | 1 - src/helpers/commands/get_slash_commands.ts | 1 - .../commands/send_interaction_response.ts | 1 - src/helpers/commands/upsert_slash_command.ts | 1 - src/helpers/commands/upsert_slash_commands.ts | 1 - src/helpers/emojis/create_emoji.ts | 1 - src/helpers/emojis/edit_emoji.ts | 1 - src/helpers/emojis/get_emoji.ts | 1 - src/helpers/emojis/get_emojis.ts | 1 - src/helpers/guilds/create_guild.ts | 1 - src/helpers/guilds/edit_guild.ts | 1 - src/helpers/guilds/get_audit_logs.ts | 1 - src/helpers/guilds/get_ban.ts | 1 - src/helpers/guilds/get_bans.ts | 1 - src/helpers/guilds/get_guild.ts | 1 - src/helpers/guilds/get_prune_count.ts | 1 - src/helpers/guilds/get_widget.ts | 1 - src/helpers/guilds/get_widget_image_url.ts | 1 - src/helpers/guilds/guild_banner_url.ts | 1 - src/helpers/guilds/guild_icon_url.ts | 1 - src/helpers/guilds/guild_splash_url.ts | 1 - src/helpers/integrations/edit_integration.ts | 1 - src/helpers/invites/create_invite.ts | 1 - src/helpers/invites/delete_invite.ts | 1 - src/helpers/invites/get_invite.ts | 1 - src/helpers/members/avatar_url.ts | 1 - src/helpers/members/ban_member.ts | 1 - src/helpers/members/edit_bot_profile.ts | 1 - src/helpers/members/edit_member.ts | 6 - src/helpers/members/fetch_members.ts | 1 - src/helpers/members/get_member.ts | 1 - src/helpers/members/get_members.ts | 6 - src/helpers/members/kick_member.ts | 1 - src/helpers/members/prune_members.ts | 1 - src/helpers/members/raw_avatar_url.ts | 1 - src/helpers/members/send_direct_message.ts | 5 - src/helpers/messages/delete_messages.ts | 1 - src/helpers/messages/edit_message.ts | 6 - src/helpers/messages/get_message.ts | 1 - src/helpers/messages/get_messages.ts | 7 - src/helpers/messages/get_reactions.ts | 1 - src/helpers/messages/publish_message.ts | 1 - src/helpers/messages/send_message.ts | 7 - src/helpers/misc/get_gateway_bot.ts | 1 - src/helpers/misc/get_user.ts | 1 - src/helpers/roles/add_role.ts | 1 - src/helpers/roles/create_role.ts | 1 - src/helpers/roles/edit_role.ts | 1 - src/helpers/roles/remove_role.ts | 1 - src/helpers/roles/swap_roles.ts | 1 - .../templates/create_guild_from_template.ts | 4 - .../templates/create_guild_template.ts | 1 - .../templates/delete_guild_template.ts | 1 - src/helpers/templates/edit_guild_template.ts | 1 - src/helpers/templates/get_guild_templates.ts | 1 - src/helpers/templates/get_template.ts | 1 - src/helpers/templates/sync_guild_template.ts | 1 - src/helpers/webhooks/create_webhook.ts | 5 - src/helpers/webhooks/edit_webhook.ts | 1 - src/helpers/webhooks/edit_webhook_message.ts | 5 - .../webhooks/edit_webhook_with_token.ts | 1 - src/helpers/webhooks/execute_webhook.ts | 5 - src/helpers/webhooks/get_webhook.ts | 1 - .../webhooks/get_webhook_with_token.ts | 1 - src/interactions/mod.ts | 1 - src/interactions/server.ts | 17 - src/interactions/types/embed.ts | 95 --- src/interactions/types/interactions.ts | 73 -- src/interactions/types/member.ts | 45 -- src/interactions/types/misc.ts | 8 - src/interactions/types/mod.ts | 6 - src/interactions/types/slash.ts | 86 --- src/interactions/types/webhook.ts | 27 - src/rest/cache.ts | 2 - src/rest/queue.ts | 1 - src/rest/request.ts | 5 - src/rest/request_manager.ts | 25 - src/rest/server.ts | 1 - src/rest/types/cache.ts | 15 - src/rest/types/http.ts | 14 - src/rest/types/mod.ts | 5 - src/rest/types/queue.ts | 20 - src/rest/types/requests.ts | 14 - src/rest/types/server.ts | 54 -- src/structures/channel.ts | 97 --- src/structures/guild.ts | 165 ---- src/structures/member.ts | 82 -- src/structures/message.ts | 126 --- src/structures/role.ts | 46 -- src/structures/template.ts | 30 - src/types/activity.ts | 67 -- src/types/api/auditlog.ts | 212 ------ src/types/api/channel.ts | 107 --- src/types/api/code.ts | 188 ----- src/types/api/embed.ts | 117 --- src/types/api/emoji.ts | 39 - src/types/api/event.ts | 350 --------- src/types/api/gateway.ts | 487 ------------ src/types/api/guild.ts | 465 ------------ src/types/api/image.ts | 3 - src/types/api/integration.ts | 145 ---- src/types/api/interaction.ts | 125 --- src/types/api/invite.ts | 46 -- src/types/api/member.ts | 89 --- src/types/api/message.ts | 290 ------- src/types/api/mod.ts | 22 - src/types/api/oauth2.ts | 37 - src/types/api/permission.ts | 10 - src/types/api/ratelimits.ts | 9 - src/types/api/role.ts | 31 - src/types/api/teams.ts | 31 - src/types/api/template.ts | 51 -- src/types/api/voice.ts | 14 - src/types/api/webhook.ts | 31 - src/types/cdn.ts | 6 - src/types/channel.ts | 176 ----- src/types/discord.ts | 380 --------- src/types/errors.ts | 77 -- src/types/fetch.ts | 7 - src/types/guild.ts | 718 ------------------ src/types/interactions.ts | 100 --- src/types/invite.ts | 28 - src/types/member.ts | 58 -- src/types/message.ts | 394 ---------- src/types/mod.ts | 17 - src/types/oauth.ts | 37 - src/types/options.ts | 351 --------- src/types/permission.ts | 36 - src/types/presence.ts | 12 - src/types/role.ts | 29 - src/types/teams.ts | 31 - src/types/webhook.ts | 246 ------ src/util/permissions.ts | 1 - src/util/utils.ts | 11 - src/ws/shard.ts | 27 - src/ws/shard_manager.ts | 7 - 195 files changed, 7043 deletions(-) delete mode 100644 src/interactions/types/embed.ts delete mode 100644 src/interactions/types/interactions.ts delete mode 100644 src/interactions/types/member.ts delete mode 100644 src/interactions/types/misc.ts delete mode 100644 src/interactions/types/mod.ts delete mode 100644 src/interactions/types/slash.ts delete mode 100644 src/interactions/types/webhook.ts delete mode 100644 src/rest/types/cache.ts delete mode 100644 src/rest/types/http.ts delete mode 100644 src/rest/types/mod.ts delete mode 100644 src/rest/types/queue.ts delete mode 100644 src/rest/types/requests.ts delete mode 100644 src/rest/types/server.ts delete mode 100644 src/types/activity.ts delete mode 100644 src/types/api/auditlog.ts delete mode 100644 src/types/api/channel.ts delete mode 100644 src/types/api/code.ts delete mode 100644 src/types/api/embed.ts delete mode 100644 src/types/api/emoji.ts delete mode 100644 src/types/api/event.ts delete mode 100644 src/types/api/gateway.ts delete mode 100644 src/types/api/guild.ts delete mode 100644 src/types/api/image.ts delete mode 100644 src/types/api/integration.ts delete mode 100644 src/types/api/interaction.ts delete mode 100644 src/types/api/invite.ts delete mode 100644 src/types/api/member.ts delete mode 100644 src/types/api/message.ts delete mode 100644 src/types/api/mod.ts delete mode 100644 src/types/api/oauth2.ts delete mode 100644 src/types/api/permission.ts delete mode 100644 src/types/api/ratelimits.ts delete mode 100644 src/types/api/role.ts delete mode 100644 src/types/api/teams.ts delete mode 100644 src/types/api/template.ts delete mode 100644 src/types/api/voice.ts delete mode 100644 src/types/api/webhook.ts delete mode 100644 src/types/cdn.ts delete mode 100644 src/types/channel.ts delete mode 100644 src/types/discord.ts delete mode 100644 src/types/errors.ts delete mode 100644 src/types/fetch.ts delete mode 100644 src/types/guild.ts delete mode 100644 src/types/interactions.ts delete mode 100644 src/types/invite.ts delete mode 100644 src/types/member.ts delete mode 100644 src/types/message.ts delete mode 100644 src/types/mod.ts delete mode 100644 src/types/oauth.ts delete mode 100644 src/types/options.ts delete mode 100644 src/types/permission.ts delete mode 100644 src/types/presence.ts delete mode 100644 src/types/role.ts delete mode 100644 src/types/teams.ts delete mode 100644 src/types/webhook.ts diff --git a/mod.ts b/mod.ts index f05bc440f..fd7473d1a 100644 --- a/mod.ts +++ b/mod.ts @@ -9,7 +9,6 @@ export * from "./src/structures/member.ts"; export * from "./src/structures/message.ts"; export * from "./src/structures/mod.ts"; export * from "./src/structures/role.ts"; -export * from "./src/types/mod.ts"; export * from "./src/util/collection.ts"; export * from "./src/util/permissions.ts"; export * from "./src/util/utils.ts"; diff --git a/src/bot.ts b/src/bot.ts index 3ea5fbfff..6a26e58e0 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -1,11 +1,4 @@ import { getGatewayBot } from "./helpers/misc/get_gateway_bot.ts"; -import { - BotConfig, - DiscordBotGatewayData, - DiscordIdentify, - EventHandlers, - Intents, -} from "./types/mod.ts"; import { baseEndpoints, GATEWAY_VERSION } from "./util/constants.ts"; import { spawnShards } from "./ws/shard_manager.ts"; @@ -32,19 +25,6 @@ export const identifyPayload: DiscordIdentify = { shard: [0, 0], }; -/** @deprecated Use "DiscordIdentify" instead */ -export interface IdentifyPayload { - token: string; - compress: boolean; - properties: { - $os: string; - $browser: string; - $device: string; - }; - intents: number; - shard: [number, number]; -} - export async function startBot(config: BotConfig) { if (config.eventHandlers) eventHandlers = config.eventHandlers; authorization = `Bot ${config.token}`; @@ -125,18 +105,3 @@ export async function startBigBrainBot(data: BigBrainBotConfig) { : botGatewayData.shards), ); } - -export interface BigBrainBotConfig extends BotConfig { - /** The first shard to start at for this worker. Use this to control which shards to run in each worker. */ - firstShardID: number; - /** The last shard to start for this worker. By default it will be 25 + the firstShardID. */ - lastShardID?: number; - /** This can be used to forward the ws handling to a proxy. */ - wsURL?: string; - /** This can be used to forward the REST handling to a proxy. */ - restURL?: string; - /** This can be used to forward the CDN handling to a proxy. */ - cdnURL?: string; - /** This is the authorization header that your rest proxy will validate */ - restAuthorization?: string; -} diff --git a/src/cache.ts b/src/cache.ts index 3b64e7d53..ba7d46992 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -1,7 +1,6 @@ // deno-lint-ignore-file require-await no-explicit-any prefer-const import { Channel, Guild, Member, Message } from "./structures/mod.ts"; -import { PresenceUpdatePayload } from "./types/mod.ts"; import { Collection } from "./util/collection.ts"; export const cache: CacheData = { @@ -163,22 +162,3 @@ async function filter( ) { return cache[table].filter(callback); } - -export interface CacheData { - isReady: boolean; - guilds: Collection; - channels: Collection; - messages: Collection; - members: Collection; - unavailableGuilds: Collection; - presences: Collection; - fetchAllMembersProcessingRequests: Collection< - string, - ( - value: - | Collection - | PromiseLike>, - ) => void - >; - executedSlashCommands: Collection; -} diff --git a/src/handlers/channels/CHANNEL_CREATE.ts b/src/handlers/channels/CHANNEL_CREATE.ts index d173000db..e2ac843c6 100644 --- a/src/handlers/channels/CHANNEL_CREATE.ts +++ b/src/handlers/channels/CHANNEL_CREATE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { ChannelCreatePayload, DiscordPayload } from "../../types/mod.ts"; import { structures } from "../../structures/mod.ts"; import { cacheHandlers } from "../../cache.ts"; diff --git a/src/handlers/channels/CHANNEL_DELETE.ts b/src/handlers/channels/CHANNEL_DELETE.ts index 0ddea96e2..3108c9082 100644 --- a/src/handlers/channels/CHANNEL_DELETE.ts +++ b/src/handlers/channels/CHANNEL_DELETE.ts @@ -1,9 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { - ChannelCreatePayload, - ChannelTypes, - DiscordPayload, -} from "../../types/mod.ts"; import { cacheHandlers } from "../../cache.ts"; export async function handleChannelDelete(data: DiscordPayload) { diff --git a/src/handlers/channels/CHANNEL_PINS_UPDATE.ts b/src/handlers/channels/CHANNEL_PINS_UPDATE.ts index a1d3f2c3e..6d973e920 100644 --- a/src/handlers/channels/CHANNEL_PINS_UPDATE.ts +++ b/src/handlers/channels/CHANNEL_PINS_UPDATE.ts @@ -1,8 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { - DiscordChannelPinsUpdateEvent, - DiscordPayload, -} from "../../types/mod.ts"; import { cacheHandlers } from "../../cache.ts"; export async function handleChannelPinsUpdate(data: DiscordPayload) { diff --git a/src/handlers/channels/CHANNEL_UPDATE.ts b/src/handlers/channels/CHANNEL_UPDATE.ts index bed067acf..e83c89b87 100644 --- a/src/handlers/channels/CHANNEL_UPDATE.ts +++ b/src/handlers/channels/CHANNEL_UPDATE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { ChannelCreatePayload, DiscordPayload } from "../../types/mod.ts"; import { structures } from "../../structures/mod.ts"; import { cacheHandlers } from "../../cache.ts"; diff --git a/src/handlers/commands/APPLICATION_COMMAND_CREATE.ts b/src/handlers/commands/APPLICATION_COMMAND_CREATE.ts index e4d31e341..52c334962 100644 --- a/src/handlers/commands/APPLICATION_COMMAND_CREATE.ts +++ b/src/handlers/commands/APPLICATION_COMMAND_CREATE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { ApplicationCommandEvent, DiscordPayload } from "../../types/mod.ts"; export function handleApplicationCommandCreate( data: DiscordPayload, diff --git a/src/handlers/commands/APPLICATION_COMMAND_DELETE.ts b/src/handlers/commands/APPLICATION_COMMAND_DELETE.ts index b5486d093..aa33e76fa 100644 --- a/src/handlers/commands/APPLICATION_COMMAND_DELETE.ts +++ b/src/handlers/commands/APPLICATION_COMMAND_DELETE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { ApplicationCommandEvent, DiscordPayload } from "../../types/mod.ts"; export function handleApplicationCommandDelete(data: DiscordPayload) { const { diff --git a/src/handlers/commands/APPLICATION_COMMAND_UPDATE.ts b/src/handlers/commands/APPLICATION_COMMAND_UPDATE.ts index 35f0302a7..7621330c2 100644 --- a/src/handlers/commands/APPLICATION_COMMAND_UPDATE.ts +++ b/src/handlers/commands/APPLICATION_COMMAND_UPDATE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { ApplicationCommandEvent, DiscordPayload } from "../../types/mod.ts"; export function handleApplicationCommandUpdate(data: DiscordPayload) { const { diff --git a/src/handlers/emojis/GUILD_EMOJIS_UPDATE.ts b/src/handlers/emojis/GUILD_EMOJIS_UPDATE.ts index 9b6527cc6..c9d7495b7 100644 --- a/src/handlers/emojis/GUILD_EMOJIS_UPDATE.ts +++ b/src/handlers/emojis/GUILD_EMOJIS_UPDATE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, GuildEmojisUpdatePayload } from "../../types/mod.ts"; import { Collection } from "../../util/collection.ts"; import { cacheHandlers } from "../../cache.ts"; diff --git a/src/handlers/guilds/GUILD_BAN_ADD.ts b/src/handlers/guilds/GUILD_BAN_ADD.ts index 4b77fa613..003d2fefd 100644 --- a/src/handlers/guilds/GUILD_BAN_ADD.ts +++ b/src/handlers/guilds/GUILD_BAN_ADD.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, GuildBanPayload } from "../../types/mod.ts"; import { cacheHandlers } from "../../cache.ts"; export async function handleGuildBanAdd(data: DiscordPayload) { diff --git a/src/handlers/guilds/GUILD_BAN_REMOVE.ts b/src/handlers/guilds/GUILD_BAN_REMOVE.ts index 740791baf..2985e1dfc 100644 --- a/src/handlers/guilds/GUILD_BAN_REMOVE.ts +++ b/src/handlers/guilds/GUILD_BAN_REMOVE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, GuildBanPayload } from "../../types/mod.ts"; import { cacheHandlers } from "../../cache.ts"; export async function handleGuildBanRemove(data: DiscordPayload) { diff --git a/src/handlers/guilds/GUILD_CREATE.ts b/src/handlers/guilds/GUILD_CREATE.ts index 51652a1ad..6bd50c2e2 100644 --- a/src/handlers/guilds/GUILD_CREATE.ts +++ b/src/handlers/guilds/GUILD_CREATE.ts @@ -1,7 +1,6 @@ import { eventHandlers } from "../../bot.ts"; import { cache, cacheHandlers } from "../../cache.ts"; import { structures } from "../../structures/mod.ts"; -import { CreateGuildPayload, DiscordPayload } from "../../types/mod.ts"; import { basicShards } from "../../ws/shard.ts"; export async function handleGuildCreate( diff --git a/src/handlers/guilds/GUILD_DELETE.ts b/src/handlers/guilds/GUILD_DELETE.ts index b8dbe9e2c..f8c725579 100644 --- a/src/handlers/guilds/GUILD_DELETE.ts +++ b/src/handlers/guilds/GUILD_DELETE.ts @@ -1,6 +1,5 @@ import { eventHandlers } from "../../bot.ts"; import { cacheHandlers } from "../../cache.ts"; -import { DiscordPayload, GuildDeletePayload } from "../../types/mod.ts"; import { basicShards } from "../../ws/shard.ts"; export async function handleGuildDelete( diff --git a/src/handlers/guilds/GUILD_INTEGRATIONS_UPDATE.ts b/src/handlers/guilds/GUILD_INTEGRATIONS_UPDATE.ts index 560b64de9..5efcf87a3 100644 --- a/src/handlers/guilds/GUILD_INTEGRATIONS_UPDATE.ts +++ b/src/handlers/guilds/GUILD_INTEGRATIONS_UPDATE.ts @@ -1,8 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { - DiscordGuildIntegrationsUpdateEvent, - DiscordPayload, -} from "../../types/mod.ts"; import { cacheHandlers } from "../../cache.ts"; export async function handleGuildIntegrationsUpdate( diff --git a/src/handlers/guilds/GUILD_UPDATE.ts b/src/handlers/guilds/GUILD_UPDATE.ts index c35dcdfa6..dea715910 100644 --- a/src/handlers/guilds/GUILD_UPDATE.ts +++ b/src/handlers/guilds/GUILD_UPDATE.ts @@ -1,9 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { - DiscordPayload, - GuildUpdateChange, - UpdateGuildPayload, -} from "../../types/mod.ts"; import { cacheHandlers } from "../../cache.ts"; export async function handleGuildUpdate(data: DiscordPayload) { diff --git a/src/handlers/integrations/INTEGRATION_CREATE.ts b/src/handlers/integrations/INTEGRATION_CREATE.ts index 2709ee275..1f22e832b 100644 --- a/src/handlers/integrations/INTEGRATION_CREATE.ts +++ b/src/handlers/integrations/INTEGRATION_CREATE.ts @@ -1,8 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { - DiscordPayload, - IntegrationCreateUpdateEvent, -} from "../../types/mod.ts"; export function handleIntegrationCreate( data: DiscordPayload, diff --git a/src/handlers/integrations/INTEGRATION_DELETE.ts b/src/handlers/integrations/INTEGRATION_DELETE.ts index 4586d03de..129698f51 100644 --- a/src/handlers/integrations/INTEGRATION_DELETE.ts +++ b/src/handlers/integrations/INTEGRATION_DELETE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, IntegrationDeleteEvent } from "../../types/mod.ts"; export function handleIntegrationDelete(data: DiscordPayload) { const { diff --git a/src/handlers/integrations/INTEGRATION_UPDATE.ts b/src/handlers/integrations/INTEGRATION_UPDATE.ts index f5daf44c9..743e63b38 100644 --- a/src/handlers/integrations/INTEGRATION_UPDATE.ts +++ b/src/handlers/integrations/INTEGRATION_UPDATE.ts @@ -1,8 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { - DiscordPayload, - IntegrationCreateUpdateEvent, -} from "../../types/mod.ts"; export function handleIntegrationUpdate(data: DiscordPayload) { const { diff --git a/src/handlers/interactions/INTERACTION_CREATE.ts b/src/handlers/interactions/INTERACTION_CREATE.ts index ffdd6bc45..e3d83a0b3 100644 --- a/src/handlers/interactions/INTERACTION_CREATE.ts +++ b/src/handlers/interactions/INTERACTION_CREATE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, InteractionCommandPayload } from "../../types/mod.ts"; import { structures } from "../../structures/mod.ts"; import { cacheHandlers } from "../../cache.ts"; diff --git a/src/handlers/invites/INVITE_CREATE.ts b/src/handlers/invites/INVITE_CREATE.ts index d0964068e..692a8897e 100644 --- a/src/handlers/invites/INVITE_CREATE.ts +++ b/src/handlers/invites/INVITE_CREATE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, InviteCreateEvent } from "../../types/mod.ts"; export function handleInviteCreate(payload: DiscordPayload) { if (payload.t !== "INVITE_CREATE") return; diff --git a/src/handlers/invites/INVITE_DELETE.ts b/src/handlers/invites/INVITE_DELETE.ts index 737fd9255..c38f79573 100644 --- a/src/handlers/invites/INVITE_DELETE.ts +++ b/src/handlers/invites/INVITE_DELETE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, InviteDeleteEvent } from "../../types/mod.ts"; export function handleInviteDelete(payload: DiscordPayload) { if (payload.t !== "INVITE_DELETE") return; diff --git a/src/handlers/members/GUILD_MEMBERS_CHUNK.ts b/src/handlers/members/GUILD_MEMBERS_CHUNK.ts index cf13d3143..75f917737 100644 --- a/src/handlers/members/GUILD_MEMBERS_CHUNK.ts +++ b/src/handlers/members/GUILD_MEMBERS_CHUNK.ts @@ -1,6 +1,5 @@ import { cache, cacheHandlers } from "../../cache.ts"; import { structures } from "../../structures/mod.ts"; -import { DiscordPayload, GuildMemberChunkPayload } from "../../types/mod.ts"; import { Collection } from "../../util/collection.ts"; export async function handleGuildMembersChunk(data: DiscordPayload) { diff --git a/src/handlers/members/GUILD_MEMBER_ADD.ts b/src/handlers/members/GUILD_MEMBER_ADD.ts index c90f564e5..ac2511de5 100644 --- a/src/handlers/members/GUILD_MEMBER_ADD.ts +++ b/src/handlers/members/GUILD_MEMBER_ADD.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, GuildMemberAddPayload } from "../../types/mod.ts"; import { structures } from "../../structures/mod.ts"; import { cacheHandlers } from "../../cache.ts"; diff --git a/src/handlers/members/GUILD_MEMBER_REMOVE.ts b/src/handlers/members/GUILD_MEMBER_REMOVE.ts index 8c5703257..2ffa60e74 100644 --- a/src/handlers/members/GUILD_MEMBER_REMOVE.ts +++ b/src/handlers/members/GUILD_MEMBER_REMOVE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, GuildBanPayload } from "../../types/mod.ts"; import { cacheHandlers } from "../../cache.ts"; export async function handleGuildMemberRemove(data: DiscordPayload) { diff --git a/src/handlers/members/GUILD_MEMBER_UPDATE.ts b/src/handlers/members/GUILD_MEMBER_UPDATE.ts index d63cb42ab..75b081c4d 100644 --- a/src/handlers/members/GUILD_MEMBER_UPDATE.ts +++ b/src/handlers/members/GUILD_MEMBER_UPDATE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, GuildMemberUpdatePayload } from "../../types/mod.ts"; import { structures } from "../../structures/mod.ts"; import { cacheHandlers } from "../../cache.ts"; diff --git a/src/handlers/messages/MESSAGE_CREATE.ts b/src/handlers/messages/MESSAGE_CREATE.ts index 30337662e..361c93458 100644 --- a/src/handlers/messages/MESSAGE_CREATE.ts +++ b/src/handlers/messages/MESSAGE_CREATE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, MessageCreateOptions } from "../../types/mod.ts"; import { structures } from "../../structures/mod.ts"; import { cacheHandlers } from "../../cache.ts"; diff --git a/src/handlers/messages/MESSAGE_DELETE.ts b/src/handlers/messages/MESSAGE_DELETE.ts index 43a44a14a..4830947e2 100644 --- a/src/handlers/messages/MESSAGE_DELETE.ts +++ b/src/handlers/messages/MESSAGE_DELETE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, MessageDeletePayload } from "../../types/mod.ts"; import { cacheHandlers } from "../../cache.ts"; export async function handleMessageDelete(data: DiscordPayload) { diff --git a/src/handlers/messages/MESSAGE_DELETE_BULK.ts b/src/handlers/messages/MESSAGE_DELETE_BULK.ts index ddb227ce1..615b65270 100644 --- a/src/handlers/messages/MESSAGE_DELETE_BULK.ts +++ b/src/handlers/messages/MESSAGE_DELETE_BULK.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, MessageDeleteBulkPayload } from "../../types/mod.ts"; import { cacheHandlers } from "../../cache.ts"; export async function handleMessageDeleteBulk(data: DiscordPayload) { diff --git a/src/handlers/messages/MESSAGE_REACTION_ADD.ts b/src/handlers/messages/MESSAGE_REACTION_ADD.ts index e2cfc56c6..68428499b 100644 --- a/src/handlers/messages/MESSAGE_REACTION_ADD.ts +++ b/src/handlers/messages/MESSAGE_REACTION_ADD.ts @@ -1,5 +1,4 @@ import { botID, eventHandlers } from "../../bot.ts"; -import { DiscordPayload, MessageReactionPayload } from "../../types/mod.ts"; import { structures } from "../../structures/mod.ts"; import { cacheHandlers } from "../../cache.ts"; diff --git a/src/handlers/messages/MESSAGE_REACTION_REMOVE.ts b/src/handlers/messages/MESSAGE_REACTION_REMOVE.ts index e0e77ec55..8c7f13330 100644 --- a/src/handlers/messages/MESSAGE_REACTION_REMOVE.ts +++ b/src/handlers/messages/MESSAGE_REACTION_REMOVE.ts @@ -1,5 +1,4 @@ import { botID, eventHandlers } from "../../bot.ts"; -import { DiscordPayload, MessageReactionPayload } from "../../types/mod.ts"; import { structures } from "../../structures/mod.ts"; import { cacheHandlers } from "../../cache.ts"; diff --git a/src/handlers/messages/MESSAGE_REACTION_REMOVE_ALL.ts b/src/handlers/messages/MESSAGE_REACTION_REMOVE_ALL.ts index 8209abefe..67d599654 100644 --- a/src/handlers/messages/MESSAGE_REACTION_REMOVE_ALL.ts +++ b/src/handlers/messages/MESSAGE_REACTION_REMOVE_ALL.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { BaseMessageReactionPayload, DiscordPayload } from "../../types/mod.ts"; import { cacheHandlers } from "../../cache.ts"; export async function handleMessageReactionRemoveAll( diff --git a/src/handlers/messages/MESSAGE_REACTION_REMOVE_EMOJI.ts b/src/handlers/messages/MESSAGE_REACTION_REMOVE_EMOJI.ts index 87c9bec21..3672a02c6 100644 --- a/src/handlers/messages/MESSAGE_REACTION_REMOVE_EMOJI.ts +++ b/src/handlers/messages/MESSAGE_REACTION_REMOVE_EMOJI.ts @@ -1,8 +1,4 @@ import { botID, eventHandlers } from "../../bot.ts"; -import { - DiscordPayload, - MessageReactionRemoveEmojiPayload, -} from "../../types/mod.ts"; import { cacheHandlers } from "../../cache.ts"; export async function handleMessageReactionRemoveEmoji( diff --git a/src/handlers/messages/MESSAGE_UPDATE.ts b/src/handlers/messages/MESSAGE_UPDATE.ts index e4fc8e02c..5c987ef90 100644 --- a/src/handlers/messages/MESSAGE_UPDATE.ts +++ b/src/handlers/messages/MESSAGE_UPDATE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, MessageCreateOptions } from "../../types/mod.ts"; import { structures } from "../../structures/mod.ts"; import { cacheHandlers } from "../../cache.ts"; diff --git a/src/handlers/misc/PRESENCE_UPDATE.ts b/src/handlers/misc/PRESENCE_UPDATE.ts index 4e202e6ec..5ff3e5bd2 100644 --- a/src/handlers/misc/PRESENCE_UPDATE.ts +++ b/src/handlers/misc/PRESENCE_UPDATE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, PresenceUpdatePayload } from "../../types/mod.ts"; import { cacheHandlers } from "../../cache.ts"; export async function handlePresenceUpdate(data: DiscordPayload) { diff --git a/src/handlers/misc/READY.ts b/src/handlers/misc/READY.ts index 3a11c96eb..5c391694e 100644 --- a/src/handlers/misc/READY.ts +++ b/src/handlers/misc/READY.ts @@ -7,7 +7,6 @@ import { import { cache, cacheHandlers } from "../../cache.ts"; import { initialMemberLoadQueue } from "../../structures/guild.ts"; import { structures } from "../../structures/mod.ts"; -import { DiscordPayload, ReadyPayload } from "../../types/discord.ts"; import { delay } from "../../util/utils.ts"; import { allowNextShard, basicShards } from "../../ws/mod.ts"; diff --git a/src/handlers/misc/TYPING_START.ts b/src/handlers/misc/TYPING_START.ts index 308c88439..d60349788 100644 --- a/src/handlers/misc/TYPING_START.ts +++ b/src/handlers/misc/TYPING_START.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, TypingStartPayload } from "../../types/mod.ts"; export function handleTypingStart(data: DiscordPayload) { eventHandlers.typingStart?.(data.d as TypingStartPayload); diff --git a/src/handlers/misc/USER_UPDATE.ts b/src/handlers/misc/USER_UPDATE.ts index aade4ffcb..1645cd365 100644 --- a/src/handlers/misc/USER_UPDATE.ts +++ b/src/handlers/misc/USER_UPDATE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, UserPayload } from "../../types/mod.ts"; import { cacheHandlers } from "../../cache.ts"; export async function handleUserUpdate(data: DiscordPayload) { diff --git a/src/handlers/roles/GUILD_ROLE_CREATE.ts b/src/handlers/roles/GUILD_ROLE_CREATE.ts index 121ca807a..a5dbcdaf0 100644 --- a/src/handlers/roles/GUILD_ROLE_CREATE.ts +++ b/src/handlers/roles/GUILD_ROLE_CREATE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, GuildRolePayload } from "../../types/mod.ts"; import { structures } from "../../structures/mod.ts"; import { cacheHandlers } from "../../cache.ts"; diff --git a/src/handlers/roles/GUILD_ROLE_DELETE.ts b/src/handlers/roles/GUILD_ROLE_DELETE.ts index 907abb0b2..9c53af655 100644 --- a/src/handlers/roles/GUILD_ROLE_DELETE.ts +++ b/src/handlers/roles/GUILD_ROLE_DELETE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, GuildRoleDeletePayload } from "../../types/mod.ts"; import { cacheHandlers } from "../../cache.ts"; export async function handleGuildRoleDelete(data: DiscordPayload) { diff --git a/src/handlers/roles/GUILD_ROLE_UPDATE.ts b/src/handlers/roles/GUILD_ROLE_UPDATE.ts index 368c5ccb2..2e9f0426e 100644 --- a/src/handlers/roles/GUILD_ROLE_UPDATE.ts +++ b/src/handlers/roles/GUILD_ROLE_UPDATE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, GuildRolePayload } from "../../types/mod.ts"; import { structures } from "../../structures/mod.ts"; import { cacheHandlers } from "../../cache.ts"; diff --git a/src/handlers/voice/VOICE_SERVER_UPDATE.ts b/src/handlers/voice/VOICE_SERVER_UPDATE.ts index 5da4ee508..4bb7bb901 100644 --- a/src/handlers/voice/VOICE_SERVER_UPDATE.ts +++ b/src/handlers/voice/VOICE_SERVER_UPDATE.ts @@ -1,8 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { - DiscordPayload, - DiscordVoiceServerUpdateEvent, -} from "../../types/mod.ts"; import { cacheHandlers } from "../../cache.ts"; export async function handleVoiceServerUpdate(data: DiscordPayload) { diff --git a/src/handlers/voice/VOICE_STATE_UPDATE.ts b/src/handlers/voice/VOICE_STATE_UPDATE.ts index 277285ee4..9c00749a1 100644 --- a/src/handlers/voice/VOICE_STATE_UPDATE.ts +++ b/src/handlers/voice/VOICE_STATE_UPDATE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, VoiceStateUpdatePayload } from "../../types/mod.ts"; import { structures } from "../../structures/mod.ts"; import { cacheHandlers } from "../../cache.ts"; diff --git a/src/handlers/webhooks/WEBHOOKS_UPDATE.ts b/src/handlers/webhooks/WEBHOOKS_UPDATE.ts index 987683b9b..ed4e7272d 100644 --- a/src/handlers/webhooks/WEBHOOKS_UPDATE.ts +++ b/src/handlers/webhooks/WEBHOOKS_UPDATE.ts @@ -1,5 +1,4 @@ import { eventHandlers } from "../../bot.ts"; -import { DiscordPayload, WebhookUpdatePayload } from "../../types/mod.ts"; export function handleWebhooksUpdate(data: DiscordPayload) { const options = data.d as WebhookUpdatePayload; diff --git a/src/helpers/channels/channel_overwrite_has_permission.ts b/src/helpers/channels/channel_overwrite_has_permission.ts index 6eefaa998..938755ebf 100644 --- a/src/helpers/channels/channel_overwrite_has_permission.ts +++ b/src/helpers/channels/channel_overwrite_has_permission.ts @@ -1,5 +1,3 @@ -import { Permission, Permissions, RawOverwrite } from "../../types/mod.ts"; - /** Checks if a channel overwrite for a user id or a role id has permission in this channel */ export function channelOverwriteHasPermission( guildID: string, diff --git a/src/helpers/channels/create_channel.ts b/src/helpers/channels/create_channel.ts index 5da487a7c..bc45faaff 100644 --- a/src/helpers/channels/create_channel.ts +++ b/src/helpers/channels/create_channel.ts @@ -1,12 +1,6 @@ import { cacheHandlers } from "../../cache.ts"; import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { - ChannelCreateOptions, - ChannelCreatePayload, - ChannelTypes, - Permission, -} from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { calculateBits, diff --git a/src/helpers/channels/delete_channel.ts b/src/helpers/channels/delete_channel.ts index 967a0a46a..fd0706cc8 100644 --- a/src/helpers/channels/delete_channel.ts +++ b/src/helpers/channels/delete_channel.ts @@ -1,6 +1,5 @@ import { cacheHandlers } from "../../cache.ts"; import { RequestManager } from "../../rest/request_manager.ts"; -import { Errors } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/channels/edit_channel.ts b/src/helpers/channels/edit_channel.ts index a8d83b341..057180f5f 100644 --- a/src/helpers/channels/edit_channel.ts +++ b/src/helpers/channels/edit_channel.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { ChannelEditOptions } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { calculateBits, @@ -65,16 +64,6 @@ export async function editChannel( return result; } -interface EditChannelRequest { - amount: number; - timestamp: number; - channelID: string; - items: { - channelID: string; - options: ChannelEditOptions; - }[]; -} - const editChannelNameTopicQueue = new Map(); let editChannelProcessing = false; diff --git a/src/helpers/channels/edit_channel_overwrite.ts b/src/helpers/channels/edit_channel_overwrite.ts index ebda004a3..bd3ee7fa7 100644 --- a/src/helpers/channels/edit_channel_overwrite.ts +++ b/src/helpers/channels/edit_channel_overwrite.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { Overwrite } from "../../types/mod.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 621d79058..5e9c5470c 100644 --- a/src/helpers/channels/follow_channel.ts +++ b/src/helpers/channels/follow_channel.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { FollowedChannelPayload } from "../../types/mod.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 ee9922d14..840ad91f9 100644 --- a/src/helpers/channels/get_channel.ts +++ b/src/helpers/channels/get_channel.ts @@ -1,7 +1,6 @@ import { cacheHandlers } from "../../cache.ts"; import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { ChannelCreatePayload } from "../../types/mod.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 5d9787eba..eb2fef5a4 100644 --- a/src/helpers/channels/get_channel_webhooks.ts +++ b/src/helpers/channels/get_channel_webhooks.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { WebhookPayload } from "../../types/mod.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 0bf1ee856..b7ea3f102 100644 --- a/src/helpers/channels/get_channels.ts +++ b/src/helpers/channels/get_channels.ts @@ -1,7 +1,6 @@ import { cacheHandlers } from "../../cache.ts"; import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { ChannelCreatePayload } from "../../types/mod.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 6a9e0b93a..881dea896 100644 --- a/src/helpers/channels/get_pins.ts +++ b/src/helpers/channels/get_pins.ts @@ -1,6 +1,5 @@ import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { MessageCreateOptions } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** Get pinned messages in this channel. */ diff --git a/src/helpers/channels/start_typing.ts b/src/helpers/channels/start_typing.ts index ff9f2502b..c355ad045 100644 --- a/src/helpers/channels/start_typing.ts +++ b/src/helpers/channels/start_typing.ts @@ -1,6 +1,5 @@ import { cacheHandlers } from "../../cache.ts"; import { RequestManager } from "../../rest/request_manager.ts"; -import { ChannelTypes, Errors } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { botHasChannelPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/channels/swap_channels.ts b/src/helpers/channels/swap_channels.ts index 49adc9d84..2de4a25bb 100644 --- a/src/helpers/channels/swap_channels.ts +++ b/src/helpers/channels/swap_channels.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { PositionSwap } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** Modify the positions of channels on the guild. Requires MANAGE_CHANNELS permisison. */ diff --git a/src/helpers/commands/create_slash_command.ts b/src/helpers/commands/create_slash_command.ts index 42fd65197..c70f4e0f0 100644 --- a/src/helpers/commands/create_slash_command.ts +++ b/src/helpers/commands/create_slash_command.ts @@ -1,6 +1,5 @@ import { applicationID } from "../../bot.ts"; import { RequestManager } from "../../rest/request_manager.ts"; -import { CreateSlashCommandOptions } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { validateSlashCommands } from "../../util/utils.ts"; diff --git a/src/helpers/commands/edit_slash_response.ts b/src/helpers/commands/edit_slash_response.ts index 2165ca266..b68fc8078 100644 --- a/src/helpers/commands/edit_slash_response.ts +++ b/src/helpers/commands/edit_slash_response.ts @@ -1,11 +1,6 @@ import { applicationID } from "../../bot.ts"; import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { - EditSlashResponseOptions, - Errors, - MessageCreateOptions, -} from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** To edit your response to a slash command. If a messageID is not provided it will default to editing the original response. */ diff --git a/src/helpers/commands/get_slash_command.ts b/src/helpers/commands/get_slash_command.ts index 8cf41c003..111be9a8c 100644 --- a/src/helpers/commands/get_slash_command.ts +++ b/src/helpers/commands/get_slash_command.ts @@ -1,6 +1,5 @@ import { applicationID } from "../../bot.ts"; import { RequestManager } from "../../rest/request_manager.ts"; -import { SlashCommand } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** Fetchs the global command for the given ID. If a guildID is provided, the guild command will be fetched. */ diff --git a/src/helpers/commands/get_slash_commands.ts b/src/helpers/commands/get_slash_commands.ts index 1f256c148..b16ad85d3 100644 --- a/src/helpers/commands/get_slash_commands.ts +++ b/src/helpers/commands/get_slash_commands.ts @@ -1,6 +1,5 @@ import { applicationID } from "../../bot.ts"; import { RequestManager } from "../../rest/request_manager.ts"; -import { SlashCommand } from "../../types/mod.ts"; import { Collection } from "../../util/collection.ts"; import { endpoints } from "../../util/constants.ts"; diff --git a/src/helpers/commands/send_interaction_response.ts b/src/helpers/commands/send_interaction_response.ts index a7f561f2c..69983181e 100644 --- a/src/helpers/commands/send_interaction_response.ts +++ b/src/helpers/commands/send_interaction_response.ts @@ -1,7 +1,6 @@ import { applicationID } from "../../bot.ts"; import { cache } from "../../cache.ts"; import { RequestManager } from "../../rest/request_manager.ts"; -import { SlashCommandResponseOptions } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** diff --git a/src/helpers/commands/upsert_slash_command.ts b/src/helpers/commands/upsert_slash_command.ts index 49bd9eed1..8115d17ac 100644 --- a/src/helpers/commands/upsert_slash_command.ts +++ b/src/helpers/commands/upsert_slash_command.ts @@ -1,6 +1,5 @@ import { applicationID } from "../../bot.ts"; import { RequestManager } from "../../rest/request_manager.ts"; -import { UpsertSlashCommandOptions } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { validateSlashCommands } from "../../util/utils.ts"; diff --git a/src/helpers/commands/upsert_slash_commands.ts b/src/helpers/commands/upsert_slash_commands.ts index 336220769..c087c43ed 100644 --- a/src/helpers/commands/upsert_slash_commands.ts +++ b/src/helpers/commands/upsert_slash_commands.ts @@ -1,6 +1,5 @@ import { applicationID } from "../../bot.ts"; import { RequestManager } from "../../rest/request_manager.ts"; -import { UpsertSlashCommandsOptions } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { validateSlashCommands } from "../../util/utils.ts"; diff --git a/src/helpers/emojis/create_emoji.ts b/src/helpers/emojis/create_emoji.ts index 139fad0ad..7ed8f780f 100644 --- a/src/helpers/emojis/create_emoji.ts +++ b/src/helpers/emojis/create_emoji.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { CreateEmojisOptions } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts"; import { urlToBase64 } from "../../util/utils.ts"; diff --git a/src/helpers/emojis/edit_emoji.ts b/src/helpers/emojis/edit_emoji.ts index 13b201d12..83aebeadf 100644 --- a/src/helpers/emojis/edit_emoji.ts +++ b/src/helpers/emojis/edit_emoji.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { EditEmojisOptions } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/emojis/get_emoji.ts b/src/helpers/emojis/get_emoji.ts index 82aa275aa..179501273 100644 --- a/src/helpers/emojis/get_emoji.ts +++ b/src/helpers/emojis/get_emoji.ts @@ -1,6 +1,5 @@ import { cacheHandlers } from "../../cache.ts"; import { RequestManager } from "../../rest/request_manager.ts"; -import { Emoji, Errors } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** diff --git a/src/helpers/emojis/get_emojis.ts b/src/helpers/emojis/get_emojis.ts index 772cbbcd9..fa1fa2f18 100644 --- a/src/helpers/emojis/get_emojis.ts +++ b/src/helpers/emojis/get_emojis.ts @@ -1,6 +1,5 @@ import { cacheHandlers } from "../../cache.ts"; import { RequestManager } from "../../rest/request_manager.ts"; -import { Emoji, Errors } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** diff --git a/src/helpers/guilds/create_guild.ts b/src/helpers/guilds/create_guild.ts index 7ca748d1f..4be5f47c8 100644 --- a/src/helpers/guilds/create_guild.ts +++ b/src/helpers/guilds/create_guild.ts @@ -1,6 +1,5 @@ import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { CreateGuildPayload, CreateServerOptions } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** Create a new guild. Returns a guild object on success. Fires a Guild Create Gateway event. This endpoint can be used only by bots in less than 10 guilds. */ diff --git a/src/helpers/guilds/edit_guild.ts b/src/helpers/guilds/edit_guild.ts index 2cbc13fbe..5ef7345f1 100644 --- a/src/helpers/guilds/edit_guild.ts +++ b/src/helpers/guilds/edit_guild.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { GuildEditOptions } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts"; import { urlToBase64 } from "../../util/utils.ts"; diff --git a/src/helpers/guilds/get_audit_logs.ts b/src/helpers/guilds/get_audit_logs.ts index b28004e31..a7984f276 100644 --- a/src/helpers/guilds/get_audit_logs.ts +++ b/src/helpers/guilds/get_audit_logs.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { AuditLogs, GetAuditLogsOptions } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/guilds/get_ban.ts b/src/helpers/guilds/get_ban.ts index 1b52f3671..69cde466d 100644 --- a/src/helpers/guilds/get_ban.ts +++ b/src/helpers/guilds/get_ban.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { BannedUser } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/guilds/get_bans.ts b/src/helpers/guilds/get_bans.ts index bacb913bd..1a9a33212 100644 --- a/src/helpers/guilds/get_bans.ts +++ b/src/helpers/guilds/get_bans.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { BannedUser } from "../../types/mod.ts"; import { Collection } from "../../util/collection.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/guilds/get_guild.ts b/src/helpers/guilds/get_guild.ts index c1c2c516c..a17603b69 100644 --- a/src/helpers/guilds/get_guild.ts +++ b/src/helpers/guilds/get_guild.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { UpdateGuildPayload } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** diff --git a/src/helpers/guilds/get_prune_count.ts b/src/helpers/guilds/get_prune_count.ts index 9fbe2d9d2..e66ec1985 100644 --- a/src/helpers/guilds/get_prune_count.ts +++ b/src/helpers/guilds/get_prune_count.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { Errors, PruneOptions, PrunePayload } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts"; import { camelKeysToSnakeCase, urlToBase64 } from "../../util/utils.ts"; diff --git a/src/helpers/guilds/get_widget.ts b/src/helpers/guilds/get_widget.ts index 4915059cb..50908a39e 100644 --- a/src/helpers/guilds/get_widget.ts +++ b/src/helpers/guilds/get_widget.ts @@ -1,6 +1,5 @@ import { cacheHandlers } from "../../cache.ts"; import { RequestManager } from "../../rest/request_manager.ts"; -import { Errors } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** Returns the widget for the guild. */ diff --git a/src/helpers/guilds/get_widget_image_url.ts b/src/helpers/guilds/get_widget_image_url.ts index b2ad2d22e..6c58eb547 100644 --- a/src/helpers/guilds/get_widget_image_url.ts +++ b/src/helpers/guilds/get_widget_image_url.ts @@ -1,5 +1,4 @@ import { cacheHandlers } from "../../cache.ts"; -import { Errors } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** Returns the widget image URL for the guild. */ diff --git a/src/helpers/guilds/guild_banner_url.ts b/src/helpers/guilds/guild_banner_url.ts index 2c6a50b2e..5b5db57c8 100644 --- a/src/helpers/guilds/guild_banner_url.ts +++ b/src/helpers/guilds/guild_banner_url.ts @@ -1,5 +1,4 @@ import { Guild } from "../../structures/mod.ts"; -import { ImageFormats, ImageSize } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { formatImageURL } from "../../util/utils.ts"; diff --git a/src/helpers/guilds/guild_icon_url.ts b/src/helpers/guilds/guild_icon_url.ts index b8602fcaa..f1f348010 100644 --- a/src/helpers/guilds/guild_icon_url.ts +++ b/src/helpers/guilds/guild_icon_url.ts @@ -1,5 +1,4 @@ import { Guild } from "../../structures/mod.ts"; -import { ImageFormats, ImageSize } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { formatImageURL } from "../../util/utils.ts"; diff --git a/src/helpers/guilds/guild_splash_url.ts b/src/helpers/guilds/guild_splash_url.ts index 7383ef7a9..2e38524ac 100644 --- a/src/helpers/guilds/guild_splash_url.ts +++ b/src/helpers/guilds/guild_splash_url.ts @@ -1,5 +1,4 @@ import { Guild } from "../../structures/mod.ts"; -import { ImageFormats, ImageSize } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { formatImageURL } from "../../util/utils.ts"; diff --git a/src/helpers/integrations/edit_integration.ts b/src/helpers/integrations/edit_integration.ts index 5fc158094..a5d1e1c94 100644 --- a/src/helpers/integrations/edit_integration.ts +++ b/src/helpers/integrations/edit_integration.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { EditIntegrationOptions } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/invites/create_invite.ts b/src/helpers/invites/create_invite.ts index 73742b421..34ebc7a89 100644 --- a/src/helpers/invites/create_invite.ts +++ b/src/helpers/invites/create_invite.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { CreateInviteOptions } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotChannelPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/invites/delete_invite.ts b/src/helpers/invites/delete_invite.ts index d5b055126..53ec1b9d0 100644 --- a/src/helpers/invites/delete_invite.ts +++ b/src/helpers/invites/delete_invite.ts @@ -1,6 +1,5 @@ import { cacheHandlers } from "../../cache.ts"; import { RequestManager } from "../../rest/request_manager.ts"; -import { Errors, InvitePayload } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { botHasChannelPermissions, diff --git a/src/helpers/invites/get_invite.ts b/src/helpers/invites/get_invite.ts index 02dc66dca..8d0bc8736 100644 --- a/src/helpers/invites/get_invite.ts +++ b/src/helpers/invites/get_invite.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { InvitePayload } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** Returns an invite for the given code. */ diff --git a/src/helpers/members/avatar_url.ts b/src/helpers/members/avatar_url.ts index bfb5da949..3b9d9def3 100644 --- a/src/helpers/members/avatar_url.ts +++ b/src/helpers/members/avatar_url.ts @@ -1,5 +1,4 @@ import { Member } from "../../structures/mod.ts"; -import { ImageFormats, ImageSize } from "../../types/mod.ts"; import { rawAvatarURL } from "./raw_avatar_url.ts"; /** The users custom avatar or the default avatar */ diff --git a/src/helpers/members/ban_member.ts b/src/helpers/members/ban_member.ts index 4a08d8fb4..4eeedec30 100644 --- a/src/helpers/members/ban_member.ts +++ b/src/helpers/members/ban_member.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { BanOptions } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/members/edit_bot_profile.ts b/src/helpers/members/edit_bot_profile.ts index 4a438e279..447239f5c 100644 --- a/src/helpers/members/edit_bot_profile.ts +++ b/src/helpers/members/edit_bot_profile.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { Errors } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { urlToBase64 } from "../../util/utils.ts"; diff --git a/src/helpers/members/edit_member.ts b/src/helpers/members/edit_member.ts index e08bb7b7b..5868369f4 100644 --- a/src/helpers/members/edit_member.ts +++ b/src/helpers/members/edit_member.ts @@ -1,12 +1,6 @@ import { cacheHandlers } from "../../cache.ts"; import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { - EditMemberOptions, - Errors, - MemberCreatePayload, - Permission, -} from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotChannelPermissions, diff --git a/src/helpers/members/fetch_members.ts b/src/helpers/members/fetch_members.ts index 8cbd5735a..f8596f14f 100644 --- a/src/helpers/members/fetch_members.ts +++ b/src/helpers/members/fetch_members.ts @@ -1,6 +1,5 @@ import { identifyPayload } from "../../bot.ts"; import { Member } from "../../structures/mod.ts"; -import { Errors, FetchMembersOptions, Intents } from "../../types/mod.ts"; import { Collection } from "../../util/collection.ts"; import { requestAllMembers } from "../../ws/shard_manager.ts"; diff --git a/src/helpers/members/get_member.ts b/src/helpers/members/get_member.ts index 4b182db51..bb647d600 100644 --- a/src/helpers/members/get_member.ts +++ b/src/helpers/members/get_member.ts @@ -1,7 +1,6 @@ import { cacheHandlers } from "../../cache.ts"; import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { MemberCreatePayload } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** Returns a guild member object for the specified user. diff --git a/src/helpers/members/get_members.ts b/src/helpers/members/get_members.ts index f91d70ecd..8d9928caf 100644 --- a/src/helpers/members/get_members.ts +++ b/src/helpers/members/get_members.ts @@ -2,12 +2,6 @@ import { identifyPayload } from "../../bot.ts"; import { cacheHandlers } from "../../cache.ts"; import { RequestManager } from "../../rest/request_manager.ts"; import { Member, structures } from "../../structures/mod.ts"; -import { - Errors, - GetMemberOptions, - Intents, - MemberCreatePayload, -} from "../../types/mod.ts"; import { Collection } from "../../util/collection.ts"; import { endpoints } from "../../util/constants.ts"; diff --git a/src/helpers/members/kick_member.ts b/src/helpers/members/kick_member.ts index 6783cfe6b..d42bdadd0 100644 --- a/src/helpers/members/kick_member.ts +++ b/src/helpers/members/kick_member.ts @@ -1,6 +1,5 @@ import { botID } from "../../bot.ts"; import { RequestManager } from "../../rest/request_manager.ts"; -import { Errors } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { highestRole, diff --git a/src/helpers/members/prune_members.ts b/src/helpers/members/prune_members.ts index 7f3fadce7..312af2f66 100644 --- a/src/helpers/members/prune_members.ts +++ b/src/helpers/members/prune_members.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { Errors, PruneOptions } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts"; import { camelKeysToSnakeCase } from "../../util/utils.ts"; diff --git a/src/helpers/members/raw_avatar_url.ts b/src/helpers/members/raw_avatar_url.ts index d10a8956f..4cd366f9b 100644 --- a/src/helpers/members/raw_avatar_url.ts +++ b/src/helpers/members/raw_avatar_url.ts @@ -1,4 +1,3 @@ -import { ImageFormats, ImageSize } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { formatImageURL } from "../../util/utils.ts"; diff --git a/src/helpers/members/send_direct_message.ts b/src/helpers/members/send_direct_message.ts index dca5a4472..5fe20fe26 100644 --- a/src/helpers/members/send_direct_message.ts +++ b/src/helpers/members/send_direct_message.ts @@ -1,11 +1,6 @@ import { cacheHandlers } from "../../cache.ts"; import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { - ChannelCreatePayload, - DMChannelCreatePayload, - MessageContent, -} from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { sendMessage } from "../messages/send_message.ts"; diff --git a/src/helpers/messages/delete_messages.ts b/src/helpers/messages/delete_messages.ts index 662e7dff4..2a3bddfe1 100644 --- a/src/helpers/messages/delete_messages.ts +++ b/src/helpers/messages/delete_messages.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { Errors } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotChannelPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/messages/edit_message.ts b/src/helpers/messages/edit_message.ts index 92899f0c3..d730faad2 100644 --- a/src/helpers/messages/edit_message.ts +++ b/src/helpers/messages/edit_message.ts @@ -1,12 +1,6 @@ import { botID } from "../../bot.ts"; import { RequestManager } from "../../rest/request_manager.ts"; import { Message, structures } from "../../structures/mod.ts"; -import { - Errors, - MessageContent, - MessageCreateOptions, - Permission, -} from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotChannelPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/messages/get_message.ts b/src/helpers/messages/get_message.ts index 1b285b8ff..3eaa5bcf6 100644 --- a/src/helpers/messages/get_message.ts +++ b/src/helpers/messages/get_message.ts @@ -1,6 +1,5 @@ import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { MessageCreateOptions } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotChannelPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/messages/get_messages.ts b/src/helpers/messages/get_messages.ts index 1de5ced70..fbe74316b 100644 --- a/src/helpers/messages/get_messages.ts +++ b/src/helpers/messages/get_messages.ts @@ -1,12 +1,5 @@ import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { - GetMessages, - GetMessagesAfter, - GetMessagesAround, - GetMessagesBefore, - MessageCreateOptions, -} from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotChannelPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/messages/get_reactions.ts b/src/helpers/messages/get_reactions.ts index c05ae2e1e..96f37820b 100644 --- a/src/helpers/messages/get_reactions.ts +++ b/src/helpers/messages/get_reactions.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { DiscordGetReactionsParams, UserPayload } from "../../types/mod.ts"; import { Collection } from "../../util/collection.ts"; import { endpoints } from "../../util/constants.ts"; diff --git a/src/helpers/messages/publish_message.ts b/src/helpers/messages/publish_message.ts index 92f781e00..fc7b64b0c 100644 --- a/src/helpers/messages/publish_message.ts +++ b/src/helpers/messages/publish_message.ts @@ -1,6 +1,5 @@ import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { MessageCreateOptions } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** Crosspost a message in a News Channel to following channels. */ diff --git a/src/helpers/messages/send_message.ts b/src/helpers/messages/send_message.ts index 819433062..d1780870c 100644 --- a/src/helpers/messages/send_message.ts +++ b/src/helpers/messages/send_message.ts @@ -1,13 +1,6 @@ import { cacheHandlers } from "../../cache.ts"; import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { - ChannelTypes, - Errors, - MessageContent, - MessageCreateOptions, - Permission, -} from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotChannelPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/misc/get_gateway_bot.ts b/src/helpers/misc/get_gateway_bot.ts index 406946fe0..ca8ead1a5 100644 --- a/src/helpers/misc/get_gateway_bot.ts +++ b/src/helpers/misc/get_gateway_bot.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { DiscordBotGatewayData } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** Get the bots Gateway metadata that can help during the operation of large or sharded bots. */ diff --git a/src/helpers/misc/get_user.ts b/src/helpers/misc/get_user.ts index 1d9ba369f..b7304977c 100644 --- a/src/helpers/misc/get_user.ts +++ b/src/helpers/misc/get_user.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { UserPayload } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** This function will return the raw user payload in the rare cases you need to fetch a user directly from the API. */ diff --git a/src/helpers/roles/add_role.ts b/src/helpers/roles/add_role.ts index e065bcde4..c982b35d6 100644 --- a/src/helpers/roles/add_role.ts +++ b/src/helpers/roles/add_role.ts @@ -1,6 +1,5 @@ import { botID } from "../../bot.ts"; import { RequestManager } from "../../rest/request_manager.ts"; -import { Errors } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { isHigherPosition, diff --git a/src/helpers/roles/create_role.ts b/src/helpers/roles/create_role.ts index e4a98cb8f..7b1ae37f1 100644 --- a/src/helpers/roles/create_role.ts +++ b/src/helpers/roles/create_role.ts @@ -1,7 +1,6 @@ import { cacheHandlers } from "../../cache.ts"; import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { CreateRoleOptions, RoleData } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { calculateBits, diff --git a/src/helpers/roles/edit_role.ts b/src/helpers/roles/edit_role.ts index f726fe161..c645aa1d2 100644 --- a/src/helpers/roles/edit_role.ts +++ b/src/helpers/roles/edit_role.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { CreateRoleOptions } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { calculateBits, diff --git a/src/helpers/roles/remove_role.ts b/src/helpers/roles/remove_role.ts index f26dcc965..c8df51938 100644 --- a/src/helpers/roles/remove_role.ts +++ b/src/helpers/roles/remove_role.ts @@ -1,6 +1,5 @@ import { botID } from "../../bot.ts"; import { RequestManager } from "../../rest/request_manager.ts"; -import { Errors } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { isHigherPosition, diff --git a/src/helpers/roles/swap_roles.ts b/src/helpers/roles/swap_roles.ts index deed5d142..cdb8daf63 100644 --- a/src/helpers/roles/swap_roles.ts +++ b/src/helpers/roles/swap_roles.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { PositionSwap } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/templates/create_guild_from_template.ts b/src/helpers/templates/create_guild_from_template.ts index 36d65adb9..d6b885e98 100644 --- a/src/helpers/templates/create_guild_from_template.ts +++ b/src/helpers/templates/create_guild_from_template.ts @@ -1,9 +1,5 @@ import { cacheHandlers } from "../../cache.ts"; import { RequestManager } from "../../rest/request_manager.ts"; -import { - CreateGuildFromTemplate, - CreateGuildPayload, -} from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { urlToBase64 } from "../../util/utils.ts"; diff --git a/src/helpers/templates/create_guild_template.ts b/src/helpers/templates/create_guild_template.ts index 38f755116..4e50d7063 100644 --- a/src/helpers/templates/create_guild_template.ts +++ b/src/helpers/templates/create_guild_template.ts @@ -1,6 +1,5 @@ import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { CreateGuildTemplate, GuildTemplate } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/templates/delete_guild_template.ts b/src/helpers/templates/delete_guild_template.ts index 325019069..6b1a4d68f 100644 --- a/src/helpers/templates/delete_guild_template.ts +++ b/src/helpers/templates/delete_guild_template.ts @@ -1,6 +1,5 @@ import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { GuildTemplate } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/templates/edit_guild_template.ts b/src/helpers/templates/edit_guild_template.ts index 1bae9cce6..88845ae7e 100644 --- a/src/helpers/templates/edit_guild_template.ts +++ b/src/helpers/templates/edit_guild_template.ts @@ -1,6 +1,5 @@ import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { EditGuildTemplate, GuildTemplate } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/templates/get_guild_templates.ts b/src/helpers/templates/get_guild_templates.ts index 87558ece6..e35ea6661 100644 --- a/src/helpers/templates/get_guild_templates.ts +++ b/src/helpers/templates/get_guild_templates.ts @@ -1,6 +1,5 @@ import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { GuildTemplate } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/templates/get_template.ts b/src/helpers/templates/get_template.ts index bc71ea484..b170313d3 100644 --- a/src/helpers/templates/get_template.ts +++ b/src/helpers/templates/get_template.ts @@ -1,6 +1,5 @@ import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { GuildTemplate } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** Returns the guild template if it exists */ diff --git a/src/helpers/templates/sync_guild_template.ts b/src/helpers/templates/sync_guild_template.ts index d02861443..fe0cb11ba 100644 --- a/src/helpers/templates/sync_guild_template.ts +++ b/src/helpers/templates/sync_guild_template.ts @@ -1,6 +1,5 @@ import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { GuildTemplate } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/webhooks/create_webhook.ts b/src/helpers/webhooks/create_webhook.ts index d259fc561..a073ea343 100644 --- a/src/helpers/webhooks/create_webhook.ts +++ b/src/helpers/webhooks/create_webhook.ts @@ -1,9 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { - Errors, - WebhookCreateOptions, - WebhookPayload, -} from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotChannelPermissions } from "../../util/permissions.ts"; import { urlToBase64 } from "../../util/utils.ts"; diff --git a/src/helpers/webhooks/edit_webhook.ts b/src/helpers/webhooks/edit_webhook.ts index d2c202ae5..3d2c70ca2 100644 --- a/src/helpers/webhooks/edit_webhook.ts +++ b/src/helpers/webhooks/edit_webhook.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { WebhookEditOptions, WebhookPayload } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotChannelPermissions } from "../../util/permissions.ts"; diff --git a/src/helpers/webhooks/edit_webhook_message.ts b/src/helpers/webhooks/edit_webhook_message.ts index 37079a25f..5d3176910 100644 --- a/src/helpers/webhooks/edit_webhook_message.ts +++ b/src/helpers/webhooks/edit_webhook_message.ts @@ -1,10 +1,5 @@ import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { - EditWebhookMessageOptions, - Errors, - MessageCreateOptions, -} from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; export async function editWebhookMessage( diff --git a/src/helpers/webhooks/edit_webhook_with_token.ts b/src/helpers/webhooks/edit_webhook_with_token.ts index 617fe8eb4..e8f19d0b8 100644 --- a/src/helpers/webhooks/edit_webhook_with_token.ts +++ b/src/helpers/webhooks/edit_webhook_with_token.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { WebhookEditOptions, WebhookPayload } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** Edit a webhook. Returns the updated webhook object on success. */ diff --git a/src/helpers/webhooks/execute_webhook.ts b/src/helpers/webhooks/execute_webhook.ts index 8a0024104..f60b7dd7f 100644 --- a/src/helpers/webhooks/execute_webhook.ts +++ b/src/helpers/webhooks/execute_webhook.ts @@ -1,10 +1,5 @@ import { RequestManager } from "../../rest/request_manager.ts"; import { structures } from "../../structures/mod.ts"; -import { - Errors, - ExecuteWebhookOptions, - MessageCreateOptions, -} from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** Execute a webhook with webhook ID and webhook token */ diff --git a/src/helpers/webhooks/get_webhook.ts b/src/helpers/webhooks/get_webhook.ts index 3543b5a8b..e983554e0 100644 --- a/src/helpers/webhooks/get_webhook.ts +++ b/src/helpers/webhooks/get_webhook.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { WebhookPayload } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** Returns the new webhook object for the given id. */ diff --git a/src/helpers/webhooks/get_webhook_with_token.ts b/src/helpers/webhooks/get_webhook_with_token.ts index b9a173758..db004a13c 100644 --- a/src/helpers/webhooks/get_webhook_with_token.ts +++ b/src/helpers/webhooks/get_webhook_with_token.ts @@ -1,5 +1,4 @@ import { RequestManager } from "../../rest/request_manager.ts"; -import { WebhookPayload } from "../../types/mod.ts"; import { endpoints } from "../../util/constants.ts"; /** Returns the new webhook object for the given id, this call does not require authentication and returns no user in the webhook object. */ diff --git a/src/interactions/mod.ts b/src/interactions/mod.ts index 1eff735d1..868f42d4c 100644 --- a/src/interactions/mod.ts +++ b/src/interactions/mod.ts @@ -1,2 +1 @@ export * from "./server.ts"; -export * from "./types/mod.ts"; diff --git a/src/interactions/server.ts b/src/interactions/server.ts index 822b67587..59db09575 100644 --- a/src/interactions/server.ts +++ b/src/interactions/server.ts @@ -1,10 +1,4 @@ import { serve, verify } from "./deps.ts"; -import { - Interaction, - InteractionResponse, - InteractionResponseType, - InteractionType, -} from "./types/mod.ts"; /** This variable is a holder for the public key and other configuration */ const serverOptions = { @@ -18,17 +12,6 @@ export const handlers = { handleApplicationCommand, }; -export interface StartServerConfig { - /** The public key from your discord bot dashboard at discord.dev */ - publicKey: string; - /** The port number you are wanting to listen to, if you are following the guide, you probably want 80 */ - port: number; - /** The function you would like to provide to handle your commands. */ - handleApplicationCommand?( - payload: Interaction, - ): Promise<{ status?: number; body: InteractionResponse }>; -} - /** Starts the slash command server */ export async function startServer( { port, publicKey, handleApplicationCommand }: StartServerConfig, diff --git a/src/interactions/types/embed.ts b/src/interactions/types/embed.ts deleted file mode 100644 index fceae3f43..000000000 --- a/src/interactions/types/embed.ts +++ /dev/null @@ -1,95 +0,0 @@ -export interface Embed { - /** The title of the embed */ - title?: string; - /** The type of embed (always rich for webhook embeds) */ - type?: string; - /** The description of embeds */ - description?: string; - /** The url of embed */ - url?: string; - /** The timestamp of the embed content */ - timestamp?: string; - /** The color code of the embed */ - color?: number; - /** The footer information */ - footer?: EmbedFooter; - /** The image information */ - image?: EmbedImage; - /** The thumbnail information */ - thumbnail?: EmbedThumbnail; - /** The video information */ - video?: EmbedVideo; - /** Provider information */ - provider?: EmbedProvider; - /** Author information */ - author?: EmbedAuthor; - /** Fields information */ - fields?: EmbedField[]; -} - -export interface EmbedFooter { - /** The text of the footer */ - text: string; - /** The url of the footer icon. Only supports http(s) and attachments */ - "icon_url"?: string; - /** A proxied url of footer icon */ - "proxy_icon_url"?: string; -} - -export interface EmbedImage { - /** The source url of image (only supports http(s) and attachments) */ - url?: string; - /** A proxied url of the image */ - "proxy_url"?: string; - /** The height of image */ - height?: number; - /** The width of the image */ - width?: number; -} - -export interface EmbedThumbnail { - /** The source url of image (only supports http(s) and attachments) */ - url?: string; - /** A proxied url of the thumbnail */ - "proxy_url"?: string; - /** The height of the thumbnail */ - height?: number; - /** The width of the thumbnail */ - width?: number; -} - -export interface EmbedVideo { - /** The source url of video */ - url?: string; - /** The height of the video */ - height?: number; - /** The width of the video */ - width?: number; -} - -export interface EmbedProvider { - /** The name of the provider */ - name?: string; - /** The url of the provider */ - url?: string; -} - -export interface EmbedAuthor { - /** The name of the author */ - name?: string; - /** The url of the author */ - url?: string; - /** The url of the author icon (supports http(s) and attachments) */ - "icon_url"?: string; - /** A proxied url of author icon */ - "proxy_icon_url"?: string; -} - -export interface EmbedField { - /** The name of the field */ - name: string; - /** The value of the field */ - value: string; - /** Whether or not this field should display inline */ - inline?: boolean; -} diff --git a/src/interactions/types/interactions.ts b/src/interactions/types/interactions.ts deleted file mode 100644 index e9d291a3c..000000000 --- a/src/interactions/types/interactions.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { Embed } from "./embed.ts"; -import { MemberCreatePayload } from "./member.ts"; -import { AllowedMentions } from "./misc.ts"; - -export interface Interaction { - /** The id of the interaction */ - id: string; - /** The type of interaction */ - type: InteractionType; - /** The command data payload */ - data?: SlashCommandInteractionData; - /** The id of the guild it was sent from */ - "guild_id": string; - /** The id of the channel it was sent from */ - "channel_id": string; - /** The Payload of the member it was sent from */ - member: MemberCreatePayload; - /** The token for this interaction */ - token: string; -} - -export interface SlashCommandInteractionData { - /** The id of the command */ - id: string; - /** The name of the command */ - name: string; - /** the params and values from the user */ - options: SlashCommandInteractionDataOption[]; -} - -export interface SlashCommandInteractionDataOption { - /** The name of the parameter */ - name: string; - /** The value of the pair */ - // deno-lint-ignore no-explicit-any - value?: any; - /** Present if this option is a group or subcommand */ - options?: SlashCommandInteractionDataOption[]; -} - -export interface InteractionResponse { - /** The type of response */ - type: InteractionResponseType; - /** The optional response message */ - data?: SlashCommandCallbackData; -} - -export interface SlashCommandCallbackData { - /** is the response TTS */ - tts?: boolean; - /** message content */ - content?: string; - /** supports up to 10 embeds */ - embeds?: Embed[]; - /** allowed mentions for the message */ - allowed_mentions?: AllowedMentions; - /** acceptable values are message flags */ - flags?: number; -} - -export enum InteractionType { - PING = 1, - APPLICATION_COMMAND = 2, -} - -export enum InteractionResponseType { - /** ACK a `Ping` */ - PONG = 1, - /** Respond with a message, showing the user's input */ - CHANNEL_MESSAGE_WITH_SOURCE = 4, - /** ACK an interaction and edit to a response later, the user sees a loading state */ - DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE, -} diff --git a/src/interactions/types/member.ts b/src/interactions/types/member.ts deleted file mode 100644 index a0bb175c5..000000000 --- a/src/interactions/types/member.ts +++ /dev/null @@ -1,45 +0,0 @@ -export interface UserPayload { - /** The user's id */ - id: string; - /** the user's username, not unique across the platform */ - username: string; - /** The user's 4 digit discord tag */ - discriminator: string; - /** The user's avatar hash */ - avatar: string | null; - /** Whether the user is a bot */ - bot?: boolean; - /** Whether the user is an official discord system user (part of the urgent message system.) */ - system?: boolean; - /** Whether the user has two factor enabled on their account */ - "mfa_enabled"?: boolean; - /** the user's chosen language option */ - locale?: string; - /** Whether the email on this account has been verified */ - verified?: boolean; - /** The user's email */ - email?: string; - /** The flags on a user's account. */ - flags?: number; - /** The type of Nitro subscription on a user's account. */ - "premium_type"?: number; -} - -export interface MemberCreatePayload { - /** The user this guild member represents */ - user: UserPayload; - /** The user's guild nickname if one is set. */ - nick?: string; - /** Array of role ids that the member has */ - roles: string[]; - /** When the user joined the guild. */ - "joined_at": string; - /** When the user used their nitro boost on the server. */ - "premium_since"?: string; - /** Whether the user is deafened in voice channels */ - deaf: boolean; - /** Whether the user is muted in voice channels */ - mute: boolean; - /** total permissions of the member in the channel, including overrides */ - permissions: string; -} diff --git a/src/interactions/types/misc.ts b/src/interactions/types/misc.ts deleted file mode 100644 index 6312df855..000000000 --- a/src/interactions/types/misc.ts +++ /dev/null @@ -1,8 +0,0 @@ -export interface AllowedMentions { - /** An array of allowed mention types to parse from the content. */ - parse: ("roles" | "users" | "everyone")[]; - /** Array of role_ids to mention (Max size of 100) */ - roles?: string[]; - /** Array of user_ids to mention (Max size of 100) */ - users?: string[]; -} diff --git a/src/interactions/types/mod.ts b/src/interactions/types/mod.ts deleted file mode 100644 index 973213611..000000000 --- a/src/interactions/types/mod.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from "./embed.ts"; -export * from "./interactions.ts"; -export * from "./member.ts"; -export * from "./misc.ts"; -export * from "./slash.ts"; -export * from "./webhook.ts"; diff --git a/src/interactions/types/slash.ts b/src/interactions/types/slash.ts deleted file mode 100644 index aab5632ff..000000000 --- a/src/interactions/types/slash.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { - InteractionResponseType, - SlashCommandCallbackData, -} from "./interactions.ts"; - -export interface CreateSlashCommandOptions { - /** The name of the slash command. */ - name: string; - /** The description of the slash command. */ - description: string; - /** If a guildID is provided, this will be a GUILD command. If none is provided it will be a GLOBAL command. */ - guildID?: string; - /** The options for this command */ - options?: SlashCommandOption[]; -} - -export interface SlashCommand { - /** unique id of the command */ - id: string; - /** unique id of the parent application */ - "application_id": string; - /** 3-32 character name */ - name: string; - /** 1-100 character description */ - description: string; - /** the parameters for the command */ - options?: SlashCommandOption[]; -} - -export interface SlashCommandOption { - /** The type of option */ - type: SlashCommandOptionType; - /** 1-32 character name */ - name: string; - /** 1-100 character description*/ - description: string; - /** the first `required` option for the user to complete--only one option can be `default` */ - default?: boolean; - /** if the parameter is required or optional--default `false`*/ - required?: boolean; - /** - * If you specify `choices` for an option, they are the **only** valid values for a user to pick. - * choices for `string` and `int` types for the user to pick from - */ - choices?: SlashCommandOptionChoice[]; - /** if the option is a subcommand or subcommand group type, this nested options will be the parameters */ - options?: SlashCommandOption[]; -} - -export interface SlashCommandOptionChoice { - /** The name of the choice */ - name: string; - /** The value of the choice */ - value: string | number; -} - -export enum SlashCommandOptionType { - SUB_COMMAND = 1, - SUB_COMMAND_GROUP = 2, - STRING = 3, - INTEGER = 4, - BOOLEAN = 5, - USER = 6, - CHANNEL = 7, - ROLE = 8, -} - -export interface EditSlashCommandOptions { - id: string; - guildID?: string; -} - -export interface SendInteractionResponseOptions { - type: InteractionResponseType; - data: SlashCommandCallbackData; -} - -export interface EditSlashResponseOptions extends SlashCommandCallbackData { - /** If this is not provided, it will default to editing the original response. */ - messageID?: string; -} - -export interface UpsertSlashCommandOptions { - id: string; - guildID?: string; -} diff --git a/src/interactions/types/webhook.ts b/src/interactions/types/webhook.ts deleted file mode 100644 index 0a65112a6..000000000 --- a/src/interactions/types/webhook.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Embed } from "./embed.ts"; - -export interface ExecuteWebhookOptions { - /** waits for server confirmation of message send before response, and returns the created message body (defaults to false; when false a message that is not saved does not return an error) */ - wait?: boolean; - /** the message contents (up to 2000 characters) */ - content?: string; - /** override the default username of the webhook */ - username?: string; - /** override the default avatar of the webhook*/ - "avatar_url"?: string; - /** true if this is a TTS message */ - tts?: boolean; - /** file contents the contents of the file being sent one of content, file, embeds */ - file?: { blob: Blob; name: string }; - /** array of up to 10 embed objects embedded rich content. */ - embeds?: Embed[]; - /** allowed mentions for the message */ - mentions?: { - /** An array of allowed mention types to parse from the content. */ - parse: ("roles" | "users" | "everyone")[]; - /** Array of role_ids to mention (Max size of 100) */ - roles?: string[]; - /** Array of user_ids to mention (Max size of 100) */ - users?: string[]; - }; -} diff --git a/src/rest/cache.ts b/src/rest/cache.ts index e18c5f3a4..43f53e6eb 100644 --- a/src/rest/cache.ts +++ b/src/rest/cache.ts @@ -1,5 +1,3 @@ -import { RestCache } from "./types/mod.ts"; - export const restCache: RestCache = { pathQueues: new Map(), processingQueue: false, diff --git a/src/rest/queue.ts b/src/rest/queue.ts index beea327ec..ec08e130a 100644 --- a/src/rest/queue.ts +++ b/src/rest/queue.ts @@ -1,7 +1,6 @@ import { delay } from "../util/utils.ts"; import { restCache } from "./cache.ts"; import { createRequestBody, processRequestHeaders } from "./request.ts"; -import { HttpResponseCode } from "./types/mod.ts"; /** Processes the queue by looping over each path separately until the queues are empty. */ export async function processQueue(id: string) { diff --git a/src/rest/request.ts b/src/rest/request.ts index d6a763c3a..84913774e 100644 --- a/src/rest/request.ts +++ b/src/rest/request.ts @@ -2,11 +2,6 @@ import { BASE_URL, USER_AGENT } from "../util/constants.ts"; import { restCache } from "./cache.ts"; import { ServerRequest } from "./deps.ts"; import { processQueue } from "./queue.ts"; -import { - QueuedRequest, - RestServerOptions, - RunMethodOptions, -} from "./types/mod.ts"; /** Processes a request and assigns it to a queue or creates a queue if none exists for it. */ export function processRequest( diff --git a/src/rest/request_manager.ts b/src/rest/request_manager.ts index 02e12b6a9..65db5c2bc 100644 --- a/src/rest/request_manager.ts +++ b/src/rest/request_manager.ts @@ -1,10 +1,4 @@ import { authorization, eventHandlers, restAuthorization } from "../bot.ts"; -import { - Errors, - FileContent, - HttpResponseCode, - RequestMethods, -} from "../types/mod.ts"; import { API_VERSION, BASE_URL, @@ -19,25 +13,6 @@ const ratelimitedPaths = new Map(); let globallyRateLimited = false; let queueInProcess = false; -export interface QueuedRequest { - callback: () => Promise< - void | { - // deno-lint-ignore no-explicit-any - rateLimited: any; - beforeFetch: boolean; - bucketID?: string | null; - } - >; - bucketID?: string | null; - url: string; -} - -export interface RateLimitedPath { - url: string; - resetTimestamp: number; - bucketID: string | null; -} - async function processRateLimitedPaths() { const now = Date.now(); ratelimitedPaths.forEach((value, key) => { diff --git a/src/rest/server.ts b/src/rest/server.ts index fbff1b460..220b7a598 100644 --- a/src/rest/server.ts +++ b/src/rest/server.ts @@ -2,7 +2,6 @@ import { restCache } from "./cache.ts"; import { serve, ServerRequest, serveTLS } from "./deps.ts"; import { processRequest } from "./request.ts"; -import { RestServerOptions } from "./types/mod.ts"; /** Begins an http server that will handle incoming requests. */ export async function startRESTServer(options: RestServerOptions) { diff --git a/src/rest/types/cache.ts b/src/rest/types/cache.ts deleted file mode 100644 index 76b8d0cb0..000000000 --- a/src/rest/types/cache.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { QueuedRequest, RateLimitedPath } from "./queue.ts"; -import { RestEventHandlers } from "./server.ts"; - -export interface RestCache { - /** The queues that are currently needing to be executed. Key is the url path and the value is all the requests in this same path. Paths are mapped by MAJOR params. */ - pathQueues: Map; - /** Whether or not the queues are currently processing. */ - processingQueue: boolean; - /** Whether or not this token has been globally rate limited. */ - globallyRateLimited: boolean; - /** The paths that have been rate limited */ - ratelimitedPaths: Map; - /** The event handlers are functions that run when something is happening internally. Users can customize this for analytics, debugging, logging or anything their heart desires. */ - eventHandlers: RestEventHandlers; -} diff --git a/src/rest/types/http.ts b/src/rest/types/http.ts deleted file mode 100644 index d69bcd6ea..000000000 --- a/src/rest/types/http.ts +++ /dev/null @@ -1,14 +0,0 @@ -export enum HttpResponseCode { - Ok = 200, - Created = 201, - NoContent = 204, - NotModified = 304, - BadRequest = 400, - Unauthorized = 401, - Forbidden = 403, - NotFound = 404, - MethodNotAllowed = 405, - TooManyRequests = 429, - GatewayUnavailable = 502, - // ServerError left untyped because it's 5xx. -} diff --git a/src/rest/types/mod.ts b/src/rest/types/mod.ts deleted file mode 100644 index f3805221e..000000000 --- a/src/rest/types/mod.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from "./cache.ts"; -export * from "./http.ts"; -export * from "./queue.ts"; -export * from "./requests.ts"; -export * from "./server.ts"; diff --git a/src/rest/types/queue.ts b/src/rest/types/queue.ts deleted file mode 100644 index 59eea4d34..000000000 --- a/src/rest/types/queue.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { ServerRequest } from "../deps.ts"; -import { RestServerOptions, RunMethodOptions } from "./mod.ts"; - -export interface RateLimitedPath { - /** The url for this request */ - url: string; - /** The timestamp when this request can be made. */ - resetTimestamp: number; - /** The bucket id that is assigned to this request path. */ - bucketID: string | null; -} - -export interface QueuedRequest { - /** The request itself, the server received. This will be used to send a response later. */ - request: ServerRequest; - /** The payload like url, method and such for the request. */ - payload: RunMethodOptions; - /** The intial start configurations like token which is necessary for headers. */ - options: RestServerOptions; -} diff --git a/src/rest/types/requests.ts b/src/rest/types/requests.ts deleted file mode 100644 index 415916ca1..000000000 --- a/src/rest/types/requests.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type RequestMethods = - | "get" - | "post" - | "put" - | "patch" - | "head" - | "delete"; - -export interface RunMethodOptions { - retryCount: number; - // deno-lint-ignore no-explicit-any - body?: any; - bucketID?: string | null; -} diff --git a/src/rest/types/server.ts b/src/rest/types/server.ts deleted file mode 100644 index 470d22038..000000000 --- a/src/rest/types/server.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { RunMethodOptions } from "./requests.ts"; - -export interface RestServerOptions { - /** The port number where the server will be hosted. */ - port: number; - /** The authorization secret key that all requests must provide in its headers. This prevents anyone from making your server do something. */ - authorization: string; - /** The bot token that will be used for authorization. */ - token: string; - /** When a request is rate limited, how many times should it keep retrying the request. Recommended: 10 */ - maxRetryCount: number; - /** The api version you would like to use */ - apiVersion?: number; - /** The TLS keys you would like to use */ - keys?: { - /** Path of the server certificate file (public key) */ - cert: string; - /** Path of the server's private key file. */ - key: string; - }; -} - -export interface RestEventHandlers { - /** Runs whenever an error occurs. Use this to log to sentry or log to discord with a webhook. */ - error: ( - type: RestErrorEventTypes, - // deno-lint-ignore no-explicit-any - ...data: any[] - ) => unknown | Promise; - /** Runs before every request is about to be fetched. Can be useful for things like analytics and debugging. */ - fetching: (data: RunMethodOptions) => unknown | Promise; - /** Runs right after a request is complete whether it worked or not. Useful for analytics and debugging. */ - fetched: (data: RunMethodOptions) => unknown | Promise; - /** The fetch request was successfully executed. Useful for analytics. */ - fetchSuccess: (data: RunMethodOptions) => unknown | Promise; - /** The fetch request errored somewhere. Useful for analytics and debugging */ - fetchFailed: ( - data: RunMethodOptions, - // deno-lint-ignore no-explicit-any - error: any, - ) => unknown | Promise; - /** Runs whenever the token is globally rate limited. Useful for analytics, debugging */ - globallyRateLimited: ( - url: string, - resetAt: number, - ) => unknown | Promise; - /** Runs when the maximum amount of retries has been reached. Useful for logging and debugging */ - retriesMaxed: (data: RunMethodOptions) => unknown | Promise; -} - -export type RestErrorEventTypes = - | "serverRequest" - | "processRequest" - | "httpError"; diff --git a/src/structures/channel.ts b/src/structures/channel.ts index c0dd7377d..e9af9169d 100644 --- a/src/structures/channel.ts +++ b/src/structures/channel.ts @@ -6,15 +6,6 @@ import { editChannel } from "../helpers/channels/edit_channel.ts"; import { editChannelOverwrite } from "../helpers/channels/edit_channel_overwrite.ts"; import { sendMessage } from "../helpers/messages/send_message.ts"; import { disconnectMember } from "../helpers/mod.ts"; -import { - ChannelCreatePayload, - ChannelEditOptions, - ChannelType, - MessageContent, - Overwrite, - Permission, - RawOverwrite, -} from "../types/mod.ts"; import { Collection } from "../util/collection.ts"; import { createNewProp } from "../util/utils.ts"; import { CleanVoiceState, Guild } from "./guild.ts"; @@ -111,91 +102,3 @@ export async function createChannelStruct( return channel as Channel; } - -export interface Channel { - /** The id of this channel */ - id: string; - /** Sorting position of the channel */ - position?: number; - /** The name of the channel (2-100 characters) */ - name?: string; - /** The channel topic (0-1024 characters) */ - topic?: string; - /** The bitrate (in bits) of the voice channel */ - bitrate?: number; - /** The type of the channel */ - type: ChannelType; - /** The guild id of the channel if it is a guild channel. */ - guildID: string; - /** The id of the last message sent in this channel */ - lastMessageID?: string; - /** The amount of users allowed in this voice channel. */ - userLimit?: number; - /** The rate limit (slowmode) in this text channel that users can send messages. */ - rateLimitPerUser?: number; - /** The category id for this channel */ - parentID?: string; - /** The last time when a message was pinned in this channel */ - lastPinTimestamp?: number; - /** The permission overwrites for this channel */ - permissionOverwrites: RawOverwrite[]; - /** Whether this channel is nsfw or not */ - nsfw: boolean; - - // GETTERS - - /** - * Gets the guild object for this channel. - * - * ⚠️ ADVANCED: If you use the custom cache, these will not work for you. Getters can not be async and custom cache requires async. - */ - guild?: Guild; - /** - * Gets the messages from cache that were sent in this channel - * - * ⚠️ ADVANCED: If you use the custom cache, these will not work for you. Getters can not be async and custom cache requires async. - */ - messages: Collection; - /** The mention of the channel */ - mention: string; - /** - * Gets the voice states for this channel - * - * ⚠️ ADVANCED: If you use the custom cache, these will not work for you. Getters can not be async and custom cache requires async. - */ - voiceStates?: Collection; - /** - * Gets the connected members for this channel undefined if member is not cached - * - * ⚠️ ADVANCED: If you use the custom cache, these will not work for you. Getters can not be async and custom cache requires async. - */ - connectedMembers?: Collection; - - // METHODS - - /** Send a message to the channel. Requires SEND_MESSAGES permission. */ - send(content: string | MessageContent): ReturnType; - /** Disconnect a member from a voice channel. Requires MOVE_MEMBERS permission. */ - disconnect(memberID: string): ReturnType; - /** Delete the channel */ - delete(): ReturnType; - /** Edit a channel Overwrite */ - editOverwrite( - overwriteID: string, - options: Omit, - ): ReturnType; - /** Delete a channel Overwrite */ - deleteOverwrite( - overwriteID: string, - ): ReturnType; - /** Checks if a channel overwrite for a user id or a role id has permission in this channel */ - hasPermission( - overwrites: RawOverwrite[], - permissions: Permission[], - ): ReturnType; - /** Edit the channel */ - edit( - options: ChannelEditOptions, - reason?: string, - ): ReturnType; -} diff --git a/src/structures/guild.ts b/src/structures/guild.ts index 61cf1c9c3..90e6d16ca 100644 --- a/src/structures/guild.ts +++ b/src/structures/guild.ts @@ -11,20 +11,6 @@ import { leaveGuild } from "../helpers/guilds/leave_guild.ts"; import { getInvites } from "../helpers/invites/get_invites.ts"; import { banMember } from "../helpers/members/ban_member.ts"; import { unbanMember } from "../helpers/members/unban_member.ts"; -import { - BanOptions, - CreateGuildPayload, - Emoji, - GetAuditLogsOptions, - GuildEditOptions, - GuildFeatures, - GuildMember, - ImageFormats, - ImageSize, - MemberCreatePayload, - Presence, - VoiceState, -} from "../types/mod.ts"; import { Collection } from "../util/collection.ts"; import { createNewProp } from "../util/utils.ts"; import { Member } from "./member.ts"; @@ -217,154 +203,3 @@ export async function createGuildStruct( return guild as Guild; } - -export interface Guild { - /** The guild id */ - id: string; - /** The guild name 2-100 characters */ - name: string; - /** The guild icon image hash */ - icon: string | null; - /** The guild splash image hash */ - splash: string | null; - /** Discovery splash has; only present for guilds with the "DISCOVERABLE" feature */ - disoverySplash: string | null; - /** The voice region id for the guild */ - region: string; - /** Default message notifications level */ - defaultMessageNotifications: number; - /** Explicit content filter level */ - explicitContentFilter: number; - /** The custom guild emojis */ - emojis: Collection; - /** Enabled guild features */ - features: GuildFeatures[]; - /** System channel flags */ - systemChannelFlags: number; - /** The id of the channel where guilds with the PUBLIC feature can display rules and or guidelines. */ - rulesChannelID: string | null; - /** The description for the guild */ - description: string | null; - /** The banner hash */ - banner: string | null; - /** The id of the channel where admins and moderators of guilds with the PUBLIC feature receive notices from Discord */ - publicUpdatesChannelID: string | null; - /** The maximum amount of users in a video channel. */ - maxVideoChannelUsers?: number; - /** The approximate number of members in this guild, returned from the GET /guild/id endpoint when with_counts is true */ - approximateMemberCount?: number; - /** The approximate number of non-offline members in this guild, returned from the GET /guild/id endpoint when with_counts is true */ - approximatePresenceCount?: number; - /** Whether this is considered a large guild */ - large: boolean; - /** Whether this guild is unavailable */ - unavailable: boolean; - /** The shard id that this guild is on */ - shardID: number; - /** The owner id of the guild. */ - ownerID: string; - /** The afk channel id for this guild. */ - afkChannelID: string; - /** The amount of time before a user is moved to AFK. */ - afkTimeout: number; - /** Whether or not the embed is enabled in this server. */ - widgetEnabled: boolean; - /** The channel id for the guild embed in this server. */ - widgetChannelID: string; - /** The verification level for this server. */ - verificationLevel: number; - /** The MFA level for this server. */ - mfaLevel: number; - /** The system channel id for this server. */ - systemChannelID: string; - /** The max presences for this server. */ - maxPresences: number; - /** The maximum members in this server. */ - maxMembers: number; - /** The vanity URL code for this server. */ - vanityURLCode: string; - /** The premium tier for this server. */ - premiumTier: number; - /** The subscription count for this server. */ - premiumSubscriptionCount: number; - /** The preferred language in this server. */ - preferredLocale: string; - /** The roles in the guild */ - roles: Collection; - /** When this guild was joined at. */ - joinedAt: number; - /** The presences of all the users in the guild. */ - presences: Collection; - /** The total number of members in this guild. This value is updated as members leave and join the server. However, if you do not have the intent enabled to be able to listen to these events, then this will not be accurate. */ - memberCount: number; - /** The Voice State data for each user in a voice channel in this server. */ - voiceStates: Collection; - - // GETTERS - /** Members in this guild. */ - members: Collection; - /** Channels in this guild. */ - channels: Collection; - /** The afk channel if one is set */ - afkChannel?: Channel; - /** The public update channel if one is set */ - publicUpdatesChannel?: Channel; - /** The rules channel in this guild if one is set */ - rulesChannel?: Channel; - /** The system channel in this guild if one is set */ - systemChannel?: Channel; - /** The bot member in this guild if cached */ - bot?: Member; - /** The bot guild member in this guild if cached */ - botMember?: GuildMember; - /** The bots voice state if there is one in this guild */ - botVoice?: CleanVoiceState; - /** The owner member of this guild */ - owner?: Member; - /** Whether or not this guild is partnered */ - partnered: boolean; - /** Whether or not this guild is verified */ - verified: boolean; - - // METHODS - - /** The banner url for this server */ - bannerURL(size?: ImageSize, format?: ImageFormats): string | undefined; - /** The full URL of the icon from Discords CDN. Undefined when no icon is set. */ - iconURL(size?: ImageSize, format?: ImageFormats): string | undefined; - /** Delete a guild permanently. User must be owner. Returns 204 No Content on success. Fires a Guild Delete Gateway event. */ - delete(): ReturnType; - /** Leave a guild */ - leave(): ReturnType; - /** Edit the server. Requires the MANAGE_GUILD permission. */ - edit(options: GuildEditOptions): ReturnType; - /** Returns the audit logs for the guild. Requires VIEW AUDIT LOGS permission */ - auditLogs(options: GetAuditLogsOptions): ReturnType; - /** Returns a ban object for the given user or a 404 not found if the ban cannot be found. Requires the BAN_MEMBERS permission. */ - getBan(memberID: string): ReturnType; - /** Returns a list of ban objects for the users banned from this guild. Requires the BAN_MEMBERS permission. */ - bans(): ReturnType; - /** Ban a user from the guild and optionally delete previous messages sent by the user. Requires the BAN_MEMBERS permission. */ - ban(memberID: string, options: BanOptions): ReturnType; - /** Remove the ban for a user. Requires BAN_MEMBERS permission */ - unban(memberID: string): ReturnType; - /** Get all the invites for this guild. Requires MANAGE_GUILD permission */ - invites(): ReturnType; -} - -export interface CleanVoiceState extends VoiceState { - /** The guild id where this voice state is from */ - guildID: string; - /** The channel id where this voice state is from */ - channelID: string; - /** The user id */ - userID: string; - /** The unique random session id for this voice session */ - sessionID: string; - /** Whether the user has deafened themself */ - selfDeaf: boolean; - /** Whether the user has muted themself */ - selfMute: boolean; - /** Whether the user is streaming on go live */ - selfStream: boolean; -} diff --git a/src/structures/member.ts b/src/structures/member.ts index d349280e2..38337b6d0 100644 --- a/src/structures/member.ts +++ b/src/structures/member.ts @@ -6,15 +6,6 @@ import { rawAvatarURL } from "../helpers/members/raw_avatar_url.ts"; import { sendDirectMessage } from "../helpers/members/send_direct_message.ts"; import { addRole } from "../helpers/roles/add_role.ts"; import { removeRole } from "../helpers/roles/remove_role.ts"; -import { - BanOptions, - EditMemberOptions, - GuildMember, - ImageFormats, - ImageSize, - MemberCreatePayload, - MessageContent, -} from "../types/mod.ts"; import { Collection } from "../util/collection.ts"; import { createNewProp } from "../util/utils.ts"; import { Guild } from "./guild.ts"; @@ -126,76 +117,3 @@ export async function createMemberStruct( return member as Member; } - -export interface Member { - /** The user's id */ - id: string; - /** the user's username, not unique across the platform */ - username: string; - /** The user's 4 digit discord tag */ - discriminator: string; - /** The user's avatar hash */ - avatar: string | null; - /** Whether the user is a bot */ - bot?: boolean; - /** Whether the user is an official discord system user (part of the urgent message system.) */ - system?: boolean; - /** the user's chosen language option */ - locale?: string; - /** Whether the email on this account has been verified */ - verified?: boolean; - /** The user's email */ - email?: string; - /** The flags on a user's account. */ - flags?: number; - /** Whether or not this user has 2FA enabled. */ - mfaEnabled?: boolean; - /** The premium type for this user */ - premiumType?: number; - /** The guild related data mapped by guild id */ - guilds: Collection; - - // GETTERS - /** The avatar url using the default format and size. */ - avatarURL: string; - /** The mention string for this member */ - mention: string; - /** The username#discriminator tag for this member */ - tag: string; - - // METHODS - - /** Returns the avatar url for this member and can be dynamically modified with a size or format */ - makeAvatarURL(options: { size?: ImageSize; format?: ImageFormats }): string; - /** Returns the guild for this guildID */ - guild(guildID: string): Guild | undefined; - /** Get the nickname or the username if no nickname */ - name(guildID: string): string; - /** Get the guild member object for the specified guild */ - guildMember(guildID: string): GuildMember | undefined; - /** Send a direct message to the user is possible */ - sendDM( - content: string | MessageContent, - ): ReturnType; - /** Kick the member from a guild */ - kick(guildID: string, reason?: string): ReturnType; - /** Edit the member in a guild */ - edit( - guildID: string, - options: EditMemberOptions, - ): ReturnType; - /** Ban a member in a guild */ - ban(guildID: string, options: BanOptions): ReturnType; - /** Add a role to the member */ - addRole( - guildID: string, - roleID: string, - reason?: string, - ): ReturnType; - /** Remove a role from the member */ - removeRole( - guildID: string, - roleID: string, - reason?: string, - ): ReturnType; -} diff --git a/src/structures/message.ts b/src/structures/message.ts index 04582e335..322c590c9 100644 --- a/src/structures/message.ts +++ b/src/structures/message.ts @@ -9,19 +9,6 @@ import { removeAllReactions } from "../helpers/messages/remove_all_reactions.ts" import { removeReaction } from "../helpers/messages/remove_reaction.ts"; import { removeReactionEmoji } from "../helpers/messages/remove_reaction_emoji.ts"; import { sendMessage } from "../helpers/messages/send_message.ts"; -import { - Activity, - Application, - Attachment, - DiscordReferencePayload, - Embed, - GuildMember, - MessageContent, - MessageCreateOptions, - MessageSticker, - Reaction, - UserPayload, -} from "../types/mod.ts"; import { createNewProp } from "../util/utils.ts"; import { Channel } from "./channel.ts"; import { Guild } from "./guild.ts"; @@ -174,116 +161,3 @@ export async function createMessageStruct(data: MessageCreateOptions) { return message as Message; } - -export interface Message { - /** The id of the message */ - id: string; - /** The id of the channel the message was sent in */ - channelID: string; - /** The id of the guild the message was sent in */ - guildID: string; - /** The author of this message (not guaranteed to be a valid user such as a webhook.) */ - author: UserPayload; - /** The contents of the message */ - content: string; - /** When this message was sent */ - timestamp: number; - /** When this message was edited (if it was not edited, null) */ - editedTimestamp?: number; - /** Whether this was a TextToSpeech message. */ - tts: boolean; - /** Whether this message mentions everyone */ - mentionsEveryone: boolean; - /** Users specifically mentioned in the message. */ - mentions: string[]; - /** Roles specifically mentioned in this message */ - mentionRoleIDs: string[]; - /** Channels specifically mentioned in this message */ - mentionChannelIDs: string[]; - /** Any attached files */ - attachments: Attachment[]; - /** Any embedded content */ - embeds: Embed[]; - /** Reactions to the message */ - reactions?: Reaction[]; - /** Used for validating a message was sent */ - nonce?: number | string; - /** Whether this message is pinned */ - pinned: boolean; - /** If the message is generated by a webhook, this is the webhooks id */ - "webhook_id"?: string; - /** The type of message */ - type: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; - /** The activities sent with Rich Presence-related chat embeds. */ - activity?: Activity; - /** Applications that sent with Rich Presence related chat embeds. */ - applications?: Application; - /** The reference data sent with crossposted messages */ - messageReference?: DiscordReferencePayload; - /** The message flags combined like permission bits describe extra features of the message */ - flags?: 1 | 2 | 4 | 8 | 16; - /** the stickers sent with the message (bots currently can only receive messages with stickers, not send) */ - stickers?: MessageSticker[]; - /** The message id of the original message if this message was sent as a reply. If null, the original message was deleted. */ - referencedMessageID?: MessageCreateOptions | null; - - // GETTERS - - /** The channel where this message was sent. Can be undefined if uncached. */ - channel?: Channel; - /** The guild of this message. Can be undefined if not in cache or in DM */ - guild?: Guild; - /** The member for the user who sent the message. Can be undefined if not in cache or in dm. */ - member?: Member; - /** The guild member details for this guild and member. Can be undefined if not in cache or in dm. */ - guildMember?: GuildMember; - /** The url link to this message */ - link: string; - /** The role objects for all the roles that were mentioned in this message */ - mentionedRoles: (Role | undefined)[]; - /** The channel objects for all the channels that were mentioned in this message. */ - mentionedChannels: (Channel | undefined)[]; - /** The member objects for all the members that were mentioned in this message. */ - mentionedMembers: (Member | undefined)[]; - - // METHODS - - /** Delete the message */ - delete( - reason?: string, - delayMilliseconds?: number, - ): ReturnType; - /** Edit the message */ - edit(content: string | MessageContent): ReturnType; - /** Pins the message in the channel */ - pin(): ReturnType; - /** Add a reaction to the message */ - addReaction(reaction: string): ReturnType; - /** Add multiple reactions to the message without or without order. */ - addReactions( - reactions: string[], - ordered?: boolean, - ): ReturnType; - /** Send a inline reply to this message */ - reply(content: string | MessageContent): ReturnType; - /** Send a message to this channel where this message is */ - send(content: string | MessageContent): ReturnType; - /** Send a message to this channel and then delete it after a bit. By default it will delete after 10 seconds with no reason provided. */ - alert( - content: string | MessageContent, - timeout?: number, - reason?: string, - ): Promise; - /** Send a inline reply to this message but then delete it after a bit. By default it will delete after 10 seconds with no reason provided. */ - alertReply( - content: string | MessageContent, - timeout?: number, - reason?: string, - ): Promise; - /** Remove all reactions */ - removeAllReactions(): ReturnType; - /** Remove all reactions */ - removeReactionEmoji(reaction: string): ReturnType; - /** Remove all reactions */ - removeReaction(reaction: string): ReturnType; -} diff --git a/src/structures/role.ts b/src/structures/role.ts index 584c01c94..f998923f2 100644 --- a/src/structures/role.ts +++ b/src/structures/role.ts @@ -1,7 +1,6 @@ import { cache } from "../cache.ts"; import { deleteRole } from "../helpers/roles/delete_role.ts"; import { editRole } from "../helpers/roles/edit_role.ts"; -import { CreateRoleOptions, RoleData } from "../types/mod.ts"; import { Collection } from "../util/collection.ts"; import { createNewProp } from "../util/utils.ts"; import { Guild } from "./guild.ts"; @@ -84,48 +83,3 @@ export async function createRoleStruct({ tags = {}, ...rest }: RoleData) { return role as Role; } - -export interface Role { - /** role id */ - id: string; - /** role name */ - name: string; - /** integer representation of hexadecimal color code */ - color: number; - /** if this role is pinned in the user listing */ - hoist: boolean; - /** position of this role */ - position: number; - /** permission bit set */ - permissions: string; - /** whether this role is managed by an integration */ - managed: boolean; - /** whether this role is mentionable */ - mentionable: boolean; - /** The bot id that is associated with this role. */ - botID?: string; - /** If this role is the nitro boost role. */ - isNitroBoostRole: boolean; - /** The integration id that is associated with this role */ - integrationID: string; - - // GETTERS - - /** The guild where this role is. If undefined, the guild is not cached */ - guild?: Guild; - /** The hex color for this role. */ - hexColor: string; - /** The cached members that have this role */ - members: Collection; - /** The @ mention of the role in a string. */ - mention: string; - - // METHODS - - /** Delete the role */ - delete(guildID?: string): ReturnType; - /** Edits the role */ - edit(options: CreateRoleOptions): ReturnType; - /** Checks if this role is higher than another role. */ - higherThanRoleID(roleID: string, position?: number): boolean; -} diff --git a/src/structures/template.ts b/src/structures/template.ts index ff10f8bad..5ce36d732 100644 --- a/src/structures/template.ts +++ b/src/structures/template.ts @@ -1,5 +1,4 @@ import { cache } from "../cache.ts"; -import { GuildTemplate, UserPayload } from "../types/mod.ts"; import { createNewProp } from "../util/utils.ts"; import { Guild } from "./guild.ts"; @@ -42,32 +41,3 @@ export function createTemplateStruct( isDirty: createNewProp(isDirty), }) as Template; } - -export interface Template { - /** the template code (unique ID) */ - code: string; - /** template name */ - name: string; - /** the description for the template */ - description: string | null; - /** number of times this template has been used */ - usageCount: number; - /** the ID of the user who created the template */ - createdID: string; - /** the user who created the template */ - creator: UserPayload; - /** when this template was created */ - createdAt: string; - /** when this template was last synced to the source guild */ - updatedAt: string; - /** the ID of the guild this template is based on */ - sourceGuildID: string; - /** the guild snapshot this template contains */ - serializedSourceGuild: Partial; - /** whether the template has unsynced changes */ - isDirty: boolean | null; - - // GETTERS - - sourceGuild: Guild | undefined; -} diff --git a/src/types/activity.ts b/src/types/activity.ts deleted file mode 100644 index 6aca25172..000000000 --- a/src/types/activity.ts +++ /dev/null @@ -1,67 +0,0 @@ -export interface ActivityPayload { - name: string; - type: number; - url?: string; - "created_at": number; - timestamps?: ActivityTimestamps; - "application_id"?: string; - details?: string; - state?: string; - emoji?: ActivityEmoji; - party?: ActivityParty; - assets?: ActivityAssets; - secrets?: ActivitySecrets; - instance?: boolean; - flags?: number; -} - -export enum ActivityType { - /** Example: "Playing Rocket League" */ - Game, - /** Example: "Streaming Rocket League" */ - Streaming, - /** Example: "Listening to spotify" */ - Listening, - /** Example: ":smiley: I am cool" */ - Custom = 4, - /** Example: "Competing in Arena World Champions" */ - Competing, -} - -export interface ActivityTimestamps { - start?: number; - end?: number; -} - -export interface ActivityEmoji { - name: string; - id?: string; - animated?: boolean; -} - -export interface ActivityParty { - id?: string; - size?: [number, number]; -} - -export interface ActivityAssets { - "large_image"?: string; - "large_text"?: string; - "small_image"?: string; - "small_text"?: string; -} - -export interface ActivitySecrets { - join?: string; - spectate?: string; - match?: string; -} - -export enum ActivityFlags { - INSTANCE = 1 << 0, - JOIN = 1 << 1, - SPECTATE = 1 << 2, - JOIN_REQUEST = 1 << 3, - SYNC = 1 << 4, - PLAY = 1 << 5, -} diff --git a/src/types/api/auditlog.ts b/src/types/api/auditlog.ts deleted file mode 100644 index bb9ed0230..000000000 --- a/src/types/api/auditlog.ts +++ /dev/null @@ -1,212 +0,0 @@ -import { - DiscordIntegration, - DiscordOverwrite, - DiscordRole, - DiscordUser, - DiscordWebhook, -} from "./mod.ts"; - -/** https://discord.com/developers/docs/resources/audit-log#audit-log-object */ -export interface DiscordAuditLogPayload { - /** list of webhooks found in the audit log */ - webhooks: DiscordWebhook[]; - /** list of users found in the audit log */ - users: DiscordUser[]; - /** list of audit log entries */ - audit_log_entries: DiscordAuditLogEntry[]; - /** list of partial integration objects */ - integrations: Partial[]; -} - -/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure */ -export interface DiscordAuditLogEntry { - /** id of the affected entity (webhook, user, role, etc.) */ - target_id: string | null; - /** changes made to the target_id */ - changes?: DiscordAuditLogChange[]; - /** the user who made the changes */ - user_id: string; - /** id of the entry */ - id: string; - /** type of action that occured */ - action_type: DiscordAuditLogEvent; - /** additional info for certain action types */ - options?: DiscordOptionalAuditEntryInfoParam; - /** the reason for the change (0-512 characters) */ - reason?: string; -} - -/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events */ -export enum DiscordAuditLogEvent { - GUILD_UPDATE = 1, - CHANNEL_CREATE = 10, - CHANNEL_UPDATE, - CHANNEL_DELETE, - CHANNEL_OVERWRITE_CREATE, - CHANNEL_OVERWRITE_UPDATE, - CHANNEL_OVERWRITE_DELETE, - MEMBER_KICK = 20, - MEMBER_PRUNE, - MEMBER_BAN_ADD, - MEMBER_BAN_REMOVE, - MEMBER_UPDATE, - MEMBER_ROLE_UPDATE, - MEMBER_MOVE, - MEMBER_DISCONNECT, - BOT_ADD, - ROLE_CREATE = 30, - ROLE_UPDATE, - ROLE_DELETE, - INVITE_CREATE = 40, - INVITE_UPDATE, - INVITE_DELETE, - WEBHOOK_CREATE = 50, - WEBHOOK_UPDATE, - WEBHOOK_DELETE, - EMOJI_CREATE = 60, - EMOJI_UPDATE, - EMOJI_DELETE, - MESSAGE_DELETE = 72, - MESSAGE_BULK_DELETE, - MESSAGE_PIN, - MESSAGE_UNPIN, - INTEGRATION_CREATE = 80, - INTEGRATION_UPDATE, - INTEGRATION_DELETE, -} - -/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info */ -export interface DiscordOptionalAuditEntryInfoParam { - /** number of days after which inactive members were kicked, type: MEMBER_PRUNE */ - delete_member_days: string; - /** number of members removed by the prune, type: MEMBER_PRUNE */ - members_removed: string; - /** channel in which the entities were targeted, types: MEMBER_MOVE & MESSAGE_PIN & MESSAGE_UNPIN & MESSAGE_DELETE */ - channel_id: string; - /** id of the message that was targeted, types: MESSAGE_PIN & MESSAGE_UNPIN */ - message_id: string; - /** number of entities that were targeted, types: MESSAGE_DELETE & MESSAGE_BULK_DELETE & MEMBER_DISCONNECT & MEMBER_MOVE */ - count: string; - /** id of the overwritten entity, types CHANNEL_OVERWRITE_CREATE & CHANNEL_OVERWRITE_UPDATE & CHANNEL_OVERWRITE_DELETE */ - id: string; - /** type of overwritten entity - "0", for "role", or "1" for "member", types: CHANNEL_OVERWRITE_CREATE & CHANNEL_OVERWRITE_UPDATE & CHANNEL_OVERWRITE_DELETE */ - type: string; - /** name of the role if type is "0" (not present if type is "1"), types: CHANNEL_OVERWRITE_CREATE & CHANNEL_OVERWRITE_UPDATE & CHANNEL_OVERWRITE_DELETE */ - role_name: string; -} - -/** https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure */ -export interface DiscordAuditLogChange { - /** new value of the key. If not present, while old_value is, that means the property that was changed has been reset */ - new_value?: DiscordAuditLogChangeValue; - /** old value of the key */ - old_value?: DiscordAuditLogChangeValue; - /** name of audit log change key */ - key: string; -} - -/** https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure */ -export type DiscordAuditLogChangeValue = - | { - new_value: string; - old_value: string; - key: - | "name" - | "description" - | "discovery_splash_hash" - | "banner_hash" - | "preferred_locale" - | "rules_channel_id" - | "public_updates_channel_id" - | "icon_hash" - | "splash_hash" - | "owner_id" - | "region" - | "afk_channel_id" - | "vanity_url_code" - | "widget_channel_id" - | "system_channel_id" - | "topic" - | "application_id" - | "permissions" - | "allow" - | "deny" - | "code" - | "channel_id" - | "inviter_id" - | "nick" - | "avatar_hash" - | "id"; - } - | { - new_value: number; - old_value: number; - key: - | "afk_timeout" - | "mfa_level" - | "verification_level" - | "explicit_content_filter" - | "default_messagae_notifications" - | "prune_delete_days" - | "position" - | "bitrate" - | "rate_limit_per_user" - | "color" - | "max_uses" - | "uses" - | "max_age" - | "expire_behavior" - | "expire_grace_period" - | "user_limit"; - } - | { - new_value: Partial; - old_value: Partial; - key: "$add" | "$remove"; - } - | { - new_value: boolean; - old_value: boolean; - key: - | "widget_enabled" - | "nsfw" - | "hoist" - | "mentionable" - | "temporary" - | "deaf" - | "mute" - | "enable_emoticons"; - } - | { - new_value: DiscordOverwrite[]; - old_value: DiscordOverwrite[]; - key: "permission_overwrites"; - } - | { - new_value: string | number; - old_value: string | number; - key: "type"; - }; - -/** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log-query-string-parameters */ -export interface DiscordGetGuildAuditLogParams { - /** filter the log for actions made by a user */ - user_id: string; - /** the type of audit log event */ - action_type: DiscordAuditLogEvent; - /** filter the log before a certain entry id */ - before: string; - /** how many entries are returned (default 50, minimum 1, maximum 100) */ - limit: number; -} - -export interface DiscordGetAuditLogsOptions { - /** Filter the logs for actions made by this user. */ - user_id?: string; - /** The type of audit log. */ - action_type?: DiscordAuditLogEvent; - /** Filter the logs before a certain log entry. */ - before?: string; - /** How many entries are returned. Between 1-100. Default 50. */ - limit?: number; -} diff --git a/src/types/api/channel.ts b/src/types/api/channel.ts deleted file mode 100644 index 31b7f79fc..000000000 --- a/src/types/api/channel.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { DiscordOverwrite, DiscordUser } from "./mod.ts"; - -/** https://discord.com/developers/docs/resources/channel#channel-object-channel-types */ -export enum DiscordChannelTypes { - /** a text channel within a server */ - GUILD_TEXT, - /** a direct message between users */ - DM, - /** a voice channel within a server */ - GUILD_VOICE, - /** a direct message between multiple users */ - GROUP_DM, - /** an organizational category that contains up to 50 channels */ - GUILD_CATEGORY, - /** a channel that users can follow and crosspost into their own server */ - GUILD_NEWS, - /** a channel in which game developers can sell their game on Discord */ - GUILD_STORE, -} - -/** https://discord.com/developers/docs/resources/channel#channel-object-channel-structure */ -export interface DiscordChannel { - /** the id of this channel */ - id: string; - /** the type of channel */ - type: DiscordChannelTypes; - /** the id of the guild */ - guild_id?: string; - /** sorting position of the channel */ - position?: number; - /** explicit permission overwrites for members and roles */ - permission_overwrites?: DiscordOverwrite[]; - /** the name of the channel (2-100 characters) */ - name?: string; - /** the channel topic (0-1024 characters) */ - topic?: string | null; - /** whether the channel is nsfw */ - nsfw?: boolean; - /** the id of the last message sent in this channel (may not point to an existing or valid message) */ - last_message_id?: string | null; - /** the bitrate (in bits) of the voice channel */ - bitrate?: number; - /** the user limit of the voice channel */ - user_limit?: number; - /** amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffected */ - rate_limit_per_user?: number; - /** the recipients of the DM */ - recipients?: DiscordUser[]; - /** icon hash */ - icon?: string | null; - /** id of the DM creator */ - owner_id?: string; - /** application id of the group DM creator if it is bot-created */ - application_id?: string; - /** id of the parent category for a channel (each parent category can contain up to 50 channels) */ - parent_id?: string | null; - /** when the last pinned message was pinned. This may be null in events such as GUILD_CREATE when a message is not pinned. */ - last_pin_timestamp?: string | null; -} - -/** https://discord.com/developers/docs/resources/channel#followed-channel-object-followed-channel-structure */ -export interface DiscordFollowedChannel { - /** source channel id */ - channel_id: string; - /** created target webhook id */ - webhook_id: string; -} - -/** https://discord.com/developers/docs/resources/channel#modify-channel-json-params */ -export interface DiscordModifyChannelParams { - /** 2-100 character channel name */ - name?: string; - /** the type of channel; only conversion between text and news is supported and only in guilds with the "NEWS" feature */ - type?: DiscordChannelTypes; - /** the position of the channel in the left-hand listing */ - position?: number | null; - /** 0-1024 character channel topic */ - topic?: string | null; - /** whether the channel is nsfw */ - nsfw?: boolean | null; - /** amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`, are unaffected */ - rate_limit_per_user?: number | null; - /** the bitrate (in bits) of the voice channel; 8000 to 96000 (128000 for VIP servers) */ - bitrate?: number | null; - /** the user limit of the voice channel; 0 refers to no limit, 1 to 99 refers to a user limit */ - user_limit?: number | null; - /** channel or category-specific permissions */ - permission_overwrites?: DiscordOverwrite[] | null; - /** id of the new parent category for a channel */ - parent_id?: string | null; -} - -/** https://discord.com/developers/docs/resources/channel#edit-channel-permissions-json-params */ -export interface DiscordEditChannelPermissions { - /** the bitwise value of all allowed permissions */ - allow: string; - /** the bitwise value of all disallowed permissions */ - deny: string; - /** 0 for a role or 1 for a member */ - type: number; -} - -/** https://discord.com/developers/docs/resources/channel#follow-news-channel-json-params */ -export interface DiscordFollowNewsChannelParams { - /** id of target channel */ - webhook_channel_id: string; -} diff --git a/src/types/api/code.ts b/src/types/api/code.ts deleted file mode 100644 index db12b5de4..000000000 --- a/src/types/api/code.ts +++ /dev/null @@ -1,188 +0,0 @@ -/** https://discord.com/developers/docs/topics/opcodes-and-status-codes#opcodes-and-status-codes */ -export enum DiscordGatewayOpcodes { - Dispatch, - Heartbeat, - Identify, - PresenceUpdate, - VoiceStateUpdate, - Resume = 6, - Reconnect, - RequestGuildMembers, - InvalidSession, - Hello, - HeartbeatACK, -} - -/** https://discord.com/developers/docs/topics/opcodes-and-status-codes#opcodes-and-status-codes */ -export enum DiscordGatewayCloseEventCodes { - UnknownError = 4000, - UnknownOpcode, - DecodeError, - NotAuthenticated, - AuthenticationFailed, - AlreadyAuthenticated, - InvalidSeq = 4007, - RateLimited, - SessionTimedOut, - InvalidShard, - ShardingRequired, - InvalidApiVersion, - InvalidIntents, - DisallowedIntents, -} - -/** https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice */ -export enum DiscordVoiceOpcodes { - Identify, - SelectProtocol, - Ready, - Heartbeat, - SessionDescription, - Speaking, - HeartbeatACK, - Resume, - Hello, - Resumed, - ClientDisconnect = 13, -} - -/** https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice */ -export enum DiscordVoiceCloseEventCodes { - UnknownOpcode = 4001, - FailedToDecodePayload, - NotAuthenticated, - AuthenticationFailed, - AlreadyAuthenticated, - SessionNoLongerValid, - SessionTimedOut = 4009, - ServerNotFound = 4011, - UnknownProtocol, - Disconnect = 4014, - VoiceServerCrashed, - UnknownEncryptionMode, -} - -/** https://discord.com/developers/docs/topics/opcodes-and-status-codes#http */ -export enum DiscordHTTPResponseCodes { - Ok = 200, - Created, - NoContent = 204, - NotModified = 304, - BadRequest = 400, - Unauthorized, - Forbidden = 403, - NotFound, - MethodNotAllowed, - TooManyRequests = 429, - GatewayUnavailable = 502, -} - -/** https://discord.com/developers/docs/topics/opcodes-and-status-codes#json */ -export enum DiscordJsonErrorCodes { - GeneralError, - UnknownAccount = 10001, - UnknownApplication, - UnknownChannel, - UnknownGuild, - UnknownIntegration, - UnknownInvite, - UnknownMember, - UnknownMessage, - UnknownPermissionOverwrite, - UnknownProvider, - UnknownRole, - UnknownToken, - UnknownUser, - UnknownEmoji, - UnknownWebhook, - UnknownBan = 10026, - UnknownSKU, - UnknownStoreListing, - UnknownEntitlement, - UnknownBuild, - UnknownLobby, - UnknownBranch, - UnknownRedistributable = 10036, - UnknownGuildTemplate = 10057, - UnknownApplicationCommand = 10063, - BotsCannotUseThisEndpoint = 20001, - OnlyBotsCanUseThisEndpoint, - ThisMessageCannotBeEditedDueToAnnouncementRateLimits = 20022, - TheChannelYouAreWritingHasHitTheWriteRateLimit = 20028, - MaximumNumberOfGuildsReached = 30001, - MaximumNumberOfFriendsReached, - MaximumNumberOfPinsReachedForTheChannel, - MaximumNumberOfGuildRolesReached = 30005, - MaximumNumberOfWebhooksReached = 30007, - MaximumNumberOfReactionsReached = 30010, - MaximumNumberOfGuildChannelsReached = 30013, - MaximumNumberOfAttachmentsInAMessageReached = 30015, - MaximumNumberOfInvitesReached, - GuildAlreadyHasTemplate = 30031, - UnauthorizedProvideAValidTokenAndTryAgain = 40001, - YouNeedToVerifyYourAccountInOrderToPerformThisAction, - RequestEntityTooLargeTrySendingSomethingSmallerInSize = 40005, - ThisFeatureHasBeenTemporarilyDisabledServerSide, - ThisUserBannedFromThisGuild, - ThisMessageHasAlreadyBeenCrossposted = 40033, - MissingAccess = 50001, - InvalidAccountType, - CannotExecuteActionOnADMChannel, - GuildWidgetDisabled, - CannotEditMessageAuthoredByAnotherUser, - CannotSendAnEmptyMessage, - CannotSendMessagesToThisUser, - CannotSendMessagesInAVoiceChannel, - ChannelVerificationLevelIsTooHighForYouToGainAccess, - Oauth2ApplicationDoesNotHaveABot, - Oauth2ApplicationLimitReached, - InvalidOauth2State, - YouLackPermissionsToPerformThatAction, - InvalidAuthenticationTokenProvided, - NoteWasTooLong, - ProvidedTooFewOrTooManyMessagesToDeleteMustProvideAtLeast2AndFewerThan100MessagesToDelete, - AMessageCanOnlyBePinnedInTheChannelItWasSentIn = 50019, - InviteCodeWasEitherInvalidOrTaken, - CannotExecuteActionOnASystemMessage, - CannotExecuteActionOnThisChannelType = 50024, - InvalidOauth2AccessTokenProvided, - InvalidRecipients = 50033, - AMessageProvidedWasTooOldToBulkDelete, - InvalidFormBodyOrContentTypeProvided, - AnInviteWasAcceptedToAGuildTheApplicationsBotIsNotIn, - InvalidApiVersionProvided = 50041, - CannotDeleteAChannelRequiredForCommunityGuilds = 50074, - InvalidStickerSent = 50081, - ReqctionWasBlocked = 90001, - ApiResourceIsCurrentlyOverloadedTryAgainALittleLater = 130000, -} - -/** https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc */ -export enum DiscordRpcErrorCodes { - UnknownError = 1000, - InvalidPayload = 4000, - InvalidCommand = 4002, - InvalidGuild, - InvalidEvent, - InvalidChannel, - InvalidPermissions, - InvalidClientID, - InvalidOrigin, - InvalidToken, - InvalidUser, - OAuth2Error = 5000, - SelectChannelTimedOut, - GetGuildTimedOut, - SelectVoiceForceRequired, - CaptureShortcutAlreadyListening, -} - -/** https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc */ -export enum DiscordRpcCloseEventCodes { - InvalidClientID = 4000, - InvalidOrigin, - RateLimited, - TokenRevoked, - InvalidVersion, - InvalidEncoding, -} diff --git a/src/types/api/embed.ts b/src/types/api/embed.ts deleted file mode 100644 index 0535d4516..000000000 --- a/src/types/api/embed.ts +++ /dev/null @@ -1,117 +0,0 @@ -/** https://discord.com/developers/docs/resources/channel#embed-object-embed-structure */ -export interface DiscordEmbed { - /** title of embed */ - title?: string; - /** type of embed (always "rich" for webhook embeds) */ - type?: string; - /** description of embed */ - description?: string; - /** url of embed */ - url?: string; - /** timestamp of embed content */ - timestamp?: string; - /** color code of the embed */ - color?: number; - /** footer information */ - footer?: DiscordEmbedFooter; - /** image information */ - image?: DiscordEmbedImage; - /** thumbnail information */ - thumbnail?: DiscordEmbedThumbnail; - /** video information */ - video?: DiscordEmbedVideo; - /** provider information */ - provider?: DiscordEmbedProvider; - /** author information */ - author?: DiscordEmbedAuthor; - /** fields information */ - fields?: DiscordEmbedField[]; -} - -/** - * https://discord.com/developers/docs/resources/channel#embed-object-embed-types - * @deprecated - */ -export type EmbedTypes = - | "rich" - | "image" - | "video" - | "gifv" - | "article" - | "link"; - -/** https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure */ -export interface DiscordEmbedThumbnail { - /** source url of thumbnail (only supports http(s) and attachments) */ - url?: string; - /** a proxied url of the thumbnail */ - proxy_url?: string; - /** height of thumbnail */ - height?: number; - /** width of thumbnail */ - width?: number; -} - -/** https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure */ -export interface DiscordEmbedVideo { - /** source url of video */ - url?: string; - /** a proxied url of the video */ - proxy_url?: string; - /** height of video */ - height?: number; - /** width of video */ - width?: number; -} - -/** https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure */ -export interface DiscordEmbedImage { - /** source url of image (only supports http(s) and attachments) */ - url?: string; - /** a proxied url of the image */ - proxy_url?: string; - /** height of image */ - height?: number; - /** width of image */ - width?: number; -} - -/** https://discord.com/developers/docs/resources/channel#embed-object-embed-provider-structure */ -export interface DiscordEmbedProvider { - /** name of provider */ - name?: string; - /** url of provider */ - url?: string; -} - -/** https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure */ -export interface DiscordEmbedAuthor { - /** name of author */ - name?: string; - /** url of author */ - url?: string; - /** url of author icon (only supports http(s) and attachments) */ - icon_url?: string; - /** a proxied url of author icon */ - proxy_icon_url?: string; -} - -/** https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure */ -export interface DiscordEmbedFooter { - /** footer text */ - text: string; - /** url of footer icon (only supports http(s) and attachments) */ - icon_url?: string; - /** a proxied url of footer icon */ - proxy_icon_url?: string; -} - -/** https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure */ -export interface DiscordEmbedField { - /** name of the field */ - name: string; - /** value of the field */ - value: string; - /** whether or not this field should display inline */ - inline?: boolean; -} diff --git a/src/types/api/emoji.ts b/src/types/api/emoji.ts deleted file mode 100644 index 6a8943da6..000000000 --- a/src/types/api/emoji.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { DiscordUser } from "./mod.ts"; - -/** https://discord.com/developers/docs/resources/emoji#emoji-object-emoji-structure */ -export interface DiscordEmoji { - /** emoji id */ - id: string | null; - /** emoji name */ - name: string | null; - /** roles this emoji is whitelisted to */ - roles?: string[]; - /** user that created this emoji */ - user?: DiscordUser; - /** whether this emoji must be wrapped in colons */ - require_colons?: boolean; - /** whether this emoji is managed */ - managed?: boolean; - /** whether this emoji is animated */ - animated?: boolean; - /** whether this emoji can be used, may be false due to loss of Server Boosts */ - available?: boolean; -} - -/** https://discord.com/developers/docs/resources/emoji#create-guild-emoji */ -export interface DiscordCreateGuildEmojiParams { - /** name of the emoji */ - name: string; - /** the 128x128 emoji image (Data URI scheme) */ - image: string; - /** roles for which this emoji will be whitelisted */ - roles: string[]; -} - -/** https://discord.com/developers/docs/resources/emoji#modify-guild-emoji */ -export interface DiscordModifyGuildEmojiParams { - /** name of the emoji */ - name?: string; - /** roles to which this emoji will be whitelisted */ - roles?: string[] | null; -} diff --git a/src/types/api/event.ts b/src/types/api/event.ts deleted file mode 100644 index 38c8bc0bf..000000000 --- a/src/types/api/event.ts +++ /dev/null @@ -1,350 +0,0 @@ -import { - DiscordActivity, - DiscordApplication, - DiscordClientStatus, - DiscordEmoji, - DiscordIntegration, - DiscordMember, - DiscordRole, - DiscordStatusTypes, - DiscordUnavailableGuild, - DiscordUser, -} from "./mod.ts"; - -/** https://discord.com/developers/docs/topics/gateway#hello */ -export interface DiscordHelloEvent { - /** the interval (in milliseconds) the client should heartbeat with */ - heartbeat_interval: number; -} - -/** https://discord.com/developers/docs/topics/gateway#ready */ -export interface DiscordReadyEvent { - /** gateway version */ - v: number; - /** information about the user including email */ - user: DiscordUser; - /** empty array */ - private_channels: []; - /** the guilds the user is in */ - guilds: DiscordUnavailableGuild[]; - /** used for resuming connections */ - session_id: string; - /** the shard information associated with this session, if sent when identifying */ - shard?: [number, number]; - /** contains id and flags */ - application: Pick; -} - -/** https://discord.com/developers/docs/topics/gateway#channel-pins-update-channel-pins-update-event-fields */ -export interface DiscordChannelPinsUpdateEvent { - /** the id of the guild */ - guild_id?: string; - /** the id of the channel */ - channel_id: string; - /** the time at which the most recent pinned message was pinned */ - last_pin_timestamp?: string | null; -} - -/** https://discord.com/developers/docs/topics/gateway#guild-ban-add-guild-ban-add-event-fields */ -export interface DiscordGuildBanAddEvent { - /** id of the guild */ - guild_id: string; - /** the banned user */ - user: DiscordUser; -} - -/** https://discord.com/developers/docs/topics/gateway#guild-ban-remove-guild-ban-remove-event-fields */ -export interface DiscordGuildBanRemoveEvent { - /** id of the guild */ - guild_id: string; - /** the unbanned user */ - user: DiscordUser; -} - -/** https://discord.com/developers/docs/topics/gateway#guild-emojis-update-guild-emojis-update-event-fields */ -export interface DiscordGuildEmojisUpdateEvent { - /** id of the guild */ - guild_id: string; - /** array of emojis */ - emojis: DiscordEmoji[]; -} - -/** https://discord.com/developers/docs/topics/gateway#guild-integrations-update-guild-integrations-update-event-fields */ -export interface DiscordGuildIntegrationsUpdateEvent { - /** id of the guild whose integrations were updated */ - guild_id: string; -} - -/** https://discord.com/developers/docs/topics/gateway#guild-member-add-guild-member-add-extra-fields */ -export interface DiscordGuildMemberAddExtra extends DiscordMember { - /** id of the guild */ - guild_id: string; -} - -/** https://discord.com/developers/docs/topics/gateway#guild-member-remove-guild-member-remove-event-fields */ -export interface DiscordGuildMemberRemoveEvent { - /** the id of the guild */ - guild_id: string; - /** the user who was removed */ - user: DiscordUser; -} - -/** https://discord.com/developers/docs/topics/gateway#guild-member-update-guild-member-update-event-fields */ -export interface DiscordGuildMemberUpdateEvent { - /** the id of the guild */ - guild_id: string; - /** user role ids */ - roles: string[]; - /** the user */ - user: DiscordUser; - /** nickname of the user in the guild */ - nick?: string | null; - /** when the user joined the guild */ - joied_at: string; - /** when the user starting boosting the guild */ - premium_since?: string | null; -} - -/** https://discord.com/developers/docs/topics/gateway#guild-members-chunk-guild-members-chunk-event-fields */ -export interface DiscordGuildMembersChunkEvent { - /** the id of the guild */ - guild_id: string; - /** set of guild members */ - members: DiscordMember[]; - /** the chunk index in the expected chunks for this response (0 <= chunk_index < chunk_count) */ - chunk_index: number; - /** the total number of expected chunks for this response */ - chunk_count: number; - /** if passing an invalid id to REQUEST_GUILD_MEMBERS, it will be returned here */ - not_found?: []; - /** if passing true REQUEST_GUILD_MEMBERS, presences of the returned members will be here */ - presences?: DiscordPresenceUpdateEvent[]; - /** the nonce used in the Guild Members Request */ - nonce?: string; -} - -/** https://discord.com/developers/docs/topics/gateway#guild-role-create-guild-role-create-event-fields */ -export interface DiscordGuildRoleCreateEvent { - /** the id of the guild */ - guild_id: string; - /** the role created */ - role: DiscordRole; -} - -/** https://discord.com/developers/docs/topics/gateway#guild-role-update-guild-role-update-event-fields */ -export interface DiscordGuildRoleUpdateEvent { - /** the id of the guild */ - guild_id: string; - /** the role updated */ - role: DiscordRole; -} - -/** https://discord.com/developers/docs/topics/gateway#guild-role-delete-guild-role-delete-event-fields */ -export interface DiscordGuildRoleDeleteEvent { - /** id of the guild */ - guild_id: string; - /** id of the role */ - role_id: string; -} - -// TODO: Add the documentation Link -export interface DiscordIntegrationCreate extends DiscordIntegration { - /** id of the guild */ - guild_id: string; -} - -export interface DiscordIntegrationUpdate extends DiscordIntegration { - /** id of the guild */ - guild_id: string; -} - -export interface DiscordIntegrationDelete { - /** integration id */ - id: string; - /** id of the guild */ - guild_id: string; - /** id of the bot/OAuth2 application for this discordd integration */ - application_id?: string; -} - -/** https://discord.com/developers/docs/topics/gateway#invite-create-invite-create-event-fields */ -export interface DiscordInviteCreateEvent { - /** the channel the invite is for */ - channel_id: string; - /** the unique invite code */ - code: string; - /** the time at which the invite was created */ - created_at: string; - /** the guild of the invite */ - guild_id?: string; - /** the user that created the invite */ - inviter?: DiscordUser; - /** how long the invite is valid for (in seconds) */ - max_age: number; - /** the maximum number of times the invite can be used */ - max_uses: number; - /** the target user for this invite */ - target_user?: Partial; - /** the type of user target for this invite */ - target_user_type?: number; - /** whether or not the invite is temporary (invited users will be kicked on disconnect unless they're assigned a role) */ - temporary: boolean; - /** how many times the invite has been used (always will be 0) */ - uses: number; -} - -/** https://discord.com/developers/docs/topics/gateway#invite-delete-invite-delete-event-fields */ -export interface DiscordInviteDeleteEvent { - /** the channel of the invite */ - channel_id: string; - /** the guild of the invite */ - guild_id?: string; - /** the unique invite code */ - code: string; -} - -/** https://discord.com/developers/docs/topics/gateway#message-delete-message-delete-event-fields */ -export interface DiscordMessageDeleteEvent { - /** the id of the message */ - id: string; - /** the id of the channel */ - channel_id: string; - /** the id of the guild */ - guild_id?: string; -} - -/** https://discord.com/developers/docs/topics/gateway#message-delete-bulk-message-delete-bulk-event-fields */ -export interface DiscordMessageDeleteBulkEvent { - /** the ids of the messages */ - ids: string[]; - /** the id of the channel */ - channel_id: string; - /** the id of the guild */ - guild_id?: string; -} - -/** https://discord.com/developers/docs/topics/gateway#message-reaction-add-message-reaction-add-event-fields */ -export interface DiscordMessageReactionAddEvent { - /** the id of the user */ - user_id: string; - /** the id of the channel */ - channel_id: string; - /** the id of the message */ - message_id: string; - /** the id of the guild */ - guild_id?: string; - /** the member who reacted if this happened in a guild */ - member?: DiscordMember; - /** the emoji used to react */ - emoji: Partial; -} - -/** https://discord.com/developers/docs/topics/gateway#message-reaction-remove-message-reaction-remove-event-fields */ -export interface DiscordMessageReactionRemoveEvent { - /** the id of the user */ - user_id: string; - /** the id of the channel */ - channel_id: string; - /** the id of the message */ - message_id: string; - /** the id of the guild */ - guild_id?: string; - /** the emoji used to react */ - emoji: Partial; -} - -/** https://discord.com/developers/docs/topics/gateway#message-reaction-remove-all-message-reaction-remove-all-event-fields */ -export interface DiscordMessageReactionRemoveAllEvent { - /** the id of the channel */ - channel_id: string; - /** the id of the message */ - message_id: string; - /** the id of the guild */ - guild_id?: string; -} - -/** https://discord.com/developers/docs/topics/gateway#message-reaction-remove-emoji-message-reaction-remove-emoji */ -export interface DiscordMessageReactionRemoveEmoji { - /** the id of the channel */ - channel_id: string; - /** the id of the guild */ - guild_id?: string; - /** the id of the message */ - message_id: string; - /** the emoji that was removed */ - emoji: Partial; -} - -/** https://discord.com/developers/docs/topics/gateway#presence-update-presence-update-event-fields */ -export interface DiscordPresenceUpdateEvent { - /** the user presence is being updated for */ - user: DiscordUser; - /** id of the guild */ - guild_id: string; - /** either "idle", "dnd", "online", or "offline" */ - status: DiscordStatusTypes; - /** user's current activities */ - activities: DiscordActivity[]; - /** user's platform-dependent status */ - client_status: DiscordClientStatus; -} - -/** https://discord.com/developers/docs/topics/gateway#typing-start-typing-start-event-fields */ -export interface DiscordTypingStartEvent { - /** id of the channel */ - channel_id: string; - /** id of the guild */ - guild_id?: string; - /** id of the user */ - user_id: string; - /** unix time (in seconds) of when the user started typing */ - timestamp: number; - /** the member who started typing if this happened in a guild */ - member?: DiscordMember; -} - -/** https://discord.com/developers/docs/topics/gateway#voice-server-update-voice-server-update-event-fields */ -export interface DiscordVoiceServerUpdateEvent { - /** voice connection token */ - token: string; - /** the guildd this voice server update is for */ - guild_id: string; - /** the voice server host */ - endpoint: string; -} - -/** https://discord.com/developers/docs/topics/gateway#webhooks-update-webhook-update-event-fields */ -export interface DiscordWebhooksUpdateEvent { - /** id of the guild */ - guild_id: string; - /** id of the channel */ - channel_id: string; -} - -/** https://discord.com/developers/docs/resources/voice#voice-resource */ -export interface DiscordVoiceStateUpdateEvent { - /** the guild id this voice state is for */ - guild_id?: string; - /** the channel id this user is connected to */ - channel_id: string; - /** the user id this voice state is for */ - user_id: string; - /** the guild member this voice state is for */ - member?: DiscordMember; - /** the session id for this voice state */ - session_id: string; - /** whether this user is deafened by the server */ - deaf: boolean; - /** whether this user is muted by the server */ - mute: boolean; - /** whether this user is locally deafened */ - self_deaf: boolean; - /** whether this user is locally muted */ - self_mute: boolean; - /** whether this user is streaming using "Go Live" */ - self_stream?: boolean; - /** whether this user's camera is enabled */ - self_video: boolean; - /** whether this user is muted by the current user */ - suppress: boolean; -} diff --git a/src/types/api/gateway.ts b/src/types/api/gateway.ts deleted file mode 100644 index cfe4864be..000000000 --- a/src/types/api/gateway.ts +++ /dev/null @@ -1,487 +0,0 @@ -import { DiscordInteractionCommand } from "./interaction.ts"; -import { - DiscordChannel, - DiscordChannelPinsUpdateEvent, - DiscordGatewayOpcodes, - DiscordGuild, - DiscordGuildBanAddEvent, - DiscordGuildBanRemoveEvent, - DiscordGuildEmojisUpdateEvent, - DiscordGuildIntegrationsUpdateEvent, - DiscordGuildMemberAddExtra, - DiscordGuildMemberRemoveEvent, - DiscordGuildMembersChunkEvent, - DiscordGuildMemberUpdateEvent, - DiscordGuildRoleCreateEvent, - DiscordGuildRoleDeleteEvent, - DiscordGuildRoleUpdateEvent, - DiscordHelloEvent, - DiscordIntegrationCreate, - DiscordIntegrationDelete, - DiscordIntegrationUpdate, - DiscordInviteCreateEvent, - DiscordInviteDeleteEvent, - DiscordMember, - DiscordMessage, - DiscordMessageDeleteBulkEvent, - DiscordMessageDeleteEvent, - DiscordMessageReactionAddEvent, - DiscordMessageReactionRemoveAllEvent, - DiscordMessageReactionRemoveEmoji, - DiscordMessageReactionRemoveEvent, - DiscordPresenceUpdateEvent, - DiscordReadyEvent, - DiscordTypingStartEvent, - DiscordUnavailableGuild, - DiscordUser, - DiscordVoiceServerUpdateEvent, - DiscordVoiceStateUpdateEvent, - DiscordWebhooksUpdateEvent, -} from "./mod.ts"; - -/** https://discord.com/developers/docs/topics/gateway#payloads */ -export interface DiscordGateway { - /** opcode for the payload */ - op: DiscordGatewayOpcodes; - /** event data */ - d: DiscordGatewayDTypes; - /** sequence number, used for resuming sessions and heartbeats */ - s: number | null; - /** the event name for this payload */ - t: DiscordGatewayTTypes; -} - -/** GatewayPayload event data type list */ -export type DiscordGatewayDTypes = - | DiscordHelloEvent - | DiscordReadyEvent - | DiscordResume - | DiscordChannel - | DiscordChannelPinsUpdateEvent - | DiscordGuild - | DiscordUnavailableGuild - | DiscordGuildBanAddEvent - | DiscordGuildBanRemoveEvent - | DiscordGuildEmojisUpdateEvent - | DiscordGuildIntegrationsUpdateEvent - | DiscordMember - | DiscordGuildMemberAddExtra - | DiscordGuildMemberRemoveEvent - | DiscordGuildMemberUpdateEvent - | DiscordGuildMembersChunkEvent - | DiscordGuildRoleCreateEvent - | DiscordGuildRoleUpdateEvent - | DiscordGuildRoleDeleteEvent - | DiscordIntegrationCreate - | DiscordIntegrationUpdate - | DiscordIntegrationDelete - | DiscordInviteCreateEvent - | DiscordInviteDeleteEvent - | DiscordMessage - | DiscordMessageDeleteEvent - | DiscordMessageDeleteBulkEvent - | DiscordMessageReactionAddEvent - | DiscordMessageReactionRemoveEvent - | DiscordMessageReactionRemoveAllEvent - | DiscordMessageReactionRemoveEmoji - | DiscordPresenceUpdateEvent - | DiscordTypingStartEvent - | DiscordUser - | DiscordVoiceStateUpdateEvent - | DiscordVoiceServerUpdateEvent - | DiscordWebhooksUpdateEvent - | DiscordInteractionCommand - | false - | null; - -/** GatewayPayload event name list */ -export type DiscordGatewayTTypes = - | "HELLO" - | "READY" - | "RESUMED" - | "RECONNECT" - | "INVALID_SESSION" - | "CHANNEL_CREATE" - | "CHANNEL_UPDATE" - | "CHANNEL_DELETE" - | "CHANNEL_PINS_UPDATE" - | "GUILD_CREATE" - | "GUILD_UPDATE" - | "GUILD_DELETE" - | "GUILD_BAN_ADD" - | "GUILD_BAN_REMOVE" - | "GUILD_EMOJIS_UPDATE" - | "GUILD_INTEGRATIONS_UPDATE" - | "GUILD_MEMBER_ADD" - | "GUILD_MEMBER_REMOVE" - | "GUILD_MEMBER_UPDATE" - | "GUILD_MEMBERS_CHUNK" - | "GUILD_ROLE_CREATE" - | "GUILD_ROLE_UPDATE" - | "GUILD_ROLE_DELETE" - | "INTEGRATION_CREATE" - | "INTEGRATION_UPDATE" - | "INTEGRATION_DELETE" - | "INVITE_CREATE" - | "INVITE_DELETE" - | "MESSAGE_CREATE" - | "MESSAGE_UPDATE" - | "MESSAGE_DELETE" - | "MESSAGE_DELETE_BULK" - | "MESSAGE_REACTION_ADD" - | "MESSAGE_REACTION_REMOVE" - | "MESSAGE_REACTION_REMOVE_ALL" - | "MESSAGE_REACTION_REMOVE_EMOJI" - | "PRESENCE_UPDATE" - | "TYPING_START" - | "USER_UPDATE" - | "VOICE_STATE_UPDATE" - | "VOICE_SERVER_UPDATE" - | "WEBHOOKS_UPDATE" - | "INTERACTION_CREATE" - // Not in DC documentation - | "APPLICATION_COMMAND_CREATE" - | null; - -/** https://discord.com/developers/docs/topics/gateway#connecting-to-the-gateway */ -export interface DiscordGatewayURLParams { - /** gateway Version to use */ - v: number; - /** the encoding of recieved gateway packets */ - encoding: string; - /** the (optional) compression of gateway packets */ - compress?: string; -} - -/** https://discord.com/developers/docs/topics/gateway#gateway-intents */ -export enum DiscordGatewayIntents { - /** Enables the following events: - * - GUILD_CREATE - * - GUILD_DELETE - * - GUILD_ROLE_CREATE - * - GUILD_ROLE_UPDATE - * - GUILD_ROLE_DELETE - * - CHANNEL_CREATE - * - CHANNEL_UPDATE - * - CHANNEL_DELETE - * - CHANNEL_PINS_UPDATE - */ - GUILDS = 1 << 0, - /** Enables the following events: - * - GUILD_MEMBER_ADD - * - GUILD_MEMBER_UPDATE - * - GUILD_MEMBER_REMOVE - */ - GUILD_MEMBERS = 1 << 1, - /** Enables the following events: - * - GUILD_BAN_ADD - * - GUILD_BAN_REMOVE - */ - GUILD_BANS = 1 << 2, - /** Enables the following events: - * - GUILD_EMOJIS_UPDATE - */ - GUILD_EMOJIS = 1 << 3, - /** Enables the following events: - * - GUILD_INTEGRATIONS_UPDATE - * - INTEGRATION_CREATE - * - INTEGRATION_UPDATE - * - INTEGRATION_DELETE - */ - GUILD_INTEGRATIONS = 1 << 4, - /** Enables the following events: - * - WEBHOOKS_UPDATE - */ - GUILD_WEBHOOKS = 1 << 5, - /** Enables the following events: - * - INVITE_CREATE - * - INVITE_DELETE - */ - GUILD_INVITES = 1 << 6, - /** Enables the following events: - * - VOICE_STATE_UPDATE - */ - GUILD_VOICE_STATES = 1 << 7, - /** Enables the following events: - * - PRESENCE_UPDATE - */ - GUILD_PRESENCES = 1 << 8, - /** Enables the following events: - * - MESSAGE_CREATE - * - MESSAGE_UPDATE - * - MESSAGE_DELETE - */ - GUILD_MESSAGES = 1 << 9, - /** Enables the following events: - * - MESSAGE_REACTION_ADD - * - MESSAGE_REACTION_REMOVE - * - MESSAGE_REACTION_REMOVE_ALL - * - MESSAGE_REACTION_REMOVE_EMOJI - */ - GUILD_MESSAGE_REACTIONS = 1 << 10, - /** Enables the following events: - * - TYPING_START - */ - GUILD_MESSAGE_TYPING = 1 << 11, - /** Enables the following events: - * - CHANNEL_CREATE - * - MESSAGE_CREATE - * - MESSAGE_UPDATE - * - MESSAGE_DELETE - * - CHANNEL_PINS_UPDATE - */ - DIRECT_MESSAGES = 1 << 12, - /** Enables the following events: - * - MESSAGE_REACTION_ADD - * - MESSAGE_REACTION_REMOVE - * - MESSAGE_REACTION_REMOVE_ALL - * - MESSAGE_REACTION_REMOVE_EMOJI - */ - DIRECT_MESSAGE_REACTIONS = 1 << 13, - /** Enables the following events: - * - TYPING_START - */ - DIRECT_MESSAGE_TYPING = 1 << 14, -} - -/** https://discord.com/developers/docs/topics/gateway#identify */ -export interface DiscordIdentify { - /** authentication token */ - token: string; - /** connection properties */ - properties: DiscordIdentifyConnectionProps; - /** whether this connection supports compression of packets, default: false */ - compress?: boolean; - /** value between 50 and 250, total number of members where the gateway will stop sending offline members in the guild member list, default: 50 */ - large_threshold?: number; - /** used for Guild Sharding */ - shard: [number, number]; - /** presence structure for initial presence information */ - presence?: DiscordUpdateStatus; - /** enables dispatching of guild subscription events (presence and typing events), default: true */ - guild_subscriptions?: boolean; - /** the Gateway Intents you wish to receive */ - intents: number; -} - -/** https://discord.com/developers/docs/topics/gateway#identify-identify-connection-properties */ -export interface DiscordIdentifyConnectionProps { - /** your operating system */ - $os: string; - /** your library name */ - $browser: string; - /** your library name */ - $device: string; -} - -/** https://discord.com/developers/docs/topics/gateway#resume */ -export interface DiscordResume { - /** session token */ - token: string; - /** session id */ - session_id: string; - /** last sequence number received */ - seq: number; -} - -/** https://discord.com/developers/docs/topics/gateway#request-guild-members */ -export interface DiscordRequestGuildMembers { - /** id of the guild to get members for */ - guild_id: string; - /** string that username starts with, or an empty string to return all members */ - query?: string; - /** maximum number of members to send matching the query; a limit of 0 can be used with an empty string query to return all members */ - limit: number; - /** used to specify if we want the presence of the matched members */ - presences?: boolean; - /** used to specify which users you wish to fetch */ - user_ids?: string | string[]; - /** nonce to identify the Guild Members Chunk response */ - nonce?: string; -} - -/** https://discord.com/developers/docs/topics/gateway#update-voice-state */ -export interface DiscordUpdateVoiceState { - /** id of the guild */ - guild_id: string; - /** id of the voice channel client wants to join (null if disconnecting) */ - channel_id: string | null; - /** is the client muted */ - self_mute: boolean; - /** is the client deafened */ - self_deaf: boolean; -} - -/** https://discord.com/developers/docs/topics/gateway#update-status */ -export interface DiscordUpdateStatus { - /** unix time (in milliseconds) of when the client went idle, or null if the client is not idle */ - since: number | null; - /** null, or the user's activities */ - activities: DiscordActivity[]; - /** the user's new status */ - status: DiscordStatusTypes; - /** whether or not the client is afk */ - afk: boolean; -} - -/** https://discord.com/developers/docs/topics/gateway#update-status-status-types */ -export enum DiscordStatusTypes { - ONLINE = "online", - DND = "dnd", - IDLE = "idle", - INVISIBLE = "invisible", - OFFLINE = "offline", -} - -/** https://discord.com/developers/docs/topics/gateway#client-status-object */ -export interface DiscordClientStatus { - /** the user's status set for an active desktop (Windows, Linux, Mac) application session */ - desktop?: string; - /** the user's status set for an active mobile (iOS, Android) application session */ - mobile?: string; - /** the user's status set for an active web (browser, bot account) application session */ - web?: string; -} - -/** https://discord.com/developers/docs/topics/gateway#activity-object */ -export interface DiscordActivity { - /** the activity's id */ - id?: string; - /** the activity's name */ - name: string; - /** activity type */ - type: DiscordActivityTypes; - /** stream url, is validated when type is 1 */ - url?: string | null; - /** unix timestamp of when the activity was added to the user's session */ - created_at: number; - /** unix timestamps for start and/or end of the game */ - timestamps?: DiscordActivityTimestamps; - /** the id of the song on Spotify */ - sync_id?: string; - /** the platform the game is being played on ("desktop", "samsung", or "xbox") */ - platform?: string; - /** application id for the game */ - application_id?: string; - /** what the player is currently doing */ - details?: string | null; - /** the user's current party status */ - state?: string | null; - /** the emoji used for a custom status */ - emoji?: DiscordActivityEmoji | null; - /** the id of the game or Spotify session */ - session_id?: string; - /** information for the current party of the player */ - party?: DiscordActivityParty; - /** images for the presence and their hover texts */ - assets?: DiscordActivityAssets; - /** secrets for Rich Presence joining and spectating */ - secrets?: DiscordActivitySecrets; - /** whether or not the activity is an instanced game session */ - instance?: boolean; - /** activity flags OR d together, describes what the payload includes */ - flags?: DiscordActivityFlags; - /** the custom buttons shown in the Rich Presence (max 2) */ - buttons?: DiscordActivityButton[]; -} - -export interface DiscordActivityButton { - /** the text shown on the button (1-32 characters) */ - label: string; - /** the url opened when clicking the button (1-512 characters) */ - url: string; -} - -/** https://discord.com/developers/docs/topics/gateway#activity-object-activity-types */ -export enum DiscordActivityTypes { - /** Playing {name} */ - GAME, - /** Streaming {details} */ - STREAMING, - /** Listening to {name} */ - LISTENING, - /** {emoji} {name} */ - CUSTOM = 4, - /** Competing in {name} */ - COMPETING, -} - -/** https://discord.com/developers/docs/topics/gateway#activity-object-activity-timestamps */ -export interface DiscordActivityTimestamps { - /** unix time (in milliseconds) of when the activity started */ - start?: number; - /** unix time (in milliseconds) of when the activity ends */ - end?: number; -} - -/** https://discord.com/developers/docs/topics/gateway#activity-object-activity-emoji */ -export interface DiscordActivityEmoji { - /** the name of the emoji */ - name: string; - /** the id of the emoji */ - id?: string; - /** whether this emoji is animated */ - animated?: boolean; -} - -/** https://discord.com/developers/docs/topics/gateway#activity-object-activity-party */ -export interface DiscordActivityParty { - /** the id of the party */ - id?: string; - /** used to show the party's currrent and maximum size */ - size?: [number, number]; -} - -/** https://discord.com/developers/docs/topics/gateway#activity-object-activity-assets */ -export interface DiscordActivityAssets { - /** the id for a large asset of the activity, usually a snowflake */ - large_image?: string; - /** text displayed when hovering over the large image of the activity */ - large_text?: string; - /** the id for a small asset of the activity, usually a snowflake */ - small_image?: string; - /** text displlayed when hovering over the small image of the activity */ - small_text?: string; -} - -/** https://discord.com/developers/docs/topics/gateway#activity-object-activity-secrets */ -export interface DiscordActivitySecrets { - /** the secret for joining a party */ - join?: string; - /** the secret for spectating a game */ - spectate?: string; - /** the secret for a specific instanced match */ - match?: string; -} - -/** https://discord.com/developers/docs/topics/gateway#activity-object-activity-flags */ -export enum DiscordActivityFlags { - INSTANCE = 1 << 0, - JOIN = 1 << 1, - SPECTATE = 1 << 2, - JOIN_REQUEST = 1 << 3, - SYNC = 1 << 4, - PLAY = 1 << 5, -} - -/** https://discord.com/developers/docs/topics/gateway#get-gateway-bot-json-response */ -export interface DiscordGetGatewayBot { - /** the WSS URL that can be used for connecting to the gateway */ - url: string; - /** the recommended number of shards to use when connecting */ - shards: number; - /** information on the current session start limit */ - session_start_limit: DiscordSessionStartLimit; -} - -/** https://discord.com/developers/docs/topics/gateway#session-start-limit-object-session-start-limit-structure */ -export interface DiscordSessionStartLimit { - /** the total number of session starts the current user is allowed */ - total: number; - /** the remaining number of session starts the current user is allowed */ - remaining: number; - /** the number of milliseconds after which the limit resets */ - reset_after: number; - /** the number of identify requests allowed per 5 seconds */ - max_concurrency: number; -} diff --git a/src/types/api/guild.ts b/src/types/api/guild.ts deleted file mode 100644 index 4dcff62bd..000000000 --- a/src/types/api/guild.ts +++ /dev/null @@ -1,465 +0,0 @@ -import { - DiscordChannel, - DiscordChannelTypes, - DiscordEmoji, - DiscordMember, - DiscordOverwrite, - DiscordPresenceUpdateEvent, - DiscordRole, - DiscordUser, - DiscordVoiceStateUpdateEvent, -} from "./mod.ts"; - -/** https://discord.com/developers/docs/resources/guild#guild-object */ -export interface DiscordGuild { - /** guild id */ - id: string; - /** guild name (2-100 characaters, excluding trailing and leading whitespace) */ - name: string; - /** icon hash */ - icon: string | null; - /** icon hash, returned when in the template object */ - icon_hash?: string | null; - /** splash hash */ - splash: string | null; - /** discovery splash hash; only present for guilds with the "DISCOVERABLE" feature */ - discovery_splash: string | null; - /** true if the user is the owner of the guild */ - owner?: boolean; - /** id of the owner */ - owner_id: string; - /** total permissions for the user in the guild (execludes overrides) */ - permissions?: string; - /** voice region id for the guild */ - region: string; - /** id of afk channel */ - afk_channel_id: string | null; - /** afk timeout in seconds */ - afk_timeout: number; - /** true if the server widget is enabled */ - widget_enabled?: boolean; - /** the channel id that the widget will generate an invite to, or null if set to no invite */ - widget_channel_id?: string | null; - /** verification level required for the guild */ - verification_level: DiscordVerificationLevel; - /** default message notifications level */ - default_message_notifications: DiscordDefaultMessageNotificationLevel; - /** explicit content filter level */ - explicit_content_filter: DiscordExplicitContentFilterLevel; - /** roles in the guild */ - roles: DiscordRole[]; - /** custom guild emojis */ - emojis: DiscordEmoji[]; - /** enabled guild features */ - features: DiscordGuildFeatures[]; - /** required MFA level for the guild */ - mfa_level: DiscordMFALevel; - /** application id of the guild creator if it is bot-created */ - application_id: string | null; - /** the id of the channel where guild notices such as welcome messages and boost events are posted */ - system_channel_id: string | null; - /** system channel flags */ - system_channel_flags: DiscordSystemChannelFlags; - /** the id of the channel where community guilds can display rules and/or guidelines */ - rules_channel_id: string | null; - /** when this guild was joined at */ - joined_at?: string; - /** true if this is considered a large guild */ - large?: boolean; - /** true if this guild is unavailable due to an outage */ - unavailable?: boolean; - /** total number of members in this guild */ - member_count?: number; - /** states of members currently in voice channels; lacks the guild_id key */ - voice_states?: Partial[]; - /** users in the guild */ - members?: DiscordMember[]; - /** channels in the guild */ - channels?: DiscordChannel[]; - /** presences of the members in the guild, will only include non-offline members if the size is greater than large threshold */ - presences?: Partial[]; - /** the maximum number of presences for the guild (the default value, currently 25000, is in effect when null is returned) */ - max_presences?: number | null; - /** the maximum number of members for the guild */ - max_members?: number; - /** the vaniy url code for the guild */ - vanity_url_code: string | null; - /** the description for the guild, if the guild is discoverable */ - description: string | null; - /** banner hash */ - banner: string | null; - /** premium tier (Server Boost level) */ - premium_tier: DiscordPremiumTier; - /** the number of boosts this guild currently has */ - premium_subscription_count?: number; - /** the preferred locale of a Community guild; used in server discovery and notices from Discord; defaults to "en-US" */ - preferred_locale: string; - /** the id of the channel where admins and moderators of Community guilds receive notices from Discord */ - public_updates_channel_id: string | null; - /** the maximum amount of users in a video channel */ - max_video_channel_users?: number; - /** approximate number of members in this guild, returned from the GET /guilds/ endpoint when with_counts is true */ - approximate_member_count?: number; - /** approximate number of non-offline members in this guild, returned from the GET /guilds/ endpoint when with_counts is true */ - approximate_presence_count?: number; -} - -/** https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level */ -export enum DiscordDefaultMessageNotificationLevel { - ALL_MESSAGES, - ONLY_MENTIONS, -} - -/** https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level */ -export enum DiscordExplicitContentFilterLevel { - DISABLED, - MEMBERS_WITHOUT_ROLES, - ALL_MEMBERS, -} - -/** https://discord.com/developers/docs/resources/guild#guild-object-mfa-level */ -export enum DiscordMFALevel { - NONE, - ELEVATED, -} - -/** https://discord.com/developers/docs/resources/guild#guild-object-verification-level */ -export enum DiscordVerificationLevel { - NONE, - LOW, - MEDIUM, - HIGH, - VERY_HIGH, -} - -/** https://discord.com/developers/docs/resources/guild#guild-object-premium-tier */ -export enum DiscordPremiumTier { - NONE, - TIER_1, - TIER_2, - TIER_3, -} - -/** https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags */ -export enum DiscordSystemChannelFlags { - SUPPRESS_JOIN_NOTIFICATIONS = 1 << 0, - SUPPRESS_PREMIUM_SUBSCRIPTIONS = 1 << 1, -} - -/** https://discord.com/developers/docs/resources/guild#guild-object-guild-features */ -export enum DiscordGuildFeatures { - INVITE_SPLASH, - VIP_REGIONS, - VANITY_URL, - VERIFIED, - PARTNERED, - COMMUNITY, - COMMERCE, - NEWS, - DISCOVERABLE, - FEATURABLE, - ANIMATED_ICON, - BANNER, - WELCOME_SCREEN_ENABLED, - MEMBER_VERIFICATION_GATE_ENABLED, - PREVIEW_ENABLED, -} - -/** https://discord.com/developers/docs/resources/guild#unavailable-guild-object */ -export type DiscordUnavailableGuild = Pick; - -/** https://discord.com/developers/docs/resources/guild#guild-preview-object */ -export interface DiscordGuildPreview { - /** guild id */ - id: string; - /** guild name (2-100 characters) */ - name: string; - /** icon hash */ - icon: string | null; - /** splash hash */ - splash: string | null; - /** discovery splash hash */ - discovery_splash: string | null; - /** custom guild emojis */ - emojis: DiscordEmoji[]; - /** enabled guild features */ - features: DiscordGuildFeatures[]; - /** approximate number of members in this guild */ - approximate_member_count: number; - /** approximate number of online members in this guild */ - approximate_presence_count: number; - /** the description for the guild */ - description: string | null; -} - -/** https://discord.com/developers/docs/resources/guild#guild-widget-object-guild-widget-structure */ -export interface DiscordGuildWidget { - /** whether the widget is enabled */ - enabled: boolean; - /** the widget channel id */ - channel_id: string | null; -} - -/** https://discord.com/developers/docs/resources/guild#ban-object */ -export interface DiscordBan { - /** the reason for the ban */ - reason: string | null; - /** the banned user */ - user: DiscordUser; -} - -export interface DiscordMembershipScreening { - /** when the fields were last updated */ - version: string; - /** the steps in the screening form */ - form_fields: DiscordMembershipScreeningField[]; - /** the server description shown in the screening form */ - description: string | null; -} - -export interface DiscordMembershipScreeningField { - /** the type of field (currently "TERMS" is the only type) */ - field_type: DiscordMembershipScreeningFieldTypes; - /** the title of the field */ - label: string; - /** the list of rules */ - values?: string[]; - /** whether the user has to fill out this field */ - required: boolean; -} - -export enum DiscordMembershipScreeningFieldTypes { - /** Server Rules */ - TERMS = "TERMS", -} - -/** https://discord.com/developers/docs/resources/guild#create-guild */ -export interface DiscordCreateGuildParams { - /** name of the guild (2-100 characters) */ - name: string; - /** voice region id */ - region?: string; - /** base64 128x128 image for the guild icon */ - icon?: string; - /** verification level */ - verification_level?: DiscordVerificationLevel; - /** default message notification level */ - default_message_notifications?: DiscordDefaultMessageNotificationLevel; - /** explicit content filter level */ - explicit_content_filter?: DiscordExplicitContentFilterLevel; - /** new guild roles (first role is the everyone role) */ - roles?: DiscordRole[]; - /** new guild's channels */ - channels?: Partial[]; - /** id for afk channel */ - afk_channel_id?: string; - /** afk timeout in seconds */ - afk_timeout?: number; - /** the id of the channel where guild notices such as welcome messages and boost events are posted */ - system_channel_id?: string; -} - -/** https://discord.com/developers/docs/resources/guild#get-guild */ -export interface DiscordGetGuildParams { - /** when true, will return approximate member and presence counts for the guild */ - with_counts?: boolean; -} - -/** https://discord.com/developers/docs/resources/guild#modify-guild */ -export interface DiscordModifyGuildParams { - /** guild name */ - name?: string; - /** guild voice region id */ - region?: string | null; - /** verification level */ - verification_level?: DiscordVerificationLevel | null; - /** default message notification filter level */ - default_message_notifications?: DiscordDefaultMessageNotificationLevel | null; - /** explicit content filter level */ - explicit_content_filter?: DiscordExplicitContentFilterLevel | null; - /** id for afk channel */ - afk_channel_id?: string | null; - /** afk timeout in seconds */ - afk_timeout?: number; - /** base64 1024x1024 png/jpeg/gif image for the guild icon (can be animated gif when the server has ANIMATED_ICON feature) */ - icon?: string | null; - /** user id to transfer guild ownershop to (must be owner) */ - owner_id?: string; - /** base64 16:9 png/jpeg image for the guild splash (when the server has INVITE_SPLASH feature) */ - splash?: string | null; - /** base64 16:9 png/jpeg image for the guild banner (when the server has BANNER feature) */ - banner?: string | null; - /** the id of the channel where guild notices such as welcome messages and boost events are posted */ - system_channel_id?: string | null; - /** the id of the channel where Community guilds display rules and/or guidelines */ - rules_channel_id?: string | null; - /** the id of the channel where admins and moderators of Community guilds receive notices from Discord */ - public_updates_channel_id?: string | null; - /** the preferred locale of a Community guild used in server discovery and notices from Discord; defaults to "en-US" */ - preferred_locale?: string | null; -} - -/** https://discord.com/developers/docs/resources/guild#create-guild-channel */ -export interface DiscordCreateGuildChannelParams { - /** channel name (2-100 characters) */ - name: string; - /** the type of channel */ - type?: DiscordChannelTypes; - /** channel topic (0-1024 characters) */ - topic?: string; - /** the bitrate (in bits) of the voice channel (voice only) */ - bitrate?: number; - /** the user limit of the voice channel (voice only) */ - user_limit?: number; - /** amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffected */ - rate_limit_per_user?: number; - /** sorting position of the channel */ - position?: number; - /** the channel's permission overwrites */ - permission_overwrites?: DiscordOverwrite[]; - /** id of the parent category for a channel */ - parent_id?: string; - /** whether the channel is nsfw */ - nsfw?: boolean; -} - -/** https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions */ -export interface DiscordModifyGuildChannelPositionsParam { - /** channel id */ - id: string; - /** sorting position of the channel */ - position: number | null; -} - -/** https://discord.com/developers/docs/resources/guild#list-guild-members */ -export interface DiscordListGuildMembersParams { - /** max number of members to return (1-1000), default 1 */ - limit: number; - /** the highest user id in the previous page, default 0 */ - after: string; -} - -/** https://discord.com/developers/docs/resources/guild#add-guild-member */ -export interface DiscordAddGuildMemberParams { - /** an oauth2 access token granted with the guilds.join to the bot's application for the user you want to add to the guild */ - access_token: string; - /** value to set users nickname to. Requires the MANAGE_NICKNAMES permission */ - nick?: string; - /** array of role ids the member is assigned. Requires the MANAGE_ROLES permission */ - roles?: string[]; - /** whether the user is muted in voice channels. Requires the MUTE_MEMBERS permission */ - mute?: boolean; - /** whether the user is deafened in voice channels. Requires the DEAFEN_MEMBERS permission */ - deaf?: boolean; -} - -/** https://discord.com/developers/docs/resources/guild#modify-guild-member */ -export interface DiscordModifyGuildMemberParams { - /** value to set users nickname to. Requires the MANAGE_NICKNAMES permission */ - nick?: string | null; - /** array of role ids the member is assigned. Requires the MANAGE_ROLES permission */ - roles?: string[] | null; - /** whether the user is muted in voice channels. Will throw a 400 if the user is not in a voice channel. Requires the MUTE_MEMBERS permission */ - mute?: boolean | null; - /** whether the user is deafened in voice channels. Will throw a 400 if the user is not in a voice channel. Requires the MOVE_MEMBERS permission */ - deaf?: boolean | null; - /** id of channel to move user to (if they are connected to voice). Requires the MOVE_MEMBERS permission */ - channel_id: string | null; -} - -/** https://discord.com/developers/docs/resources/guild#modify-current-user-nick */ -export interface DiscordModifyCurrentUserNickParams { - /** value to set users nickname to. Requires the CHANGE_NICKNAME permission */ - nick?: string | null; -} - -/** https://discord.com/developers/docs/resources/guild#create-guild-ban */ -export interface DiscordCreateGuildBan { - /** number of days to delete messages for (0-7) */ - delete_message_days?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7; - /** reason for the ban */ - reason?: string; -} - -/** https://discord.com/developers/docs/resources/guild#create-guild-role */ -export interface DiscordCreateGuildRoleParams { - /** name of the role, default: "new role" */ - name?: string; - /** bitwise value of the enabled/disabled permissions, default: everyone permissions in guild */ - permissions?: string; - /** RGB color value, default: 0 */ - color?: number; - /** whether the role should be displayed separately in the sidebar, default: false */ - hoist?: boolean; - /** whether the role should be mentionable, default: false */ - mentionable?: boolean; -} - -/** https://discord.com/developers/docs/resources/guild#modify-guild-role-positions */ -export interface DiscordModifyGuildRolePositionsParams { - /** role id */ - id: string; - /** sorting position of the role */ - position?: number | null; -} - -/** https://discord.com/developers/docs/resources/guild#modify-guild-role */ -export interface DiscordModifyGuildRoleParams { - /** name of the role */ - name?: string | null; - /** bitwise value of the enabled/disabled permissions */ - permissions?: string | null; - /** RGB color value */ - color?: number | null; - /** whether the role should be displayed seperately in the sidebar */ - hoist?: boolean | null; - /** whether the role should be mentionable */ - mentionable?: boolean | null; -} - -/** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */ -export interface DiscordGetGuildPruneCountParams { - /** number of days to count prune for (1 or more), default: 7 */ - days?: number; - /** role(s) to include, default: none */ - include_roles: string | string[]; -} - -/** https://discord.com/developers/docs/resources/guild#begin-guild-prune */ -export interface DiscordBeginGuildPruneParams { - /** number of days to prune (1 or more), default: 7 */ - days?: number; - /** whether 'pruned' is returned, discouraged for large guilds, default: true */ - compute_prune_count?: boolean; - /** role(s) ro include, default: none */ - include_roles?: string[]; -} - -/** https://discord.com/developers/docs/resources/guild#modify-guild-integration */ -export interface DiscordGetGuildWidgetImageParams { - /** style of the widget returned, default: shield */ - style?: DiscordGetGuildWidgetImageStyleOptions; -} - -/** https://discord.com/developers/docs/resources/guild#modify-guild-integration */ -export enum DiscordGetGuildWidgetImageStyleOptions { - /** shield style widget with Discord icon and guild members online count */ - SHIELD = "shield", - /** large image with guild icon, name and online count. "POWERED BY DISCORD" as the footer of the widget */ - BANNER_1 = "banner1", - /** smaller widget style with guild icon, name and online count. Split on the right with Discord logo */ - BANNER_2 = "banner2", - /** large image with guild icon, name and online count. In the footer, Discord logo on the left and "Chat Now" on the right */ - BANNER_3 = "banner3", - /** large Discord logo at the top of the widget. Guild icon, name and online count in the middle portion of the widget and a "JOIN MY SERVER" button at the bottom */ - BANNER_4 = "banner4", -} - -export interface DiscordModifyGuildMembershipScreeningFormParams { - /** whether Membership Screening is enabled */ - enabled: boolean; - /** arrray of field objects serialized in a string */ - form_fields: string; - /** the server description to show in the screening form */ - description: string; -} diff --git a/src/types/api/image.ts b/src/types/api/image.ts deleted file mode 100644 index 68d266f23..000000000 --- a/src/types/api/image.ts +++ /dev/null @@ -1,3 +0,0 @@ -/** https://discord.com/developers/docs/reference#image-formatting */ -export type DiscordImageSize = 16 | 32 | 64 | 128 | 256 | 512 | 1024 | 2048; -export type DiscordImageFormat = "jpg" | "jpeg" | "png" | "webp" | "gif"; diff --git a/src/types/api/integration.ts b/src/types/api/integration.ts deleted file mode 100644 index e7b056d3e..000000000 --- a/src/types/api/integration.ts +++ /dev/null @@ -1,145 +0,0 @@ -import { DiscordUser } from "./mod.ts"; - -/** https://discord.com/developers/docs/resources/guild#integration-object-integration-structure */ -export interface DiscordIntegration { - /** integration id */ - id: string; - /** integration name */ - name: string; - /** integration type (twitch, youtube, or discord) */ - type: string; - /** is this integration enabled */ - enabled: boolean; - /** is this integration syncing */ - syncing?: boolean; - /** id that this integration uses for "subscribers" */ - role_id?: string; - /** whether emoticons should be synced for this integration (twitch only currently) */ - enable_emoticons?: boolean; - /** the behavior of expiring subscribers */ - expire_behavior?: DiscordIntegrationExpireBehavior; - /** the grace period (in days) before expiring subscribers */ - expire_grace_period?: number; - /** user for this integration */ - user?: DiscordUser; - /** integration account information */ - account: DiscordIntegrationAccount; - /** when this integration was last synced */ - synced_at?: string; - /** how many subscribers this integration has */ - subscriber_count: number; - /** has this integration been revoked */ - revoked?: boolean; - /** the bot/OAuth2 application for discord integrations */ - application?: DiscordIntegrationApplication; -} - -/** https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors */ -export enum DiscordIntegrationExpireBehavior { - REMOVE_ROLE, - KICK, -} - -/** https://discord.com/developers/docs/resources/guild#integration-account-object */ -export interface DiscordIntegrationAccount { - /** id of the account */ - id: string; - /** name of the account */ - name: string; -} - -/** https://discord.com/developers/docs/resources/guild#integration-application-object */ -export interface DiscordIntegrationApplication { - /** the id of the app */ - id: string; - /** the name of the app */ - name: string; - /** the icon hash of the app */ - icon: string | null; - /** the description of the app */ - description: string; - /** the summary of the app */ - summary: string; - /** If this application is a game sold on Discord, this field will be the hash of the image on store embeds */ - cover_image?: string; - /** the bot associated with this application */ - bot?: DiscordUser; -} - -/** https://discord.com/developers/docs/resources/guild#integration-object-integration-structure */ -export interface DiscordIntegration { - /** integration id */ - id: string; - /** integration name */ - name: string; - /** integration type (twitch, youtube, or discord) */ - type: string; - /** is this integration enabled */ - enabled: boolean; - /** is this integration syncing */ - syncing?: boolean; - /** id that this integration uses for "subscribers" */ - role_id?: string; - /** whether emoticons should be synced for this integration (twitch only currently) */ - enable_emoticons?: boolean; - /** the behavior of expiring subscribers */ - expire_behavior?: DiscordIntegrationExpireBehavior; - /** the grace period (in days) before expiring subscribers */ - expire_grace_period?: number; - /** user for this integration */ - user?: DiscordUser; - /** integration account information */ - account: DiscordIntegrationAccount; - /** when this integration was last synced */ - synced_at?: string; - /** how many subscribers this integration has */ - subscriber_count: number; - /** has this integration been revoked */ - revoked?: boolean; - /** the bot/OAuth2 application for discord integrations */ - application?: DiscordIntegrationApplication; -} - -/** https://discord.com/developers/docs/resources/guild#integration-account-object */ -export interface DiscordIntegrationAccount { - /** id of the account */ - id: string; - /** name of the account */ - name: string; -} - -/** https://discord.com/developers/docs/resources/guild#integration-application-object */ -export interface DiscordIntegrationApplication { - /** the id of the app */ - id: string; - /** the name of the app */ - name: string; - /** the icon hash of the app */ - icon: string | null; - /** the description of the app */ - description: string; - /** the summary of the app */ - summary: string; - /** If this application is a game sold on Discord, this field will be the hash of the image on store embeds */ - cover_image?: string; - /** the bot associated with this application */ - bot?: DiscordUser; -} - -/** https://discord.com/developers/docs/resources/guild#create-guild-integration */ -export interface DiscordCreateGuildIntegrationParams { - /** the integration type */ - type: string; - /** the integration id */ - id: string; -} - -/** https://discord.com/developers/docs/resources/guild#modify-guild-integration */ -export interface DiscordModifyGuildIntegration { - /** the behavior when an integration subscription lapses (see the integration expire behaviors documentation) */ - expire_behavior?: number | null; - /** perios (in days) where the integration will ignore lapsed subscriptions */ - expire_grace_period?: number | null; - /** whether emoticons should be synced for this integration (twitch only currently) */ - enable_emoticons?: boolean | null; -} diff --git a/src/types/api/interaction.ts b/src/types/api/interaction.ts deleted file mode 100644 index 177c26802..000000000 --- a/src/types/api/interaction.ts +++ /dev/null @@ -1,125 +0,0 @@ -import { - DiscordChannel, - DiscordMember, - DiscordRole, - DiscordUser, -} from "./mod.ts"; - -export interface DiscordInteractionCommand { - /** id of the interaction */ - id: string; - /** the type of interaction */ - type: DiscordInteractionType; - /** the command data payload */ - data?: DiscordInteractionData; - /** the guild it was sent from */ - guild_id: string; - /** the channel it was sent from */ - channel_id: string; - /** guild member data for the invoking user */ - member: DiscordMember; - /** a continuation token for responding to the interaction */ - token: string; - /** read-only property, always 1 */ - version: number; -} - -export enum DiscordInteractionType { - /** This type is for ACK on webhook only setup. Discord may send these which require. In a sense its a heartbeat. */ - PING = 1, - /** Slash commands */ - APPLICATION_COMMAND, -} - -export interface DiscordInteractionData { - /** the ID of the invoked command */ - id: string; - /** the name of the invoked command */ - name: string; - /** converted users + roles + channels */ - resolved?: DiscordApplicationCommandInteractionDataResolved; - /** the params + values from the user */ - options?: DiscordInteractionDataOption[]; -} - -export interface DiscordApplicationCommandInteractionDataResolved { - /** the IDs and User objects */ - users?: Record; - /** the IDs and partial Member objects */ - members?: Record>; - /** the IDs and Role objects */ - roles?: Record; - /** the IDs and partial Channel objects */ - channels?: Record< - string, - Pick - >; -} - -export interface DiscordInteractionDataOption { - /** the name of the parameter */ - name: string; - /** value of ApplicationCommandOptionType */ - type: DiscordApplicationCommandOptionType; - /** the value of the pair. present if there was no more options */ - value?: string | number; - /** present if this option is a group or subcommand */ - options?: DiscordInteractionDataOption[]; -} - -/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommand */ -export interface DiscordApplicationCommand { - /** unique id of the command */ - id: string; - /** unique id of the parent application */ - application_id: string; - /** 3-32 character name matching `^[\w-]{3,32}$` */ - name: string; - /** 1-100 character description */ - description: string; - /** the parameters for the command */ - options?: DiscordApplicationCommandOption[]; -} - -/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoption */ -export interface DiscordApplicationCommandOption { - /** the type of the option */ - type: DiscordApplicationCommandOptionType; - /** 1-32 character name matching `^[\w-]{1,32}$` */ - name: string; - /** 1-100 character description */ - description: string; - /** the first `required` option for the user to complete--only one option can be `default` */ - default?: boolean; - /** if the parameter is required or optional--default `false` */ - required?: boolean; - /** choices for `string` and `int` types for the user to pick from */ - choices?: DiscordApplicationCommandOptionChoice[]; - /** if the option is a subcommand or subcommand group type, this nested options will be the parameters */ - options?: DiscordApplicationCommandOption[]; -} - -/** https://discord.com/developers/docs/interactions/slash-commands#Discordapplicationcommandoptiontype */ -export enum DiscordApplicationCommandOptionType { - SUB_COMMAND = 1, - SUB_COMMAND_GROUP, - STRING, - INTEGER, - BOOLEAN, - USER, - CHANNEL, - ROLE, -} - -/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoptionchoice */ -export interface DiscordApplicationCommandOptionChoice { - /** 1-100 character choice name */ - name: string; - /** value of the choice */ - value: string | number; -} - -export type DiscordApplicationCommandEvent = DiscordApplicationCommand & { - /** id of the guild the command is in */ - guild_id?: string; -}; diff --git a/src/types/api/invite.ts b/src/types/api/invite.ts deleted file mode 100644 index f45613a9d..000000000 --- a/src/types/api/invite.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { DiscordChannel, DiscordGuild, DiscordUser } from "./mod.ts"; - -/** https://discord.com/developers/docs/resources/invite#invite-object */ -export interface DiscordInvite { - /** the invite code (unique ID) */ - code: string; - /** the guild this invite is for */ - guild?: Partial; - /** the channel this invite is for */ - channel: Partial; - /** the user who created the invite */ - inviter?: DiscordUser; - /** the target user for this invite */ - target_user?: Partial; - /** the type of user target for this invite */ - target_user_type?: DiscordInviteTargetUserTypes; - /** approximate count of online members (only present when target_user is set) */ - approximate_presence_count?: number; - /** approximate count of total members */ - approximate_member_count: number; -} - -/** https://discord.com/developers/docs/resources/invite#invite-resource */ -export enum DiscordInviteTargetUserTypes { - STREAM = 1, -} - -/** https://discord.com/developers/docs/resources/invite#invite-resource */ -export interface DiscordInviteMetadata extends DiscordInvite { - /** number of times this invite has been used */ - uses: number; - /** max number of times this invite can be used */ - max_uses: number; - /** duration (in seconds) after which the invite expires */ - max_age: number; - /** whether this invite only grants temporary membership */ - temporary: boolean; - /** when this invite was created */ - created_at: string; -} - -/** https://discord.com/developers/docs/resources/invite#get-invite */ -export interface DiscordGetInviteURLParams { - /** whether the invite should contain approximate member counts */ - with_counts?: boolean; -} diff --git a/src/types/api/member.ts b/src/types/api/member.ts deleted file mode 100644 index 3eaf32740..000000000 --- a/src/types/api/member.ts +++ /dev/null @@ -1,89 +0,0 @@ -export interface DiscordBaseUser { - /** the user's id */ - id: string; - /** the user's username, not unique across the platform */ - username: string; - /** the user's 4-digit discord-tag */ - discriminator: string; - /** the user's avatar hash */ - avatar: string | null; -} - -/** https://discord.com/developers/docs/resources/user#users-resource */ -export interface DiscordUser extends DiscordBaseUser { - /** the user's id */ - id: string; - /** the user's username, not unique across the platform */ - username: string; - /** the user's 4-digit discord-tag */ - discriminator: string; - /** the user's avatar hash */ - avatar: string | null; - /** whether the user belongs to an OAuth2 application */ - bot?: boolean; - /** whether the user is an Official Discord System user (part of the urgent message system) */ - system?: boolean; - /** whether the user has two factor enabled on their account */ - mfa_enabled?: boolean; - /** the user's chosen language option */ - locale?: string; - /** whether the email on this account has been verified */ - verified?: boolean; - /** the user's email */ - email?: string | null; - /** the flags on a user's account */ - flags?: DiscordUserFlags; - /** the type of Nitro subscription on a user's account */ - premium_type?: DiscordPremiumTypes; - /** the public flags on a user's account */ - public_flags?: DiscordUserFlags; -} - -/** https://discord.com/developers/docs/resources/user#users-resource */ -export enum DiscordUserFlags { - NONE = 0, - DISCORD_EMPLOYEE = 1 << 0, - PARTNERED_SERVER_OWNER = 1 << 1, - HYPE_SQUAD_EVENTS = 1 << 2, - BUG_HUNTER_LEVEL_1 = 1 << 3, - HOUSE_BRAVERY = 1 << 6, - HOUSE_BRILLIANCE = 1 << 7, - HOUSE_BALANCE = 1 << 8, - EARLY_SUPPORTER = 1 << 9, - TEAM_USER = 1 << 10, - SYSTEM = 1 << 12, - BUG_HUNTER_LEVEL_2 = 1 << 14, - VERIFIED_BOT = 1 << 16, - EARLY_VERIFIED_BOT_DEVELOPER = 1 << 17, -} - -/** https://discord.com/developers/docs/resources/user#users-resource */ -export enum DiscordPremiumTypes { - NONE = 0, - NITRO_CLASSIC = 1, - NITRO = 2, -} - -/** https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-structure */ -export interface DiscordBaseMember { - /** this users guild nickname */ - nick: string | null; - /** array of role payload ids */ - roles: string[]; - /** when the user joined the guild */ - joined_at: string; - /** when the user started boosting the guild */ - premium_since?: string | null; - /** whether the user is deafened in voice channels */ - deaf: boolean; - /** whether the user is muted in voice channels */ - mute: boolean; - /** whether the user has not yet passed the guild's Membership Screening requirements */ - pending?: boolean; -} - -/** https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-structure */ -export interface DiscordMember extends DiscordBaseMember { - /** the user this guild member represents */ - user?: DiscordUser; -} diff --git a/src/types/api/message.ts b/src/types/api/message.ts deleted file mode 100644 index a85eaec80..000000000 --- a/src/types/api/message.ts +++ /dev/null @@ -1,290 +0,0 @@ -import { DiscordMember } from "./member.ts"; -import { - DiscordBaseMember, - DiscordChannelTypes, - DiscordEmbed, - DiscordEmoji, - DiscordUser, -} from "./mod.ts"; - -/** https://discord.com/developers/docs/resources/channel#message-object-message-structure */ -export interface DiscordMessage { - /** id of the message */ - id: string; - /** id of the channel the message was sent in */ - channel_id: string; - /** id of the guild the message was sent in */ - guild_id?: string; - /** the author of this message (not guaranteed to be a valid user) */ - author: DiscordUser; - /** member properties for this message's author */ - member?: DiscordBaseMember; - /** contents of the message */ - content: string; - /** when this message was sent */ - timestamp: string; - /** when this message was edited (or null if never) */ - edited_timestamp: string | null; - /** whether this was a TTS message */ - tts: boolean; - /** whether this message mentions everyone */ - mention_everyone: boolean; - /** users specifically mentioned in the message */ - mentions: (DiscordUser & Partial)[]; - /** roles specifically mentioned in this message */ - mention_roles: string[]; - /** channels specifically mentioned in this message */ - mention_channels?: DiscordChannelMention[]; - /** any attached files */ - attachments: DiscordAttachment[]; - /** any embedded content */ - embeds: DiscordEmbed[]; - /** reactions to the message */ - reactions?: DiscordReaction[]; - /** used for validating a message was sent */ - nonce?: number | string; - /** whether this message is pinned */ - pinned: boolean; - /** if the message is generated by a webhook, this is the webhook's id */ - webhook_id?: string; - /** type of message */ - type: DiscordMessageTypes; - /** sent with Rich Presence-related chat embeds */ - activity?: DiscordMessageActivity; - /** sent with Rich Presence-related chat embeds */ - application?: DiscordMessageApplication; - /** reference data sent with crossposted messages and replies */ - message_reference?: DiscordMessageReference; - /** message flags combined as a bitfield */ - flags?: DiscordMessageFlags; - /** the stickers sent with the message (bots currently can only receive messages with stickers, not send) */ - stickers?: DiscordMessageSticker[]; - /** the message associated with the `message_reference` */ - referenced_message?: DiscordMessage | null; -} - -/** https://discord.com/developers/docs/resources/channel#message-object-message-types */ -export enum DiscordMessageTypes { - DEFAULT, - RECIPIENT_ADD, - RECIPIENT_REMOVE, - CALL, - CHANNEL_NAME_CHANGE, - CHANNEL_ICON_CHANGE, - CHANNEL_PINNED_MESSAGE, - GUILD_MEMBER_JOIN, - USER_PREMIUM_GUILD_SUBSCRIPTION, - USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1, - USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2, - USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3, - CHANNEL_FOLLOW_ADD, - GUILD_DISCOVERY_DISQUALIFIED = 14, - GUILD_DISCOVERY_REQUALIFIED, - GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING, - GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING, - REPLY = 19, - APPLICATION_COMMAND, -} - -/** https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure */ -export interface DiscordMessageActivity { - /** type of message activity */ - type: DiscordMessageActivityTypes; - /** party_id from a Rich Presence event */ - party_id?: string; -} - -/** https://discord.com/developers/docs/resources/channel#message-object-message-application-structure */ -export interface DiscordMessageApplication { - /** id of the application */ - id: string; - /** id of the embed's image asset */ - cover_image?: string; - /** application's description */ - description: string; - /** id of the application's icon */ - icon: string | null; - /** name of the application */ - name: string; -} - -/** https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure */ -export interface DiscordMessageReference { - /** id of the originating message */ - message_id?: string; - /** id of the originating message's channel */ - channel_id?: string; - /** id of the originating message's guild */ - guild_id?: string; -} - -/** https://discord.com/developers/docs/resources/channel#message-object-message-activity-types */ -export enum DiscordMessageActivityTypes { - JOIN = 1, - SPECTATE, - LISTEN, - JOIN_REQUEST = 5, -} - -/** https://discord.com/developers/docs/resources/channel#message-object-message-flags */ -export enum DiscordMessageFlags { - /** this message has been published to subscribed channels (via Channel Following) */ - CROSSPOSTED = 1 << 0, - /** this message originated from a message in another channel (via Channel Following) */ - IS_CROSSPOST = 1 << 1, - /** do not include any embeds when serializing this message */ - SUPPRESS_EMBEDS = 1 << 2, - /** the source message for this crosspost has been deleted (via Channel Following) */ - SOURCE_MESSAGE_DELETED = 1 << 3, - /** this message came from the urgent message system */ - URGENT = 1 << 4, -} - -/** https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure */ -export interface DiscordMessageSticker { - /** id of the sticker */ - id: string; - /** id of the pack the sticker is from */ - pack_id: string; - /** name of the sticker */ - name: string; - /** description of the sticker */ - description: string; - /** a comma-separated list of tags for the sticker */ - tags?: string; - /** sticker asset hash */ - asset: string; - /** sticker preview asset hash */ - preview_asset: string | null; - /** type of sticker format */ - format_type: DiscordMessageStickerFormatTypes; -} - -/** https://discord.com/developers/docs/resources/channel#message-object-message-sticker-format-types */ -export enum DiscordMessageStickerFormatTypes { - PNG = 1, - APNG, - LOTTIE, -} - -/** https://discord.com/developers/docs/resources/channel#reaction-object-reaction-structure */ -export interface DiscordReaction { - /** times this emoji has been used to react */ - count: number; - /** whether the current user reacted using this emoji */ - me: boolean; - /** emoji information */ - emoji: Partial; -} - -/** https://discord.com/developers/docs/resources/channel#attachment-object-attachment-structure */ -export interface DiscordAttachment { - /** attachment id */ - id: string; - /** name of file attached */ - filename: string; - /** size of file in bytes */ - size: number; - /** source url of file */ - url: string; - /** a proxied url of file */ - proxy_url: string; - /** height of file (if image) */ - height?: number | null; - /** width of file (if image) */ - width?: number | null; -} - -/** https://discord.com/developers/docs/resources/channel#channel-mention-object-channel-mention-structure */ -export interface DiscordChannelMention { - /** id of the channel */ - id: string; - /** id of the guild containing the channel */ - guild_id: string; - /** the type of channel */ - type: DiscordChannelTypes; - /** the name of the channel */ - name: string; -} - -/** https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mention-types */ -export enum AllowedMentionTypes { - /** Controls role mentions */ - ROLES = "roles", - /** Controls user mentions */ - USERS = "users", - /** Controls `@everyone` and `@here` mentions */ - EVERYONE = "everyone", -} - -/** https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mentions-structure */ -export interface DiscordAllowedMentions { - /** An array of allowed mention types to parse from the content. */ - parse: AllowedMentionTypes[]; - /** Array of role_ids to mention (Max size of 100) */ - roles: string[]; - /** Array of user_ids to mention (Max size of 100) */ - users: string[]; - /** For replies, whether to mention the author of the message being replied to (default false) */ - replied_user: boolean; -} - -/** https://discord.com/developers/docs/resources/channel#get-channel-messages-query-string-params */ -export interface DiscordGetChannelMessagesParams { - /** get messages around this message ID */ - around?: string; - /** get messages before this message ID */ - before?: string; - /** get messages after this message ID */ - after?: string; - /** max number of messages to return (1-100) */ - limit?: number; -} - -/** https://discord.com/developers/docs/resources/channel#create-message-params */ -export interface DiscordCreateMessageParams { - /** the message contents (up to 2000 characters) */ - content?: string; - /** a nonce that can be used for optimistic message sending */ - nonce?: number | string; - /** `true` if this is a TTS message */ - tts: boolean; - /** the contents of the file being sent */ - file?: { blob: Blob; name: string }; - /** embedded rich content */ - embed?: DiscordEmbed; - /** JSON encoded body of any additional request fields. */ - payload_json?: string; - /** allowed mentions for a message */ - allowed_mentions?: DiscordAllowedMentions; - /** include to make your message a reply */ - message_reference?: DiscordMessageReference; -} - -/** https://discord.com/developers/docs/resources/channel#get-reactions-query-string-params */ -export interface DiscordGetReactionsParams { - /** get users before this user ID */ - before?: string; - /** get users after this user ID */ - after?: string; - /** max number of users to return (1-100) */ - limit?: number; -} - -/** https://discord.com/developers/docs/resources/channel#edit-message-json-params */ -export interface DiscordEditMessageParams { - /** the new message contents (up to 2000 characters) */ - content?: string | null; - /** embedded rich content */ - embed?: DiscordEmbed | null; - /** edit the flags of a message (only SUPPRESS_EMBEDS can currently be set/unset) */ - flags?: DiscordMessageFlags | null; - /** allowed mentions for the message */ - allowed_mentions?: DiscordAllowedMentions | null; -} - -/** https://discord.com/developers/docs/resources/channel#bulk-delete-messages-json-params */ -export interface DiscordBulkDeleteMessagesParams { - /** an array of message ids to delete (2-100) */ - messages: string[]; -} diff --git a/src/types/api/mod.ts b/src/types/api/mod.ts deleted file mode 100644 index 205d6ab70..000000000 --- a/src/types/api/mod.ts +++ /dev/null @@ -1,22 +0,0 @@ -export * from "./auditlog.ts"; -export * from "./channel.ts"; -export * from "./code.ts"; -export * from "./embed.ts"; -export * from "./emoji.ts"; -export * from "./event.ts"; -export * from "./gateway.ts"; -export * from "./guild.ts"; -export * from "./image.ts"; -export * from "./integration.ts"; -export * from "./interaction.ts"; -export * from "./invite.ts"; -export * from "./member.ts"; -export * from "./message.ts"; -export * from "./oauth2.ts"; -export * from "./permission.ts"; -export * from "./ratelimits.ts"; -export * from "./role.ts"; -export * from "./teams.ts"; -export * from "./template.ts"; -export * from "./voice.ts"; -export * from "./webhook.ts"; diff --git a/src/types/api/oauth2.ts b/src/types/api/oauth2.ts deleted file mode 100644 index b60302fe9..000000000 --- a/src/types/api/oauth2.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { DiscordTeam, DiscordUser } from "./mod.ts"; - -/** https://discord.com/developers/docs/topics/oauth2#get-current-application-information */ -export interface DiscordApplication { - /** id of the app */ - id: string; - /** the name of the app */ - name: string; - /** the icon hash of the app */ - icon: string | null; - /** the description of the app */ - description: string; - /** an array of rpc origin urls, if rpx is enabled */ - rpc_origins?: string[]; - /** when false only app owner can join the app's bot to guilds */ - bot_public: boolean; - /** when true the app's bot will only join upon completion of the full oauth2 code grant flow */ - bot_require_code_grand: boolean; - /** partial user object containing info on the owner of the application */ - owner: Partial; - /** if this application is a game sold on Disccord, this field will be the summary field for the store page of its primary sku */ - summary: string; - /** the base64 enccoded key for the GameSDK'S GetTicket */ - verify_key: string; - /** if the application belongs to a team, this will be a list of the members of that team */ - team: DiscordTeam | null; - /** if this application is a game sold on Discord, this field will be the guild to which it has been linked */ - guild_id?: string; - /** if this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists */ - primary_sku_id?: string; - /** if this application is a game sold on Discord, this field will be the URL slug that links to the store page */ - slug?: string; - /** if this application is a game sold on Discord, this field wil be the hash of the image on store embeds */ - cover_image?: string; - /** the application's public flags */ - flags: number; -} diff --git a/src/types/api/permission.ts b/src/types/api/permission.ts deleted file mode 100644 index fa6708c4e..000000000 --- a/src/types/api/permission.ts +++ /dev/null @@ -1,10 +0,0 @@ -export interface DiscordOverwrite { - /** role or user id */ - id: string; - /** either 0 (role) or 1 (member) */ - type: number; - /** permission bit set */ - allow: string; - /** permission bit set */ - deny: string; -} diff --git a/src/types/api/ratelimits.ts b/src/types/api/ratelimits.ts deleted file mode 100644 index b7fa5725d..000000000 --- a/src/types/api/ratelimits.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** https://discord.com/developers/docs/topics/rate-limits#exceeding-a-rate-limit */ -export interface DiscordRateLimitResponse { - /** a message saying you are being rate limited */ - message: string; - /** the number of seconds to wait before submitting another request. */ - retry_after: number; - /** a value indicating if you are being globally limited or not */ - global: boolean; -} diff --git a/src/types/api/role.ts b/src/types/api/role.ts deleted file mode 100644 index 02f70a0ad..000000000 --- a/src/types/api/role.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** https://discord.com/developers/docs/topics/permissions#role-object-role-structure */ -export interface DiscordRole { - /** role id */ - id: string; - /** role name */ - name: string; - /** number representation of hexadecimal color code */ - color: number; - /** if this role is pinned in the user listing */ - hoist: boolean; - /** position of this role */ - position: number; - /** permission bit set */ - permissions: string; - /** whether this role is managed by an integration */ - managed: boolean; - /** whether this role is mentionable */ - mentionable: boolean; - /** the tags this role has */ - tags?: DiscordRoleTags; -} - -/** https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure */ -export interface DiscordRoleTags { - /** the id of the bot this role belongs to */ - bot_id?: string; - /** the id of the integration this role belongs to */ - integration_id?: string; - /** whether this is the guild's premium subscriber role */ - premium_subscriber?: null; -} diff --git a/src/types/api/teams.ts b/src/types/api/teams.ts deleted file mode 100644 index 3e7624ce2..000000000 --- a/src/types/api/teams.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { DiscordBaseUser } from "./mod.ts"; - -/** https://discord.com/developers/docs/topics/teams#data-models-team-object */ -export interface DiscordTeam { - /** a hash of the image of the team's icon */ - icon: string | null; - /** the unique id of the team */ - id: string; - /** the members of the team */ - members: DiscordTeamMembers[]; - /** the user id of the current team owner */ - owner_user_id: string; -} - -/** https://discord.com/developers/docs/topics/teams#data-models-team-members-object */ -export interface DiscordTeamMembers { - /** the user's membership state on the team */ - membership_state: keyof typeof DiscordMembershipState; - /** will always be ["*"] */ - permissions: string[]; - /** the id of the parent team of which they are a member */ - team_id: string; - /** the avatar, discriminator, id, and username of the user */ - user: DiscordBaseUser; -} - -/** https://discord.com/developers/docs/topics/teams#data-models-membership-state-enum */ -export enum DiscordMembershipState { - INVITED = 1, - ACCEPTED, -} diff --git a/src/types/api/template.ts b/src/types/api/template.ts deleted file mode 100644 index 20a3ba781..000000000 --- a/src/types/api/template.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { DiscordGuild, DiscordUser } from "./mod.ts"; - -/** https://discord.com/developers/docs/resources/template#template-resource */ -export interface DiscordTemplate { - /** the template code (unique ID) */ - code: string; - /** template name */ - name: string; - /** the description for the template */ - description: string | null; - /** number of times this template has been used */ - usage_count: number; - /** the ID of teh user who created the template */ - creator_id: string; - /** the user who created the template */ - creator: DiscordUser; - /** when this template was created*/ - created_at: string; - /** when this template was last synced to the source guild */ - updated_at: string; - /** the ID of the guild this template is based on */ - source_guild_id: string; - /** the guild snapshot this template contains */ - serialized_source_guild: Partial; - /** whether the template has unsynced changes */ - is_dirty: boolean | null; -} - -/** https://discord.com/developers/docs/resources/template#create-guild-from-template */ -export interface DiscordCreateGuildFromTemplateParams { - /** name of the guild (2-100 characters) */ - name: string; - /** base64 128x128 image for the guild icon */ - icon?: string; -} - -/** https://discord.com/developers/docs/resources/template#create-guild-template */ -export interface DiscordCreateGuildTemplateParams { - /** name of the template (1-100 characters) */ - name: string; - /** description for the template (0-120 characters) */ - description?: string | null; -} - -/** https://discord.com/developers/docs/resources/template#modify-guild-template */ -export interface DiscordModifyGuildTemplateParams { - /** name of the template (1-100 characters) */ - name?: string; - /** description for the template (0-120 characters) */ - description?: string | null; -} diff --git a/src/types/api/voice.ts b/src/types/api/voice.ts deleted file mode 100644 index b2d3bd7fd..000000000 --- a/src/types/api/voice.ts +++ /dev/null @@ -1,14 +0,0 @@ -export interface DiscordVoiceRegion { - /** unique ID for the region */ - id: string; - /** name of the region */ - name: string; - /** true if this is a vip-only server */ - vip: boolean; - /** true for a single server that is closet to the current user's client */ - optimal: boolean; - /** whether this is a deprecated voice region (avoid switching to these) */ - deprecated: boolean; - /** whether this is a custom voice region (used for events/etc) */ - custom: boolean; -} diff --git a/src/types/api/webhook.ts b/src/types/api/webhook.ts deleted file mode 100644 index bf2a9766a..000000000 --- a/src/types/api/webhook.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { DiscordUser } from "./mod.ts"; - -/** https://discord.com/developers/docs/resources/webhook#webhook-resource */ -export interface DiscordWebhook { - /** the id of the webhook */ - id: string; - /** the type of the webhook */ - type: DiscordWebhookTypes; - /** the guild id this webhook is for */ - guild_id?: string; - /** the channel id this webhook is for */ - channel_id: string; - /** the user this webhook was created by (not returned when getting a webhook with its token) */ - user?: DiscordUser; - /** the default name of the webhook */ - name: string | null; - /** the default avatar of the webhook */ - avatar: string | null; - /** the secure token of the webhook (returned for Incoming Webhooks) */ - token?: string; - /** the bot/OAuth2 application that created this webhook */ - application_id: string | null; -} - -/** https://discord.com/developers/docs/resources/webhook#webhook-resource */ -export enum DiscordWebhookTypes { - /** Incoming Webhook can post messages to channels with a generated token */ - INCOMING = 1, - /** Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels */ - CHANNEL_FOLLOWER, -} diff --git a/src/types/cdn.ts b/src/types/cdn.ts deleted file mode 100644 index 220aaa077..000000000 --- a/src/types/cdn.ts +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: v11 Remove -/** @deprecated Use DiscordImageSize */ -export type ImageSize = 16 | 32 | 64 | 128 | 256 | 512 | 1024 | 2048; -// TODO: v11 Remove -/** @deprecated Use DiscordImageFormat */ -export type ImageFormats = "jpg" | "jpeg" | "png" | "webp" | "gif"; diff --git a/src/types/channel.ts b/src/types/channel.ts deleted file mode 100644 index 59b361222..000000000 --- a/src/types/channel.ts +++ /dev/null @@ -1,176 +0,0 @@ -import { Overwrite, RawOverwrite } from "./guild.ts"; -import { Embed } from "./message.ts"; - -export interface ChannelEditOptions { - /** 2-100 character channel name. All */ - name?: string; - /** the position of the channel in the left-hand listing All */ - position?: number; - /** 0-1024 character channel topic. Text */ - topic?: string; - /** whether the channel is nsfw Text */ - nsfw?: boolean; - /** amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffected Text */ - rateLimitPerUser?: number; - /** the bitrate (in bits) of the voice channel; 8000 to 96000 (128000 for VIP servers) Voice */ - bitrate?: number; - /** the user limit of the voice channel; 0 refers to no limit, 1 to 99 refers to a user limit Voice */ - userLimit?: number; - /** channel or category-specific permissions All */ - overwrites?: Overwrite[]; - /** id of the new parent category for a channel Text, Voice */ - parentID?: string; -} - -export interface BaseChannelCreate { - /** The id of the guild */ - "guild_id"?: string; - /** Sorting position of the channel */ - position?: number; - /** The name of the channel (2-100 characters) */ - name?: string; - /** The channel topic (0-1024 characters) */ - topic?: string; - /** Whether the channel is nsfw */ - nsfw?: boolean; - /** The id of the last message sent in this channel (may not point to an existing or valid message) */ - "last_message_id"?: string | null; - /** The bitrate (in bits) of the voice channel */ - bitrate?: number; - /** The user limit of the voice channel */ - "user_limit"?: number; - /** Amount of seconds a user has to wait before sending another message (0-21600) Bots and users with the permission MANAGE_MESSAGES or MANAGE_CHANNEL are unaffected. */ - "rate_limit_per_user"?: number; - /** The parent category id */ - "parent_id"?: string | null; - /** When the last pinned message was pinned */ - "last_pin_timestamp"?: string; -} - -export interface DMChannelCreatePayload { - /** This is a unique channel id. It is NOT the users id. */ - id: string; - /** The id of the last message sent in this dm channel */ - "last_message_id": string; - /** The type of channel */ - type: 1; - /** The user */ - recipients: { - /** This is the user ID */ - id: string; - username: string; - avatar: string; - discriminator: string; - public_flags: number; - }[]; -} - -export interface ChannelCreatePayload extends BaseChannelCreate { - /** The id of this channel */ - id: string; - /** The type of the channel */ - type: ChannelType; - /** Explicit permission overwrites for members and roles */ - "permission_overwrites"?: RawOverwrite[]; -} - -export type ChannelType = 0 | 1 | 2 | 4 | 5 | 6; - -export enum ChannelTypes { - /** A text channel within a server */ - GUILD_TEXT, - /** A direct message between users */ - DM, - /** A voice channel within a server */ - GUILD_VOICE, - /** A direct message between multiple users. */ - GROUP_DM, - /** An organizational category that contains channels */ - GUILD_CATEGORY, - /** A channel that users can follow and cross post into their own server. */ - GUILD_NEWS, - /** A channel in which game developers can sell their game on Discord. */ - GUILD_STORE, -} - -export interface MessageContent { - mentions?: { - /** An array of allowed mention types to parse from the content. */ - parse?: ("roles" | "users" | "everyone")[]; - /** Array of role_ids to mention (Max size of 100) */ - roles?: string[]; - /** Array of user_ids to mention (Max size of 100) */ - users?: string[]; - /** Should the message author from the original message be mention. By default this is true. */ - repliedUser?: boolean; - }; - /** The message contents, up to 2000 characters */ - content?: string; - /** A nonce that can be used for optimistic message sending. */ - nonce?: number | string; - /** Whether this is a TextToSpeech message */ - tts?: boolean; - /** The contents of the file being sent */ - file?: FileContent | FileContent[]; - /** Embed object */ - embed?: Embed; - /** JSON encoded body of any additional request fields. */ - "payload_json"?: string; - /** If you want to send a reply message, provide the original message id here */ - replyMessageID?: string; - /** When sending a reply to a message that was deleted, should Discord fail and throw an error. By default we make this false to prevent your bot from crashing. */ - failReplyIfNotExists?: boolean; -} - -export interface FileContent { - blob: Blob; - name: string; -} - -export interface AllowedMentions { - /** An array of allowed mention types to parse from the content. */ - parse: ("roles" | "users" | "everyone")[]; - /** Array of role_ids to mention (Max size of 100) */ - roles?: string[]; - /** Array of user_ids to mention (Max size of 100) */ - users?: string[]; -} - -export interface GetMessages { - /** Max number of messages to return(1-100). Defaults to 50. */ - limit?: number; -} - -export interface GetMessagesAfter extends GetMessages { - /** Get messages after this message id */ - after: string; -} - -export interface GetMessagesBefore extends GetMessages { - /** Get messages before this message id */ - before: string; -} - -export interface GetMessagesAround extends GetMessages { - /** Get messages around this message id. */ - around: string; -} - -// TODO: v11 change to camelcase -export interface CreateInviteOptions { - /** Duration of invite in seconds before expiry, or 0 for never. Between 0-604800 (7 days). Defaults to 86400 (24 hours). */ - "max_age"?: number; - /** Max number of uses or 0 for unlimited. Between 0-100. Default 0 */ - "max_uses"?: number; - /** Whether this invite only grants temporary membership. */ - temporary: boolean; - /** If true, don't try to reuse a similar invite (useful for creating many unique one time use invites.) */ - unique: boolean; -} - -export interface FollowedChannelPayload { - /** The source channel id */ - "channel_id": string; - /** The webhook id */ - "webhook_id": string; -} diff --git a/src/types/discord.ts b/src/types/discord.ts deleted file mode 100644 index 5cf1e61e3..000000000 --- a/src/types/discord.ts +++ /dev/null @@ -1,380 +0,0 @@ -import { - CreateGuildPayload, - Integration, - PartialUser, - UserPayload, -} from "./guild.ts"; -import { MemberCreatePayload } from "./member.ts"; -import { Activity, Application } from "./message.ts"; -import { ActivityPayload } from "./mod.ts"; -import { ClientStatusPayload } from "./presence.ts"; - -export interface DiscordPayload { - /** OP code for the payload */ - op: number; - /** The real event data. Any JSON value basically. */ - d: unknown; - /** The sequence number, used for resuming sessions and heartbeats. ONLY for OPCode 0 */ - s?: number; - /** The event name for this payload. ONLY for OPCode 0 */ - t?: - | "APPLICATION_COMMAND_CREATE" - | "APPLICATION_COMMAND_UPDATE" - | "APPLICATION_COMMAND_DELETE" - | "CHANNEL_CREATE" - | "CHANNEL_DELETE" - | "CHANNEL_UPDATE" - | "CHANNEL_PINS_UPDATE" - | "GUILD_CREATE" - | "GUILD_DELETE" - | "GUILD_UPDATE" - | "GUILD_BAN_ADD" - | "GUILD_BAN_REMOVE" - | "GUILD_EMOJIS_UPDATE" - | "GUILD_INTEGRATIONS_UPDATE" - | "GUILD_MEMBER_ADD" - | "GUILD_MEMBER_REMOVE" - | "GUILD_MEMBER_UPDATE" - | "GUILD_MEMBERS_CHUNK" - | "GUILD_ROLE_CREATE" - | "GUILD_ROLE_DELETE" - | "GUILD_ROLE_UPDATE" - | "INTERACTION_CREATE" - | "MESSAGE_CREATE" - | "MESSAGE_DELETE" - | "MESSAGE_DELETE_BULK" - | "MESSAGE_UPDATE" - | "MESSAGE_REACTION_ADD" - | "MESSAGE_REACTION_REMOVE" - | "MESSAGE_REACTION_REMOVE_ALL" - | "MESSAGE_REACTION_REMOVE_EMOJI" - | "PRESENCE_UPDATE" - | "READY" - | "TYPING_START" - | "USER_UPDATE" - | "VOICE_STATE_UPDATE" - | "WEBHOOKS_UPDATE" - | "INTEGRATION_CREATE" - | "INTEGRATION_UPDATE" - | "INTEGRATION_DELETE" - | "INVITE_CREATE" - | "INVITE_DELETE"; -} - -export interface DiscordBotGatewayData { - /** The WSS URL that can be used for connecting to the gateway. */ - url: string; - /** The recommended number of shards to use when connecting. */ - shards: number; - /** Info on the current start limit. */ - "session_start_limit": { - /** The total number of session starts the current user is allowed. */ - total: number; - /** The remaining number of session starts the current user is allowed. */ - remaining: number; - /** Milliseconds left until limit is reset. */ - "reset_after": number; - /** The number of identify requests allowed per 5 seconds. - * So, if you had a max concurrency of 16, and 16 shards for example, you could start them all up at the same time. - * Whereas if you had 32 shards, if you tried to start up shard 0 and 16 at the same time for example, it would not work. You can start shards 0-15 concurrently, then 16-31... - * */ - "max_concurrency": number; - }; -} - -export interface DiscordHeartbeatPayload { - "heartbeat_interval": number; -} - -export enum GatewayOpcode { - Dispatch = 0, - Heartbeat, - Identify, - StatusUpdate, - VoiceStateUpdate, - Resume = 6, - Reconnect, - RequestGuildMembers, - InvalidSession, - Hello, - HeartbeatACK, -} - -export enum GatewayCloseEventCode { - UnknownError = 4000, - UnknownOpcode, - DecodeError, - NotAuthenticated, - AuthenticationFailed, - AlreadyAuthenticated, - InvalidSeq = 4007, - RateLimited, - SessionTimeout, - InvalidShard, - ShardingRequired, -} - -export enum VoiceOpcode { - Identify, - SelectProtocol, - Ready, - Heartbeat, - SessionDescription, - Speaking, - HeartbeatACK, - Resume, - Hello, - Resumed, - ClientDisconnect = 13, -} - -export enum VoiceCloseEventCode { - UnknownOpcode = 4001, - NotAuthenticated = 4003, - AuthenticationFailed, - AlreadyAuthenticated, - SessionNoLongerValid, - SessionTimeout = 4009, - ServerNotFound = 4011, - UnknownProtocol, - Disconnected = 4014, - VoiceServerCrashed, - UnknownEncryptionMode, -} - -export enum HttpResponseCode { - Ok = 200, - Created = 201, - NoContent = 204, - NotModified = 304, - BadRequest = 400, - Unauthorized = 401, - Forbidden = 403, - NotFound = 404, - MethodNotAllowed = 405, - TooManyRequests = 429, - GatewayUnavailable = 502, - // ServerError left untyped because it's 5xx. -} - -export enum JSONErrorCode { - UnknownAccount = 10001, - UnknownApplication, - UnknownChannel, - UnknownGuild, - UnknownIntegration, - UnknownInvite, - UnknownMember, - UnknownMessge, - UnknownOverwrite, - UnknownProvider, - UnknownRole, - UnknownToken = 10012, - UnknownUser, - UnknownEmoji, - UnknownWebhook, - BotsCannotUse = 20001, - OnlyBotsCanUse, - MaxGuildsReached = 30001, - MaxFriendsReached, - MaxPinsReached, - MaxGuildRolesReached = 30005, - MaxReactionsReached = 30010, - MaxGuildChannelsReached = 30013, - MaxInvitesReached = 30016, - Unathorized = 40001, - UserIsBannedFromGuild = 40007, - MissingAccess = 50001, - InvalidAccountType = 50002, - CannotExecuteOnDMChannel, - WidgetDisabled, - CannotEditMessageByAnotherUser, - CannotSendEmptyMessage, - CannotSendMessageToUser, - CannotSendMessageInVoiceChannel, - ChannelVerificationTooHigh, - OAuth2ApplicationNoBot, - OAuth2ApplicationLimitReached, - InvalidOAuthState, - MissingPermissions, - InvalidAuthenticationToken, - NoteIsTooLong, - TooFewOrTooManyMessagesToDelete, - MessageCanOnlyBePinnedInParentChannel = 50019, - InviteCodeTakenOrInvalid, - CannotExecuteOnSystemMessage, - InvalidOAuth2AccessToken, - MessageProvidedTooOldToBulkDelet = 50034, - InvalidFormBody, - InviteAcceptedToGuildApplicationBotNotIn, - InvalidAPIVersion = 50041, - ReactionBlocked = 90001, - ResourceOverloaded = 130000, -} - -export interface Properties { - $os: string; - $browser: string; - $device: string; -} - -export interface Emoji { - name: string; - id?: string; - animated?: boolean; -} - -export enum StatusTypes { - Online = "online", - DoNotDisturb = "dnd", - Idle = "idle", - Invisible = "invisible", - Offline = "offline", -} - -export type StatusType = "online" | "dnd" | "idle" | "invisible" | "offline"; - -export interface Status { - afk: boolean; - status: StatusType; -} - -export interface WebhookUpdatePayload { - "channel_id": string; - "guild_id": string; -} - -export interface PresenceUpdatePayload { - /** The user presence is being updated for. */ - user: PartialUser; - /** The id of the guild */ - "guild_id": string; - /** Either idle, dnd, online, or offline */ - status: StatusType; - /** All user's current activity */ - activities: Activity[]; - /** The user's platform dependent status */ - "client_status": ClientStatusPayload; -} - -export interface TypingStartPayload { - /** The id of the channel */ - "channel_id": string; - /** The id of the guild */ - "guild_id"?: string; - /** The id of the user */ - "user_id": string; - /** The unix time in seconds of when the user started typing */ - timestamp: number; - /** The member who started typing if this happened in a guild */ - member?: MemberCreatePayload; -} - -export interface VoiceStateUpdatePayload { - /** The guild id this voice state is for */ - "guild_id"?: string; - /** The channel id this user is connected to */ - "channel_id": string | null; - /** The user id this voice state is for */ - "user_id": string; - /** The guild member this voice state is for */ - member?: MemberCreatePayload; - /** The session id for this voice state */ - "session_id": string; - /** Whether this user is deafened by the server */ - deaf: boolean; - /** Whether this user is muted by the server */ - mute: boolean; - /** Whether this user is locally deafened */ - "self_deaf": boolean; - /** Whether this user is locally muted */ - "self_mute": boolean; - /** Whether this user is streaming using Go Live */ - "self_stream"?: boolean; - /** Whether this user is muted by the bot */ - suppress: boolean; -} - -export interface ReadyPayload { - /** gateway version */ - v: number; - /** information about the user including email */ - user: UserPayload; - /** empty array */ - "private_channels": []; - /** the guilds the user is in */ - guilds: UnavailableGuildPayload[]; - /** used for resuming connections */ - "session_id": string; - /** (shard_id, num_shards) the shard information associated with this session, if sent when identifying */ - shard?: [number, number]; - /** contains id and flags */ - application: Pick; -} - -export type UnavailableGuildPayload = Pick< - CreateGuildPayload, - "id" | "unavailable" ->; - -export type IntegrationCreateUpdateEvent = Integration & { - /** id of the guild */ - guild_id: string; -}; - -export interface IntegrationDeleteEvent { - /** integration id */ - id: string; - /** id of the guild */ - "guild_id": string; - /** id of the bot/OAuth2 application for this discord integration */ - "application_id"?: string; -} - -/** https://discord.com/developers/docs/topics/gateway#invite-create */ -export interface InviteCreateEvent { - /** the channel the invite is for */ - "channel_id": string; - /** the unique invite code */ - code: string; - /** the time at which the invite was created */ - "created_at": string; - /** the guild of the invite */ - "guild_id"?: string; - /** the user that created the invite */ - inviter?: UserPayload; - /** how long the invite is valid for (in seconds) */ - "max_age": number; - /** the maximum number of times the invite can be used */ - "max_uses": number; - /** the target user for this invite */ - "target_user"?: Partial; - /** the type of user target for this invite */ - "target_user_type"?: number; - /** whether or not the invite is temporary (invited users will be kicked on disconnect unless they're assigned a role) */ - temporary: boolean; - /** how many times the invite has been used (always will be 0) */ - uses: number; -} - -/** https://discord.com/developers/docs/topics/gateway#invite-delete */ -export interface InviteDeleteEvent { - /** the channel of the invite */ - "channel_id": string; - /** the guild of the invite */ - "guild_id"?: string; - /** the unique invite code */ - code: string; -} - -/** https://discord.com/developers/docs/topics/gateway#update-status-gateway-status-update-structure */ -export interface GatewayStatusUpdatePayload { - /** unix time (in milliseconds) of when the client went idle, or null if the client is not idle */ - since: number | null; - /** null, or the user's activities */ - activities: Pick[] | null; - /** the user's new status */ - status: StatusType; - /** whether or not the client is afk */ - afk: boolean; -} diff --git a/src/types/errors.ts b/src/types/errors.ts deleted file mode 100644 index fa1dd616c..000000000 --- a/src/types/errors.ts +++ /dev/null @@ -1,77 +0,0 @@ -export enum Errors { - // Bot Role errors - BOTS_HIGHEST_ROLE_TOO_LOW = "BOTS_HIGHEST_ROLE_TOO_LOW", - // Channel Errors - CHANNEL_NOT_FOUND = "CHANNEL_NOT_FOUND", - CHANNEL_NOT_IN_GUILD = "CHANNEL_NOT_IN_GUILD", - CHANNEL_NOT_TEXT_BASED = "CHANNEL_NOT_TEXT_BASED", - MESSAGE_MAX_LENGTH = "MESSAGE_MAX_LENGTH", - RULES_CHANNEL_CANNOT_BE_DELETED = "RULES_CHANNEL_CANNOT_BE_DELETED", - UPDATES_CHANNEL_CANNOT_BE_DELETED = "UPDATES_CHANNEL_CANNOT_BE_DELETED", - // Guild Errors - GUILD_NOT_DISCOVERABLE = "GUILD_NOT_DISCOVERABLE", - GUILD_WIDGET_NOT_ENABLED = "GUILD_WIDGET_NOT_ENABLED", - GUILD_NOT_FOUND = "GUILD_NOT_FOUND", - MEMBER_NOT_FOUND = "MEMBER_NOT_FOUND", - MEMBER_NOT_IN_VOICE_CHANNEL = "MEMBER_NOT_IN_VOICE_CHANNEL", - PRUNE_MAX_DAYS = "PRUNE_MAX_DAYS", - ROLE_NOT_FOUND = "ROLE_NOT_FOUND", - // Message Delete Errors - DELETE_MESSAGES_MIN = "DELETE_MESSAGES_MIN", - PRUNE_MIN_DAYS = "PRUNE_MIN_DAYS", - // Interaction Errors - INVALID_SLASH_DESCRIPTION = "INVALID_SLASH_DESCRIPTION", - INVALID_SLASH_NAME = "INVALID_SLASH_NAME", - INVALID_SLASH_OPTIONS = "INVALID_SLASH_OPTIONS", - INVALID_SLASH_OPTIONS_CHOICES = "INVALID_SLASH_OPTIONS_CHOICES", - // Webhook Errors - INVALID_WEBHOOK_NAME = "INVALID_WEBHOOK_NAME", - INVALID_WEBHOOK_OPTIONS = "INVALID_WEBHOOK_OPTIONS", - // Permission Errors - MISSING_ADD_REACTIONS = "MISSING_ADD_REACTIONS", - MISSING_ADMINISTRATOR = "MISSING_ADMINISTRATOR", - MISSING_ATTACH_FILES = "MISSING_ATTACH_FILES", - MISSING_BAN_MEMBERS = "MISSING_BAN_MEMBERS", - MISSING_CHANGE_NICKNAME = "MISSING_CHANGE_NICKNAME", - MISSING_CONNECT = "MISSING_CONNECT", - MISSING_CREATE_INSTANT_INVITE = "MISSING_CREATE_INSTANT_INVITE", - MISSING_DEAFEN_MEMBERS = "MISSING_DEAFEN_MEMBERS", - MISSING_EMBED_LINKS = "MISSING_EMBED_LINKS", - MISSING_INTENT_GUILD_MEMBERS = "MISSING_INTENT_GUILD_MEMBERS", - MISSING_KICK_MEMBERS = "MISSING_KICK_MEMBERS", - MISSING_MANAGE_CHANNELS = "MISSING_MANAGE_CHANNELS", - MISSING_MANAGE_EMOJIS = "MISSING_MANAGE_EMOJIS", - MISSING_MANAGE_GUILD = "MISSING_MANAGE_GUILD", - MISSING_MANAGE_MESSAGES = "MISSING_MANAGE_MESSAGES", - MISSING_MANAGE_NICKNAMES = "MISSING_MANAGE_NICKNAMES", - MISSING_MANAGE_ROLES = "MISSING_MANAGE_ROLES", - MISSING_MANAGE_WEBHOOKS = "MISSING_MANAGE_WEBHOOKS", - MISSING_MENTION_EVERYONE = "MISSING_MENTION_EVERYONE", - MISSING_MOVE_MEMBERS = "MISSING_MOVE_MEMBERS", - MISSING_MUTE_MEMBERS = "MISSING_MUTE_MEMBERS", - MISSING_PRIORITY_SPEAKER = "MISSING_PRIORITY_SPEAKER", - MISSING_READ_MESSAGE_HISTORY = "MISSING_READ_MESSAGE_HISTORY", - MISSING_SEND_MESSAGES = "MISSING_SEND_MESSAGES", - // TODO: Remove v11 - /** @deprecated Use MISSING_SEND_TTS_MESSAGES */ - MISSING_SEND_TTS_MESSAGE = "MISSING_SEND_TTS_MESSAGE", - MISSING_SEND_TTS_MESSAGES = "MISSING_SEND_TTS_MESSAGES", - MISSING_SPEAK = "MISSING_SPEAK", - MISSING_STREAM = "MISSING_STREAM", - MISSING_USE_VAD = "MISSING_USE_VAD", - MISSING_USE_EXTERNAL_EMOJIS = "MISSING_USE_EXTERNAL_EMOJIS", - MISSING_VIEW_AUDIT_LOG = "MISSING_VIEW_AUDIT_LOG", - MISSING_VIEW_CHANNEL = "MISSING_VIEW_CHANNEL", - MISSING_VIEW_GUILD_INSIGHTS = "MISSING_VIEW_GUILD_INSIGHTS", - // User Errors - NICKNAMES_MAX_LENGTH = "NICKNAMES_MAX_LENGTH", - USERNAME_INVALID_CHARACTER = "USERNAME_INVALID_CHARACTER", - USERNAME_INVALID_USERNAME = "USERNAME_INVALID_USERNAME", - USERNAME_MAX_LENGTH = "USERNAME_MAX_LENGTH", - USERNAME_MIN_LENGTH = "USERNAME_MIN_LENGTH", - // API Errors - RATE_LIMIT_RETRY_MAXED = "RATE_LIMIT_RETRY_MAXED", - REQUEST_CLIENT_ERROR = "REQUEST_CLIENT_ERROR", - REQUEST_SERVER_ERROR = "REQUEST_SERVER_ERROR", - REQUEST_UNKNOWN_ERROR = "REQUEST_UNKNOWN_ERROR", -} diff --git a/src/types/fetch.ts b/src/types/fetch.ts deleted file mode 100644 index db9735204..000000000 --- a/src/types/fetch.ts +++ /dev/null @@ -1,7 +0,0 @@ -export type RequestMethods = - | "get" - | "post" - | "put" - | "patch" - | "head" - | "delete"; diff --git a/src/types/guild.ts b/src/types/guild.ts deleted file mode 100644 index 52b3df968..000000000 --- a/src/types/guild.ts +++ /dev/null @@ -1,718 +0,0 @@ -import { Guild } from "../structures/mod.ts"; -import { ChannelCreatePayload, ChannelTypes } from "./channel.ts"; -import { Emoji, StatusType } from "./discord.ts"; -import { MemberCreatePayload } from "./member.ts"; -import { Activity, Application } from "./message.ts"; -import { Permission } from "./permission.ts"; -import { ClientStatusPayload } from "./presence.ts"; -import { RoleData } from "./role.ts"; - -export interface GuildRolePayload { - /** The id of the guild */ - "guild_id": string; - /** The role object of the role created, deleted, or updated */ - role: RoleData; -} - -export interface GuildRoleDeletePayload { - /** The id of the guild */ - "guild_id": string; - /** The id of the role */ - "role_id": string; -} - -export interface GuildMemberChunkPayload { - /** The id of the guild */ - "guild_id": string; - /** The set of guild members */ - members: MemberCreatePayload[]; - /** The chunk index in the expected chunks for this response */ - "chunk_index": number; - /** The total number of expected chunks for this response */ - "chunk_count": number; - /** if passing an invalid id, it will be found here */ - "not_found"?: string[]; - /** if passing true, presences of the members will be here */ - presences?: Presence[]; - /** The nonce to help identify */ - nonce?: string; -} - -export interface GuildMemberUpdatePayload { - /** The id of the guild */ - "guild_id": string; - /** The user's role ids */ - roles: string[]; - /** The user */ - user: UserPayload; - /** The nickname of the user in the guild */ - nick: string; - /** When the user used their nitro boost on the guild. */ - "premium_since": string | null; - /** whether the user has not yet passed the guild's Membership Screening requirements */ - pending?: boolean; -} - -export interface GuildMemberAddPayload extends MemberCreatePayload { - "guild_id": string; -} - -export interface GuildEmojisUpdatePayload { - "guild_id": string; - emojis: Emoji[]; -} - -export interface GuildBanPayload { - /** The id of the guild */ - "guild_id": string; - /** The banned user. Not a member as you can ban users outside of your guild. */ - user: UserPayload; -} - -export interface GuildDeletePayload { - /** The id of the guild */ - id: string; - /** Whether this guild went unavailable. */ - unavailable?: boolean; -} - -export interface UpdateGuildPayload { - /** The guild id */ - id: string; - /** The guild name 2-100 characters */ - name: string; - /** The guild icon image hash */ - icon: string | null; - /** The guild splash image hash */ - splash: string | null; - /** Discovery splash has; only present for guilds with the "DISCOVERABLE" feature */ - "disovery_splash": string | null; - /** The id of the owner */ - "owner_id": string; - /** The voice region id for the guild */ - region: string; - /** The afk channel id */ - "afk_channel_id": string | null; - /** AFK Timeout in seconds. */ - "afk_timeout": number; - /** The verification level required for the guild */ - "verification_level": number; - /** Default message notifications level */ - "default_message_notifications": number; - /** Explicit content filter level */ - "explicit_content_filter": number; - /** The roles in the guild */ - roles: RoleData[]; - /** The custom guild emojis */ - emojis: Emoji[]; - /** Enabled guild features */ - features: GuildFeatures[]; - /** Required MFA level for the guild */ - "mfa_level": number; - /** True if the server widget is enabled */ - "widget_enabled"?: boolean; - /** The channel id that the widget will generate an invite to, or null if set to no invite. */ - "widget_channel_id"?: string | null; - /** The id of the channel to which system mesages are sent */ - "system_channel_id": string | null; - /** System channel flags */ - "system_channel_flags": number; - /** The id of the channel where guilds with the PUBLIC feature can display rules and or guidelines. */ - "rules_channel_id": string | null; - /** The maximum amount of presences for the guild(the default value, currently 5000 is in effect when null is returned.) */ - "max_presences"?: number | null; - /** The maximum amount of members for the guild */ - "max_members"?: number; - /** The vanity url code for the guild */ - "vanity_url_code": string | null; - /** The description for the guild */ - description: string | null; - /** The banner hash */ - banner: string | null; - /** The premium tier */ - "premium_tier": number; - /** The total number of users currently boosting this server. */ - "premium_subscription_count": number; - /** The preferred local of this guild only set if guild has the DISCOVERABLE feature, defaults to en-US */ - "preferred_locale": string; - /** The id of the channel where admins and moderators of guilds with the PUBLIC feature receive notices from Discord */ - "public_updates_channel_id": string | null; - /** The maximum amount of users in a video channel. */ - "max_video_channel_users"?: number; - /** The approximate number of members in this guild, returned from the GET /guild/id endpoint when with_counts is true */ - "approximate_member_count"?: number; - /** The approximate number of non-offline members in this guild, returned from the GET /guild/id endpoint when with_counts is true */ - "approximate_presence_count"?: number; -} - -export interface CreateGuildPayload extends UpdateGuildPayload { - /** When this guild was joined at */ - "joined_at": string; - /** Whether this is considered a large guild */ - large: boolean; - /** Whether this guild is unavailable */ - unavailable: boolean; - /** Total number of members in this guild */ - "member_count"?: number; - "voice_states": VoiceState[]; - /** Users in the guild */ - members: MemberCreatePayload[]; - /** Channels in the guild */ - channels: ChannelCreatePayload[]; - presences: Presence[]; -} - -export type GuildFeatures = - | "INVITE_SPLASH" - | "VIP_REGIONS" - | "VANITY_URL" - | "VERIFIED" - | "PARTNERED" - | "PUBLIC" - | "COMMERCE" - | "NEWS" - | "DISCOVERABLE" - | "FEATURABLE" - | "ANIMATED_ICON" - | "BANNER"; - -// TODO: v11 Remove -/** @deprecated Use DiscordVoiceRegion */ -export interface VoiceRegion { - /** unique ID for the region */ - id: string; - /** name of the region */ - name: string; - /** true if this is a vip-only server */ - vip: boolean; - /** true for a single server that is closest to the current user's client */ - optimal: boolean; - /** whether this is a deprecated voice region (avoid switching to these) */ - deprecated: boolean; - /** whether this is a custom voice region (used for events/etc) */ - custom: boolean; -} - -export interface BanOptions { - /** number of days to delete messages for (0-7) */ - days?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7; - /** The reason for the ban. */ - reason?: string; -} - -export interface BannedUser { - /** The reason for the ban */ - reason?: string; - /** The banned user object */ - user: UserPayload; -} - -export interface PositionSwap { - /** The unique id */ - id: string; - /** The sorting position number. */ - position: number; -} - -export interface GuildEditOptions { - /** The guild name */ - name?: string; - /** The guild voice region id */ - region?: string; - /** The verification level. 0 is UNRESTRICTED. 1 is Verified email. 2 is 5 minutes user. 3 is 10 minutes member in guild. 4 is verified phone number */ - "verification_level"?: 0 | 1 | 2 | 3; - /** The default message notification level. 0 is ALL_MESSAGES and 1 is ONLY_MENTINS */ - "default_message_notifications"?: 0 | 1; - /** Explicit content filter level. 0 is DISABLED 1 is members without roles. 2 is all members */ - "explicit_content_filter"?: 0 | 1 | 2; - /** The id for the afk channel. */ - "afk_channel_id"?: string; - /** The afk timeout in seconds. */ - "afk_timeout"?: number; - /** If a URL is provided to the image parameter, Discordeno will automatically convert it to a base64 string internally. base64 1024x1024 png/jpeg/gif image for the guild icon (can be animated gif when the server has ANIMATED_ICON feature) */ - icon?: string; - /** user id to transfer guild ownership to (must be owner) */ - "owner_id"?: string; - /** If a URL is provided to the image parameter, Discordeno will automatically convert it to a base64 string internally. base64 16:9 png/jpeg image for the guild splash (when the server has INVITE_SPLASH feature) */ - splash?: string; - /** If a URL is provided to the image parameter, Discordeno will automatically convert it to a base64 string internally. base64 16:9 png/jpeg image for the guild banner (when the server has BANNER feature) */ - banner?: string; - /** the id of the channel to which system messages are sent */ - "system_channel_id"?: string; -} - -export interface EditIntegrationOptions { - /** The behavior when an integration subscription lapses. */ - "expire_behavior": number; - /** The period in seconds where the integration will ignore lapsed subscriptions */ - "expire_grace_period": number; - /** Whether emoticons should be synced for this integrations (twitch only currently) */ - "enable_emoticons": boolean; -} - -export interface Integration { - /** The integrations unique id */ - id: string; - /** the integrations name */ - name: string; - /** The integration type like twitch, youtube etc */ - type: string; - /** Is this integration enabled */ - enabled: boolean; - /** is this integration syncing */ - syncing?: boolean; - /** id that this integration uses for "subscribers" */ - "role_id"?: string; - /** whether emoticons should be synced for this integration (twitch only currently) */ - "enable_emoticons"?: boolean; - /** The behavior of expiring subscribers */ - "expire_behavior"?: IntegrationExpireBehaviors; - /** The grace period before expiring subscribers */ - "expire_grace_period"?: number; - /** The user for this integration */ - user?: UserPayload; - /** The integration account information */ - account: Account; - /** When this integration was last synced */ - "synced_at"?: string; - /** how many subscribers this integration has */ - "subscriber_count"?: number; - /** has this integration been revoked */ - revoked?: boolean; - /** The bot/OAuth2 application for discord integrations */ - application?: Application; -} - -export enum IntegrationExpireBehaviors { - RemoveRole, - Kick, -} - -export interface Account { - /** id of the account */ - id: string; - /** name of the account */ - name: string; -} - -export interface UserPayload { - /** The user's id */ - id: string; - /** the user's username, not unique across the platform */ - username: string; - /** The user's 4 digit discord tag */ - discriminator: string; - /** The user's avatar hash */ - avatar: string | null; - /** Whether the user is a bot */ - bot?: boolean; - /** Whether the user is an official discord system user (part of the urgent message system.) */ - system?: boolean; - /** Whether the user has two factor enabled on their account */ - "mfa_enabled"?: boolean; - /** the user's chosen language option */ - locale?: string; - /** Whether the email on this account has been verified */ - verified?: boolean; - /** The user's email */ - email?: string; - /** The flags on a user's account. */ - flags?: number; - /** The type of Nitro subscription on a user's account. */ - "premium_type"?: number; -} - -export interface PartialUser { - /** The user's id */ - id: string; - /** the user's username, not unique across the platform */ - username?: string; - /** The user's 4 digit discord tag */ - discriminator?: string; - /** The user's avatar hash */ - avatar?: string | null; - /** Whether the user is a bot */ - bot?: boolean; - /** Whether the user is an official discord system user (part of the urgent message system.) */ - system?: boolean; - /** Whether the user has two factor enabled on their account */ - "mfa_enabled"?: boolean; - /** the user's chosen language option */ - locale?: string; - /** Whether the email on this account has been verified */ - verified?: boolean; - /** The user's email */ - email?: string; - /** The flags on a user's account. */ - flags?: number; - /** The type of Nitro subscription on a user's account. */ - "premium_type"?: number; -} - -export enum UserFlags { - NONE, - DISCORD_EMPLOYEE, - DISCORD_PARTNER, - HYPE_SQUAD_EVENTS = 1 << 2, - BUG_HUNTER = 1 << 3, - HOUSE_BRAVERY = 1 << 6, - HOUSE_BRILLIANCE = 1 << 7, - HOUSE_BALANCE = 1 << 8, - EARLY_SUPPORTER = 1 << 9, - TEAM_USER = 1 << 10, - SYSTEM = 1 << 12, -} - -export enum NitroTypes { - NITRO_CLASSIC = 1, - NITRO, -} - -export interface VanityInvite { - code: string | null; - uses: number; -} - -export interface GuildEmbed { - /** Whether the embed is enabled. */ - enabled: boolean; -} - -export interface GetAuditLogsOptions { - /** Filter the logs for actions made by this user. */ - "user_id"?: string; - /** The type of audit log. */ - "action_type"?: AuditLogType; - /** Filter the logs before a certain log entry. */ - before?: string; - /** How many entries are returned. Between 1-100. Default 50. */ - limit?: number; -} - -export type AuditLogType = - | "GUILD_UPDATE" - | "CHANNEL_CREATE" - | "CHANNEL_UPDATE" - | "CHANNEL_DELETE" - | "CHANNEL_OVERWRITE_CREATE" - | "CHANNEL_OVERWRITE_UPDATE" - | "CHANNEL_OVERWRITE_DELETE" - | "MEMBER_KICK" - | "MEMBER_PRUNE" - | "MEMBER_BAN_ADD" - | "MEMBER_BAN_REMOVE" - | "MEMBER_UPDATE" - | "MEMBER_ROLE_UPDATE" - | "MEMBER_MOVE" - | "MEMBER_DISCONNECT" - | "BOT_ADD" - | "ROLE_CREATE" - | "ROLE_UPDATE" - | "ROLE_DELETE" - | "INVITE_CREATE" - | "INVITE_UPDATE" - | "INVITE_DELETE" - | "WEBHOOK_CREATE" - | "WEBHOOK_UPDATE" - | "WEBHOOK_DELETE" - | "EMOJI_CREATE" - | "EMOJI_UPDATE" - | "EMOJI_DELETE" - | "MESSAGE_DELETE" - | "MESSAGE_BULK_DELETE" - | "MESSAGE_PIN" - | "MESSAGE_UNPIN" - | "INTEGRATION_CREATE" - | "INTEGRATION_UPDATE" - | "INTEGRATION_DELETE"; - -export enum AuditLogs { - GUILD_UPDATE = 1, - CHANNEL_CREATE = 10, - CHANNEL_UPDATE, - CHANNEL_DELETE, - CHANNEL_OVERWRITE_CREATE, - CHANNEL_OVERWRITE_UPDATE, - CHANNEL_OVERWRITE_DELETE, - MEMBER_KICK = 20, - MEMBER_PRUNE, - MEMBER_BAN_ADD, - MEMBER_BAN_REMOVE, - MEMBER_UPDATE, - MEMBER_ROLE_UPDATE, - MEMBER_MOVE, - MEMBER_DISCONNECT, - BOT_ADD, - ROLE_CREATE = 30, - ROLE_UPDATE, - ROLE_DELETE, - INVITE_CREATE = 40, - INVITE_UPDATE, - INVITE_DELETE, - WEBHOOK_CREATE = 50, - WEBHOOK_UPDATE, - WEBHOOK_DELETE, - EMOJI_CREATE = 60, - EMOJI_UPDATE, - EMOJI_DELETE, - MESSAGE_DELETE = 72, - MESSAGE_BULK_DELETE, - MESSAGE_PIN, - MESSAGE_UNPIN, - INTEGRATION_CREATE = 80, - INTEGRATION_UPDATE, - INTEGRATION_DELETE, -} - -export interface Overwrite { - /** The role or user id */ - id: string; - /** Whether this is a role or a member */ - type: OverwriteType; - /** The permissions that this id is allowed to do. (This will mark it as a green check.) */ - allow: Permission[]; - /** The permissions that this id is NOT allowed to do. (This will mark it as a red x.) */ - deny: Permission[]; -} - -export enum OverwriteType { - ROLE, - MEMBER, -} - -export interface RawOverwrite { - /** The role or user id */ - id: string; - /** Whether this is a role or a member */ - type: OverwriteType; - /** The permissions that this id is allowed to do. (This will mark it as a green check.) */ - allow: string; - /** The permissions that this id is NOT allowed to do. (This will mark it as a red x.) */ - deny: string; -} - -export interface PermissionOverwrite - extends Omit { - allow: Permission[]; - deny: Permission[]; -} - -export interface ChannelCreateOptions { - /** The type of the channel */ - type?: ChannelTypes; - /** The channel topic. (0-1024 characters) */ - topic?: string; - /** The bitrate(in bits) of the voice channel. */ - bitrate?: number; - /** The user limit of the voice channel. */ - "user_limit"?: number; - /** The amount of seconds a user has to wait before sending another message. (0-21600 seconds). Bots, as well as users with the permission `manage_messages or manage_channel` are unaffected. */ - "rate_limit_per_user"?: number; - /** The sorting position of the channel */ - position?: number; - /** The channel's permission overwrites */ - permissionOverwrites?: Overwrite[]; - /** The id of the parent category for the channel */ - "parent_id"?: string; - /** Whether the channel is nsfw */ - nsfw?: boolean; - /** The reason to add in the Audit Logs. */ - reason?: string; -} - -export interface CreateEmojisOptions { - /** The roles for which this emoji will be whitelisted. Only the users with one of these roles can use this emoji. */ - roles: string[]; - /** The reason to have in the Audit Logs. */ - reason: string; -} - -export interface EditEmojisOptions { - /** The name of the emoji */ - name: string; - /** The roles for which this emoji will be whitelisted. Only the users with one of these roles can use this emoji. */ - roles: string[]; -} - -export interface CreateRoleOptions { - name?: string; - permissions?: Permission[]; - color?: number; - hoist?: boolean; - mentionable?: boolean; -} - -export interface PrunePayload { - pruned: number; -} - -export interface PruneOptions { - /** Number of days to prune (1-30). Default: 7 */ - days?: - | 1 - | 2 - | 3 - | 4 - | 5 - | 6 - | 7 - | 8 - | 9 - | 10 - | 11 - | 12 - | 13 - | 14 - | 15 - | 16 - | 17 - | 18 - | 19 - | 20 - | 21 - | 22 - | 23 - | 24 - | 25 - | 26 - | 27 - | 28 - | 29 - | 30; - /** Whether 'pruned' is returned, discouraged for large guilds. Default: true */ - computePruneCount?: boolean; - /** Role(s) to include */ - includeRoles?: string[]; -} - -export interface VoiceState { - /** the guild id this voice state is for */ - "guild_id"?: string; - /** the channel id this user is connected to */ - "channel_id": string | null; - /** the user id this voice state is for */ - "user_id": string; - /** the guild member this voice state is for */ - member?: MemberCreatePayload; - /** the session id for this voice state */ - "session_id": string; - /** whether this user is deafened by the server */ - deaf: boolean; - /** whether this user is muted by the server */ - mute: boolean; - /** whether this user is locally deafened */ - "self_deaf": boolean; - /** whether this user is locally muted */ - "self_mute": boolean; - /** whether this user is streaming using "Go Live" */ - "self_stream"?: boolean; - /** whether this user's camera is enabled */ - "self_video"?: boolean; - /** whether this user is muted by the current user */ - suppress: boolean; -} - -export interface Presence { - /** The user presence is being updated for */ - user: UserPayload; - /** The roles this user is in */ - roles: string[]; - /** The id of the guild */ - "guild_id": string; - /** Either idle */ - status: StatusType; - activities: Activity[]; - "client_status": ClientStatusPayload; - "premium_since"?: string | null; - nick?: string | null; -} - -export interface FetchMembersOptions { - /** Used to specify if you want the presences of the matched members. Default = false. */ - presences?: boolean; - /** Only returns members whose username or nickname starts with this string. DO NOT INCLUDE discriminators. If a string is provided, the max amount of members that can be fetched is 100. Default = return all members. */ - query?: string; - /** Used to specify which users to fetch specifically. */ - userIDs?: string[]; - /** Maximum number of members to return that match the query. Default = 0 which will return all members. */ - limit?: number; -} - -export interface GetMemberOptions { - /** max number of members to return (1-1000), defaults to 1 */ - limit?: number; - /** the highest user id in the previous page */ - after?: string; -} - -export interface CreateServerOptions { - /** name of the guild (2-100 characters) */ - name: string; - /** voice region id */ - region?: string; - /** guild icon image url or base64 128x128 image for the guild icon */ - icon?: string; - /** verification level */ - "verification_level"?: number; - /** default message notification level */ - "default_message_notifications"?: number; - /** explicit content filter level */ - "explicit_content_filter"?: number; - /** array of role objects new guild roles */ - roles?: RoleData[]; - /** array of partial channel objects new guild's channels */ - channels?: ChannelCreatePayload[]; - /** id for afk channel */ - "afk_channel_id"?: string; - /** afk timeout in seconds */ - "afk_timeout"?: number; - /** the id of the channel where guild notices such as welcome messages and boost events are posted */ - "system_channel_id"?: string; -} - -// https://discord.com/developers/docs/resources/template#template-object -export interface GuildTemplate { - /** the template code (unique ID) */ - code: string; - /** template name */ - name: string; - /** the description for the template */ - description: string | null; - /** number of times this template has been used */ - "usage_count": number; - /** the ID of the user who created the template */ - "creator_id": string; - /** the user who created the template */ - creator: UserPayload; - /** when this template was created */ - "created_at": string; - /** when this template was last synced to the source guild */ - "updated_at": string; - /** the ID of the guild this template is based on */ - "source_guild_id": string; - /** the guild snapshot this template contains */ - "serialized_source_guild": Guild; - /** whether the template has unsynced changes */ - "is_dirty": boolean | null; -} - -export interface CreateGuildFromTemplate { - /** name of the guild (2-100 characters) */ - name: string; - /** base64 128x128 image for the guild icon */ - icon?: string; -} - -export interface CreateGuildTemplate { - /** name of the template (1-100 characters) */ - name: string; - /** description for the template (0-120 characters) */ - description?: string; -} - -export interface EditGuildTemplate { - /** name of the template (1-100 characters) */ - name?: string; - /** description for the template (0-120 characters) */ - description?: string | null; -} diff --git a/src/types/interactions.ts b/src/types/interactions.ts deleted file mode 100644 index 5ac126eff..000000000 --- a/src/types/interactions.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { MemberCreatePayload } from "./member.ts"; - -export interface InteractionCommandPayload { - /** id of the interaction */ - id: string; - /** the type of interaction */ - type: InteractionType; - /** the command data payload */ - data?: InteractionData; - /** the guild it was sent from */ - "guild_id": string; - /** the channel it was sent from */ - "channel_id": string; - /** guild member data for the invoking user */ - member: MemberCreatePayload; - /** a continuation token for responding to the interaction */ - token: string; -} - -export enum InteractionType { - /** This type is for ACK on webhook only setup. Discord may send these which require. In a sense its a heartbeat. */ - PING = 1, - /** Slash commands */ - APPLICATION_COMMAND, -} - -export interface InteractionData { - /** the ID of the invoked command */ - id: string; - /** the name of the invoked command */ - name: string; - /** the params + values from the user */ - options: InteractionDataOption[]; -} - -export interface InteractionDataOption { - /** the name of the parameter */ - name: string; - /** the value of the pair. present if there was no more options */ - value?: string | number; - /** present if this option is a group or subcommand */ - options?: InteractionDataOption[]; -} - -/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommand */ -export interface ApplicationCommand { - /** unique id of the command */ - id: string; - /** unique id of the parent application */ - "application_id": string; - /** 3-32 character name matching `^[\w-]{3,32}$` */ - name: string; - /** 1-100 character description */ - description: string; - /** the parameters for the command */ - options?: ApplicationCommandOption[]; -} - -/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoption */ -export interface ApplicationCommandOption { - /** the type of the option */ - type: ApplicationCommandOptionType; - /** 1-32 character name matching `^[\w-]{1,32}$` */ - name: string; - /** 1-100 character description */ - description: string; - /** if the parameter is required or optional--default `false` */ - required?: boolean; - /** choices for `string` and `int` types for the user to pick from */ - choices?: ApplicationCommandOptionChoice[]; - /** if the option is a subcommand or subcommand group type, this nested options will be the parameters */ - options?: ApplicationCommandOption[]; -} - -/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoptiontype */ -export enum ApplicationCommandOptionType { - SUB_COMMAND = 1, - SUB_COMMAND_GROUP, - STRING, - INTEGER, - BOOLEAN, - USER, - CHANNEL, - ROLE, -} - -/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoptionchoice */ -export interface ApplicationCommandOptionChoice { - /** 1-100 character choice name */ - name: string; - /** value of the choice */ - value: string | number; -} - -// TODO: v11 Remove -/** @deprecated Use DiscordApplicationCommandEvent */ -export type ApplicationCommandEvent = ApplicationCommand & { - /** id of the guild the command is in */ - guild_id?: string; -}; diff --git a/src/types/invite.ts b/src/types/invite.ts deleted file mode 100644 index 2f0a483cb..000000000 --- a/src/types/invite.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Guild } from "../structures/mod.ts"; -import { ChannelCreatePayload } from "./channel.ts"; -import { UserPayload } from "./guild.ts"; - -/** https://discord.com/developers/docs/resources/invite#invite-object */ -export interface InvitePayload { - /** the invite code (unique ID) */ - code: string; - /** the guild this invite is for */ - guild?: Partial; - /** the channel this invite is for */ - channel: Partial; - /** the user who created the invite */ - inviter?: UserPayload; - /** the target user for this invite */ - "target_user"?: Partial; - /** the type of user target for this invite */ - "target_user_type"?: InviteTargetUserTypes; - /** approximate count of online members (only present when target_user is set) */ - "approximate_presence_count"?: number; - /** approximate count of total members */ - "approximate_member_count": number; -} - -/** https://discord.com/developers/docs/resources/invite#invite-resource */ -export enum InviteTargetUserTypes { - STREAM = 1, -} diff --git a/src/types/member.ts b/src/types/member.ts deleted file mode 100644 index 41fe58b40..000000000 --- a/src/types/member.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { UserPayload } from "./guild.ts"; - -export interface EditMemberOptions { - /** Value to set users nickname to. Requires MANAGE_NICKNAMES permission. */ - nick?: string; - /** Array of role ids the member is assigned. Requires MANAGE_ROLES permission. */ - roles?: string[]; - /** Whether the user is muted in voice channels. Requires MUTE_MEMBERS permission. */ - mute?: boolean; - /** Whether the user is deafened in voice channels. Requires DEAFEN_MEMBERS permission. */ - deaf?: boolean; - /** The id of the channel to move user to if they are connected to voice. To kick the user from their current channel, set to null. Requires MOVE_MEMBERS permission. When moving members to channels, must have permissions to both CONNECT to the channel and have the MOVE_MEMBER permission. */ - // deno-lint-ignore camelcase - channel_id?: string | null; -} - -export interface MemberCreatePayload { - /** The user this guild member represents */ - user: UserPayload; - /** The user's guild nickname if one is set. */ - nick?: string; - /** Array of role ids that the member has */ - roles: string[]; - /** When the user joined the guild. */ - // deno-lint-ignore camelcase - joined_at: string; - /** When the user used their nitro boost on the server. */ - // deno-lint-ignore camelcase - premium_since?: string; - /** Whether the user is deafened in voice channels */ - deaf: boolean; - /** Whether the user is muted in voice channels */ - mute: boolean; - /** Whether the user has passed the guild's Membership Screening requirements */ - pending?: boolean; -} - -export interface GuildMember { - /** The user's guild nickname if one is set. */ - nick?: string; - /** Array of role ids that the member has */ - roles: string[]; - /** When the user joined the guild. */ - joinedAt: number; - /** When the user used their nitro boost on the server. */ - premiumSince?: number; - /** Whether the user is deafened in voice channels */ - deaf: boolean; - /** Whether the user is muted in voice channels */ - mute: boolean; - /** Whether the user has passed the guild's Membership Screening requirements */ - pending?: boolean; -} - -export interface InteractionMember extends GuildMember { - /** total permissions of the member in the channel, including overrides, returned when in the interaction object */ - permissions: string; -} diff --git a/src/types/message.ts b/src/types/message.ts deleted file mode 100644 index 4e6c2f7ad..000000000 --- a/src/types/message.ts +++ /dev/null @@ -1,394 +0,0 @@ -import { Channel } from "../structures/mod.ts"; -import { ChannelType } from "./channel.ts"; -import { UserPayload } from "./guild.ts"; -import { MemberCreatePayload } from "./member.ts"; - -export interface MentionedUser extends UserPayload { - // @ts-ignore no idea how to fix this - member: MemberCreatePayload; -} - -export interface MentionedChannel { - /** The id of the channel */ - id: string; - /** The id of the guild containing the channel */ - "guild_id": string; - /** The type of the channel. */ - type: ChannelType; - /** The name of the channel. */ - name: string; -} - -export interface Attachment { - /** Attachment id */ - id: string; - /** The name of the file attached */ - filename: string; - /** The size of file in bytes */ - size: number; - /** Source url of file */ - url: string; - /** A proxied url of file */ - "proxy_url": string; - /** The height of file if an image */ - height?: number | null; - /** The width of the file if an image */ - width?: number | null; -} - -export interface Embed { - /** The title of the embed */ - title?: string; - /** The type of embed (always rich for webhook embeds) */ - type?: string; - /** The description of embeds */ - description?: string; - /** The url of embed */ - url?: string; - /** The timestap of the embed content */ - timestamp?: string; - /** The color code of the embed */ - color?: number; - /** The footer information */ - footer?: EmbedFooter; - /** The image information */ - image?: EmbedImage; - /** The thumbnail information */ - thumbnail?: EmbedThumbnail; - /** The video information */ - video?: EmbedVideo; - /** Provider information */ - provider?: EmbedProvider; - /** Author information */ - author?: EmbedAuthor; - /** Fields information */ - fields?: EmbedField[]; -} - -export interface EmbedFooter { - /** The text of the footer */ - text: string; - /** The url of the footer icon. Only supports http(s) and attachments */ - "icon_url"?: string; - /** A proxied url of footer icon */ - "proxy_icon_url"?: string; -} - -export interface EmbedImage { - /** The source url of image (only supports http(s) and attachments) */ - url?: string; - /** A proxied url of the image */ - "proxy_url"?: string; - /** The height of image */ - height?: number; - /** The width of the image */ - width?: number; -} - -export interface EmbedThumbnail { - /** The source url of image (only supports http(s) and attachments) */ - url?: string; - /** A proxied url of the thumbnail */ - "proxy_url"?: string; - /** The height of the thumbnail */ - height?: number; - /** The width of the thumbnail */ - width?: number; -} - -export interface EmbedVideo { - /** The source url of video */ - url?: string; - /** a proxied url of the video */ - proxy_url?: string; - /** The height of the video */ - height?: number; - /** The width of the video */ - width?: number; -} - -export interface EmbedProvider { - /** The name of the provider */ - name?: string; - /** The url of the provider */ - url?: string; -} - -export interface EmbedAuthor { - /** The name of the author */ - name?: string; - /** The url of the author */ - url?: string; - /** The url of the author icon (supports http(s) and attachments) */ - "icon_url"?: string; - /** A proxied url of author icon */ - "proxy_icon_url"?: string; -} - -export interface EmbedField { - /** The name of the field */ - name: string; - /** The value of the field */ - value: string; - /** Whether or not this field should display inline */ - inline?: boolean; -} - -export interface Reaction { - /** The times this emoji has been used to react */ - count: number; - /** Whether the current user reacted using this emoji */ - me: boolean; - /** The emoji information. Can be partial. */ - emoji: EmojiReaction; -} - -// TODO: v11 Remove -/** @deprecated Use DiscordMessageTypes */ -export enum MessageTypes { - DEFAULT, - RECIPIENT_ADD, - RECIPIENT_REMOVE, - CALL, - CHANNEL_NAME_CHANGE, - CHANNEL_ICON_CHANGE, - CHANNEL_PINNED_MESSAGE, - GUILD_MEMBER_JOIN, - USER_PREMIUM_GUILD_SUBSCRIPTION, - USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1, - USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2, - USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3, - CHANNEL_FOLLOW_ADD, - GUILD_DISCOVERY_DISQUALIFIED = 14, - GUILD_DISCOVERY_REQUALIFIED, - GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING, - GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING, - REPLY = 19, - APPLICATION_COMMAND, -} - -export enum ActivityTypes { - JOIN = 1, - SPECTATE, - LISTEN, - JOIN_REQUEST = 5, -} - -export interface Activity { - /** The type of message activity */ - type: 1 | 2 | 3 | 5; - /** The party id from a rich presence event */ - "party_id"?: string; -} - -export interface Application { - /** The id of the application */ - id: string; - /** The id of the embed's image asset */ - "cover_image"?: string; - /** The application's description */ - description: string; - /** The id of the application's icon */ - icon: string | null; - /** The name of the application */ - name: string; - /** the description of the app */ - summary: string; - /** the bot associated with this application */ - bot?: UserPayload; -} - -export interface Reference { - /** The id of the originating message */ - // deno-lint-ignore camelcase - message_id?: string; - /** The id of the originating message's channel */ - // deno-lint-ignore camelcase - channel_id?: string; - /** The id of the originating message's guild */ - // deno-lint-ignore camelcase - guild_id?: string; - /** When sending, whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message, default false */ - // deno-lint-ignore camelcase - fail_if_not_exists?: boolean; -} - -export interface DiscordReferencePayload extends Reference { - /** The id of the originating message's channel */ - // deno-lint-ignore camelcase - channel_id: string; -} - -export enum MessageFlags { - CROSSPOSTED = 1 << 0, - IS_CROSSPOST = 1 << 1, - SUPPRESS_EMBEDS = 1 << 2, - SOURCE_MESSAGE_DELETED = 1 << 3, - URGENT = 1 << 4, -} - -export interface EmojiReaction { - /** The emoji id. */ - id?: string; - /** The emoji name. Null in reaction emoji object if emoji is no longer on the server */ - name: string | null; - /** The roles this emoji is whitelisted to */ - roles?: string[]; - /** The user that created this emoji */ - user?: UserPayload; - /** Whether this emoji must be wrapped in colons */ - "require_colons"?: boolean; - /** Whether this emoji is managed */ - managed?: boolean; - /** Whether this emoji is animated */ - animated?: boolean; -} - -export interface ReactionPayload { - /** The id of the reaction. Null usually if it is a default discord emoji. */ - id: string | null; - /** The name of the reaction. Null if it was deleted from the guild and the custom data is no longer available */ - name: string | null; - /** If the reaction is an animated emoji. */ - animated?: boolean; -} - -export interface MessageCreateOptions { - /** The id of the message */ - id: string; - /** The id of the channel the message was sent in */ - "channel_id": string; - /** The id of the guild the message was sent in */ - "guild_id"?: string; - /** The author of this message (not guaranteed to be a valid user such as a webhook.) */ - author: UserPayload; - /** The member properties for this message's author. Can be partial. */ - member?: MemberCreatePayload; - /** The contents of the message */ - content: string; - /** When this message was sent */ - timestamp: string; - /** When this message was edited (if it was not edited, null) */ - "edited_timestamp": string | null; - /** Whether this was a TextToSpeech message. */ - tts: boolean; - /** Whether this message mentions everyone */ - "mentions_everyone": boolean; - /** Users specifically mentioned in the message. */ - mentions: MentionedUser[]; - /** Roles specifically mentioned in this message */ - "mention_roles": string[]; - /** Channels specifically mentioned in this message */ - "mention_channels"?: MentionedChannel[]; - /** Any attached files */ - attachments: Attachment[]; - /** Any embedded content */ - embeds: Embed[]; - /** Reactions to the message */ - reactions?: Reaction[]; - /** Used for validating a message was sent */ - nonce?: number | string; - /** Whether this message is pinned */ - pinned: boolean; - /** If the message is generated by a webhook, this is the webhooks id */ - "webhook_id"?: string; - /** The type of message */ - type: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; - /** The activities sent with Rich Presence-related chat embeds. */ - activity?: Activity; - /** Applications that sent with Rich Presence related chat embeds. */ - applications?: Application; - /** The reference data sent with crossposted messages */ - // deno-lint-ignore camelcase - message_reference?: DiscordReferencePayload; - /** The message flags combined like permission bits describe extra features of the message */ - flags?: 1 | 2 | 4 | 8 | 16; - /** the stickers sent with the message (bots currently can only receive messages with stickers, not send) */ - stickers?: MessageSticker[]; - /** The message id of the original message if this message was sent as a reply. If null, the original message was deleted. */ - "referenced_message"?: MessageCreateOptions | null; -} - -export interface BaseMessageDeletePayload { - /** The id of the channel */ - "channel_id": string; - /** The id of the guild */ - "guild_id"?: string; -} - -export interface MessageDeletePayload extends BaseMessageDeletePayload { - /** The id of the message */ - id: string; -} - -export interface MessageDeleteBulkPayload extends BaseMessageDeletePayload { - /** The ids of the messages */ - ids: string[]; -} - -export interface MessageUpdatePayload { - /** The message id */ - id: string; - /** The channel id */ - "channel_id": string; -} - -export interface BaseMessageReactionPayload { - /** The id of the channel */ - "channel_id": string; - /** The id of the message */ - "message_id": string; - /** The id of the guild */ - "guild_id"?: string; -} - -export interface MessageReactionPayload extends BaseMessageReactionPayload { - /** The id of the user */ - "user_id": string; - /** The member who reacted if this happened in a guild. Not available for MESSAGE_REACTION_REMOVE */ - member?: MemberCreatePayload; - /** The emoji used to react */ - emoji: ReactionPayload; -} - -export interface MessageReactionUncachedPayload extends MessageReactionPayload { - id: string; - channelID: string; - guildID?: string; -} - -export interface MessageReactionRemoveEmojiPayload - extends BaseMessageReactionPayload { - /** The emoji that was removed. */ - emoji: ReactionPayload; -} - -export interface PartialMessage { - id: string; - channel: Channel; -} - -export interface MessageSticker { - /** id of the sticker */ - id: string; - /** id of the pack the sticker is from */ - "pack_id": string; - /** name of the sticker */ - name: string; - /** description of the sticker */ - description: string; - /** a comma-separated list of tags for the sticker */ - tags?: string; - /** sticker asset hash. The URL for fetching sticker assets is currently private. */ - asset: string; - /** sticker preview asset hash. The URL for fetching sticker assets is currently private. */ - "preview_asset": string | null; - /** type of sticker format */ - "format_type": MessageStickerFormat; -} - -export enum MessageStickerFormat { - PNG = 1, - APNG, - LOTTIE, -} diff --git a/src/types/mod.ts b/src/types/mod.ts deleted file mode 100644 index 13ca88bb5..000000000 --- a/src/types/mod.ts +++ /dev/null @@ -1,17 +0,0 @@ -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 "./interactions.ts"; -export * from "./invite.ts"; -export * from "./member.ts"; -export * from "./message.ts"; -export * from "./options.ts"; -export * from "./permission.ts"; -export * from "./presence.ts"; -export * from "./role.ts"; -export * from "./webhook.ts"; -export * from "./api/mod.ts"; diff --git a/src/types/oauth.ts b/src/types/oauth.ts deleted file mode 100644 index 69d3cd952..000000000 --- a/src/types/oauth.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { UserPayload } from "./guild.ts"; -import { TeamPayload } from "./teams.ts"; - -export interface OAuthApplication { - /** id of the app */ - id: string; - /** the name of the app */ - name: string; - /** the icon hash of the app */ - icon: string | null; - /** the description of the app */ - description: string; - /** an array of rpc origin urls, if rpx is enabled */ - "rpc_origins"?: string[]; - /** when false only app owner can join the app's bot to guilds */ - "bot_public": boolean; - /** when true the app's bot will only join upon completion of the full oauth2 code grant flow */ - "bot_require_code_grand": boolean; - /** partial user object containing info on the owner of the application */ - owner: Partial; - /** if this application is a game sold on Disccord, this field will be the summary field for the store page of its primary sku */ - summary: string; - /** the base64 enccoded key for the GameSDK'S GetTicket */ - "verify_key": string; - /** if the application belongs to a team, this will be a list of the members of that team */ - team: TeamPayload | null; - /** if this application is a game sold on Discord, this field will be the guild to which it has been linked */ - "guild_id"?: string; - /** if this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists */ - "primary_sku_id"?: string; - /** if this application is a game sold on Discord, this field will be the URL slug that links to the store page */ - slug?: string; - /** if this application is a game sold on Discord, this field wil be the hash of the image on store embeds */ - "cover_image"?: string; - /** the application's public flags */ - flags: number; -} diff --git a/src/types/options.ts b/src/types/options.ts deleted file mode 100644 index 7ceb6ad5a..000000000 --- a/src/types/options.ts +++ /dev/null @@ -1,351 +0,0 @@ -import { Channel, Guild, Member, Message, Role } from "../structures/mod.ts"; -import { Collection } from "../util/collection.ts"; -import { - DiscordPayload, - Emoji, - IntegrationCreateUpdateEvent, - IntegrationDeleteEvent, - InviteCreateEvent, - InviteDeleteEvent, - PresenceUpdatePayload, - TypingStartPayload, - VoiceStateUpdatePayload, -} from "./discord.ts"; -import { UserPayload } from "./guild.ts"; -import { - ApplicationCommandEvent, - InteractionCommandPayload, -} from "./interactions.ts"; -import { - Attachment, - BaseMessageReactionPayload, - Embed, - MessageReactionRemoveEmojiPayload, - MessageReactionUncachedPayload, - PartialMessage, - ReactionPayload, -} from "./message.ts"; -import { CamelCaseProps } from "./util.ts"; - -export interface BotConfig { - token: string; - compress?: boolean; - intents: (Intents | keyof typeof Intents)[]; - eventHandlers?: EventHandlers; -} - -export interface GuildUpdateChange { - key: string; - oldValue?: unknown; - value?: unknown; -} - -export interface OldMessage { - attachments: Attachment[]; - content: string; - embeds: Embed[]; - editedTimestamp?: number; - tts: boolean; - pinned: boolean; -} - -export interface DebugArg { - /** Red is for errors or urgent issues. Yellow is for warnings/alerts. Green is for actions being taken. Blue is for */ - type?: - | "gatewayIdentify" - | "error" - | "globallyRateLimited" - | "requestCreate" - | "requestSuccess" - | "requestFetch" - | "requestFetched" - | "requestMembersProcessing" - | "gatewayHeartbeat" - | "gatewayHeartbeatStopped" - | "shardCreate" - | "gatewayInvalidSession" - | "gatewayReconnect" - | "gatewayResume" - | "gatewayResumed" - | "wsClose" - | "wsError" - | "wsReconnect" - | "missingShard"; - data: unknown; -} - -interface RateLimitData { - /** The number of remaining requests that can be made */ - remaining: string | null; - /** Epoch time (seconds since 00:00:00 UTC on January 1, 1970) at which the rate limit resets */ - resetTimestamp: string | null; - /** Total time (in seconds) of when the current rate limit bucket will reset. Can have decimals to match previous millisecond ratelimit precision */ - retryAfter: string | null; - /** Returned only on a HTTP 429 response if the rate limit headers returned are of the global rate limit (not per-route) */ - global: string | null; - /** A unique string denoting the rate limit being encountered (non-inclusive of major parameters in the route path) */ - bucketID: string | null; - /** The URL the HTTP request is made to */ - url: string; -} - -export interface EventHandlers { - rateLimit?: (data: RateLimitData) => unknown; - /** Sent when a new Slash Command is created, relevant to the current user. */ - applicationCommandCreate?: ( - data: CamelCaseProps, - ) => unknown; - /** Sent when a Slash Command relevant to the current user is updated. */ - applicationCommandUpdate?: ( - data: CamelCaseProps, - ) => unknown; - /** Sent when a Slash Command relevant to the current user is deleted. */ - applicationCommandDelete?: ( - data: CamelCaseProps, - ) => unknown; - /** Sent when properties about the user change. */ - botUpdate?: (user: UserPayload) => unknown; - /** Sent when a new guild channel is created, relevant to the current user. */ - channelCreate?: (channel: Channel) => unknown; - /** Sent when a channel is updated. This is not sent when the field `last_message_id` is altered. To keep track of the `last_message_id` changes, you must listen for `MESSAGE_CREATE` events. */ - channelUpdate?: (channel: Channel, cachedChannel: Channel) => unknown; - /** Sent when a channel relevant to the current user is deleted. */ - channelDelete?: (channel: Channel) => unknown; - /** Sent when a message is pinned or unpinned in a text channel. This is not sent when a pinned message is deleted. */ - channelPinsUpdate?: ( - channel: Channel, - guild?: Guild, - lastPinTimestamp?: string | null, - ) => unknown; - debug?: (args: DebugArg) => unknown; - dispatchRequirements?: (data: DiscordPayload, shardID: number) => unknown; - /** Sent when a user is banned from a guild. */ - guildBanAdd?: (guild: Guild, user: UserPayload, member?: Member) => unknown; - /** Sent when a user is unbanned from a guild. */ - guildBanRemove?: ( - guild: Guild, - user: UserPayload, - member?: Member, - ) => unknown; - /** - * This event can be sent in three different scenarios: - * 1. When a user is initially connecting, to lazily load and backfill information for all unavailable guilds sent in the `READY` event. Guilds that are unavailable due to an outage will send a `GUILD_DELETE` event. - * 2. When a Guild becomes available again to the client. - * 3. When the current user joins a new Guild. - */ - guildCreate?: (guild: Guild) => unknown; - guildLoaded?: (guild: Guild) => unknown; - /** Sent when a guild is updated. */ - guildUpdate?: (guild: Guild, changes: GuildUpdateChange[]) => unknown; - /** Sent when a guild becomes or was already unavailable due to an outage, or when the user leaves or is removed from a guild. If the `unavailable` field is not set, the user was removed from the guild. */ - guildDelete?: (guild: Guild) => unknown; - /** Sent when a guild's emojis have been updated. */ - guildEmojisUpdate?: ( - guild: Guild, - emojis: Collection, - cachedEmojis: Collection, - ) => unknown; - /** Sent when a guild integration is updated. */ - guildIntegrationsUpdate?: (guild: Guild) => unknown; - /** Sent when a new user joins a guild. */ - guildMemberAdd?: (guild: Guild, member: Member) => unknown; - /** Sent when a user is removed from a guild (leave/kick/ban). */ - guildMemberRemove?: ( - guild: Guild, - user: UserPayload, - member?: Member, - ) => unknown; - /** Sent when a guild member is updated. This will also fire when the user object of a guild member changes. */ - guildMemberUpdate?: ( - guild: Guild, - member: Member, - cachedMember?: Member, - ) => unknown; - heartbeat?: () => unknown; - /** Sent when a user in a guild uses a Slash Command. */ - interactionCreate?: ( - data: Omit & { member: Member }, - ) => unknown; - /** Sent when a message is created. */ - messageCreate?: (message: Message) => unknown; - /** Sent when a message is deleted. */ - messageDelete?: (partial: PartialMessage, message?: Message) => unknown; - /** Sent when a message is updated. */ - messageUpdate?: (message: Message, cachedMessage: OldMessage) => unknown; - nicknameUpdate?: ( - guild: Guild, - member: Member, - nickname: string, - oldNickname?: string, - ) => unknown; - /** A user's presence is their current state on a guild. This event is sent when a user's presence or info, such as name or avatar, is updated. */ - presenceUpdate?: ( - presence: PresenceUpdatePayload, - oldPresence?: PresenceUpdatePayload, - ) => unknown; - raw?: (data: DiscordPayload) => unknown; - rawGateway?: (data: unknown) => unknown; - ready?: () => unknown; - /** Sent when a user adds a reaction to a message. */ - reactionAdd?: ( - payload: MessageReactionUncachedPayload, - emoji: ReactionPayload, - userID: string, - message?: Message, - ) => unknown; - /** Sent when a user removes a reaction from a message. */ - reactionRemove?: ( - payload: MessageReactionUncachedPayload, - emoji: ReactionPayload, - userID: string, - message?: Message, - ) => unknown; - /** Sent when a user explicitly removes all reactions from a message. */ - reactionRemoveAll?: (data: BaseMessageReactionPayload) => unknown; - /** Sent when a bot removes all instances of a given emoji from the reactions of a message. */ - reactionRemoveEmoji?: (data: MessageReactionRemoveEmojiPayload) => unknown; - /** Sent when a guild role is created. */ - roleCreate?: (guild: Guild, role: Role) => unknown; - /** Sent when a guild role is deleted. */ - roleDelete?: (guild: Guild, role: Role) => unknown; - /** Sent when a guild role is updated. */ - roleUpdate?: (guild: Guild, role: Role, cachedRole: Role) => unknown; - roleGained?: (guild: Guild, member: Member, roleID: string) => unknown; - roleLost?: (guild: Guild, member: Member, roleID: string) => unknown; - shardReady?: (shardID: number) => unknown; - shardFailedToLoad?: ( - shardID: number, - guildIDs: Set, - ) => unknown; - /** Sent when a user starts typing in a channel. */ - typingStart?: (data: TypingStartPayload) => unknown; - voiceChannelJoin?: (member: Member, channelID: string) => unknown; - voiceChannelLeave?: (member: Member, channelID: string) => unknown; - voiceChannelSwitch?: ( - member: Member, - channelID: string, - oldChannelID: string, - ) => unknown; - /** Sent when someone joins/leaves/moves voice channels. */ - voiceStateUpdate?: ( - member: Member, - voiceState: VoiceStateUpdatePayload, - ) => unknown; - /** Sent when a guild's voice server is updated. This is sent when initially connecting to voice, and when the current voice instance fails over to a new server. */ - voiceServerUpdate?: ( - token: string, - guild: Guild, - endpoint: string, - ) => unknown; - /** Sent when a guild channel's webhook is created, updated, or deleted. */ - webhooksUpdate?: (channelID: string, guildID: string) => unknown; - /** Sent when a member has passed the guild's Membership Screening requirements */ - membershipScreeningPassed?: (guild: Guild, member: Member) => unknown; - /** Sent when an integration is created on a server such as twitch, youtube etc.. */ - integrationCreate?: ( - data: CamelCaseProps, - ) => unknown; - /** Sent when an integration is updated. */ - integrationUpdate?: ( - data: CamelCaseProps, - ) => unknown; - /** Sent when an integration is deleted. */ - integrationDelete?: ( - data: CamelCaseProps, - ) => undefined; - /** Sent when a new invite to a channel is created. */ - inviteCreate?: (data: CamelCaseProps) => unknown; - /** Sent when an invite is deleted. */ - inviteDelete?: (data: CamelCaseProps) => unknown; -} - -/** https://discord.com/developers/docs/topics/gateway#list-of-intents */ -export enum Intents { - /** Enables the following events: - * - GUILD_CREATE - * - GUILD_DELETE - * - GUILD_ROLE_CREATE - * - GUILD_ROLE_UPDATE - * - GUILD_ROLE_DELETE - * - CHANNEL_CREATE - * - CHANNEL_UPDATE - * - CHANNEL_DELETE - * - CHANNEL_PINS_UPDATE - */ - GUILDS = 1 << 0, - /** Enables the following events: - * - GUILD_MEMBER_ADD - * - GUILD_MEMBER_UPDATE - * - GUILD_MEMBER_REMOVE - */ - GUILD_MEMBERS = 1 << 1, - /** Enables the following events: - * - GUILD_BAN_ADD - * - GUILD_BAN_REMOVE - */ - GUILD_BANS = 1 << 2, - /** Enables the following events: - * - GUILD_EMOJIS_UPDATE - */ - GUILD_EMOJIS = 1 << 3, - /** Enables the following events: - * - GUILD_INTEGRATIONS_UPDATE - * - INTEGRATION_CREATE - * - INTEGRATION_UPDATE - * - INTEGRATION_DELETE - */ - GUILD_INTEGRATIONS = 1 << 4, - /** Enables the following events: - * - WEBHOOKS_UPDATE - */ - GUILD_WEBHOOKS = 1 << 5, - /** Enables the following events: - * - INVITE_CREATE - * - INVITE_DELETE - */ - GUILD_INVITES = 1 << 6, - /** Enables the following events: - * - VOICE_STATE_UPDATE - */ - GUILD_VOICE_STATES = 1 << 7, - /** Enables the following events: - * - PRESENCE_UPDATE - */ - GUILD_PRESENCES = 1 << 8, - /** Enables the following events: - * - MESSAGE_CREATE - * - MESSAGE_UPDATE - * - MESSAGE_DELETE - */ - GUILD_MESSAGES = 1 << 9, - /** Enables the following events: - * - MESSAGE_REACTION_ADD - * - MESSAGE_REACTION_REMOVE - * - MESSAGE_REACTION_REMOVE_ALL - * - MESSAGE_REACTION_REMOVE_EMOJI - */ - GUILD_MESSAGE_REACTIONS = 1 << 10, - /** Enables the following events: - * - TYPING_START - */ - GUILD_MESSAGE_TYPING = 1 << 11, - /** Enables the following events: - * - CHANNEL_CREATE - * - MESSAGE_CREATE - * - MESSAGE_UPDATE - * - MESSAGE_DELETE - * - CHANNEL_PINS_UPDATE - */ - DIRECT_MESSAGES = 1 << 12, - /** Enables the following events: - * - MESSAGE_REACTION_ADD - * - MESSAGE_REACTION_REMOVE - * - MESSAGE_REACTION_REMOVE_ALL - * - MESSAGE_REACTION_REMOVE_EMOJI - */ - DIRECT_MESSAGE_REACTIONS = 1 << 13, - /** Enables the following events: - * - TYPING_START - */ - DIRECT_MESSAGE_TYPING = 1 << 14, -} diff --git a/src/types/permission.ts b/src/types/permission.ts deleted file mode 100644 index 06435c0fe..000000000 --- a/src/types/permission.ts +++ /dev/null @@ -1,36 +0,0 @@ -export type Permission = keyof typeof Permissions; - -export enum Permissions { - CREATE_INSTANT_INVITE = 0x00000001, - KICK_MEMBERS = 0x00000002, - BAN_MEMBERS = 0x00000004, - ADMINISTRATOR = 0x00000008, - MANAGE_CHANNELS = 0x00000010, - MANAGE_GUILD = 0x00000020, - ADD_REACTIONS = 0x00000040, - VIEW_AUDIT_LOG = 0x00000080, - PRIORITY_SPEAKER = 0x00000100, - STREAM = 0x00000200, - VIEW_CHANNEL = 0x00000400, - SEND_MESSAGES = 0x00000800, - SEND_TTS_MESSAGES = 0x00001000, - MANAGE_MESSAGES = 0x00002000, - EMBED_LINKS = 0x00004000, - ATTACH_FILES = 0x00008000, - READ_MESSAGE_HISTORY = 0x00010000, - MENTION_EVERYONE = 0x00020000, - USE_EXTERNAL_EMOJIS = 0x00040000, - VIEW_GUILD_INSIGHTS = 0x00080000, - CONNECT = 0x00100000, - SPEAK = 0x00200000, - MUTE_MEMBERS = 0x00400000, - DEAFEN_MEMBERS = 0x00800000, - MOVE_MEMBERS = 0x01000000, - USE_VAD = 0x02000000, - CHANGE_NICKNAME = 0x04000000, - MANAGE_NICKNAMES = 0x08000000, - MANAGE_ROLES = 0x10000000, - MANAGE_WEBHOOKS = 0x20000000, - MANAGE_EMOJIS = 0x40000000, - USE_SLASH_COMMANDS = 0x80000000, -} diff --git a/src/types/presence.ts b/src/types/presence.ts deleted file mode 100644 index e2ebd6f73..000000000 --- a/src/types/presence.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { StatusType } from "./discord.ts"; - -export interface ClientStatusPayload { - /** The user's status set for an active desktop (Windows, Linux, Mac) application session */ - desktop?: StatusType; - - /** The user's status set for an active mobile (iOS, Android) application session */ - mobile?: StatusType; - - /** The user's status set for an active web (browser, bot account) application session */ - web?: StatusType; -} diff --git a/src/types/role.ts b/src/types/role.ts deleted file mode 100644 index 58e160f0a..000000000 --- a/src/types/role.ts +++ /dev/null @@ -1,29 +0,0 @@ -export interface RoleData { - /** role id */ - id: string; - /** role name */ - name: string; - /** integer representation of hexadecimal color code */ - color: number; - /** if this role is pinned in the user listing */ - hoist: boolean; - /** position of this role */ - position: number; - /** permission bit set */ - permissions: string; - /** whether this role is managed by an integration */ - managed: boolean; - /** whether this role is mentionable */ - mentionable: boolean; - /** Certain roles may have tags that allow you to determine if this role is related to a bot, an integration, or the booster role. */ - tags?: RoleTags; -} - -export interface RoleTags { - /** the id of the bot who has this role */ - "bot_id"?: string; - /** whether this is the premium subscriber role for this guild */ - "premium_subscriber"?: null; - /** the id of the integration this role belongs to */ - "integration_id"?: string; -} diff --git a/src/types/teams.ts b/src/types/teams.ts deleted file mode 100644 index 3cdea56f4..000000000 --- a/src/types/teams.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { UserPayload } from "./guild.ts"; - -/** https://discord.com/developers/docs/topics/teams#data-models-team-object */ -export interface TeamPayload { - /** a hash of the image of the team's icon */ - icon: string | null; - /** the unique id of the team */ - id: string; - /** the members of the team */ - members: TeamMembersPayload[]; - /** the user id of the current team owner */ - "owner_user_id": string; -} - -/** https://discord.com/developers/docs/topics/teams#data-models-team-members-object */ -export interface TeamMembersPayload { - /** the user's membership state on the team */ - "membership_state": MembershipState; - /** will always be ["*"] */ - permissions: string[]; - /** the id of the parent team of which they are a member */ - "team_id": string; - /** the avatar, discriminator, id, and username of the user */ - user: Partial; -} - -/** https://discord.com/developers/docs/topics/teams#data-models-membership-state-enum */ -export enum MembershipState { - INVITED = 1, - ACCEPTED, -} diff --git a/src/types/webhook.ts b/src/types/webhook.ts deleted file mode 100644 index 6e4aaecfd..000000000 --- a/src/types/webhook.ts +++ /dev/null @@ -1,246 +0,0 @@ -import { AllowedMentions } from "./channel.ts"; -import { UserPayload } from "./guild.ts"; -import { InteractionType } from "./interactions.ts"; -import { Embed } from "./message.ts"; - -export interface WebhookPayload { - /** The id of the webhook */ - id: string; - /** The type of the webhook */ - type: WebhookType; - /** The guild id this webhook is for */ - "guild_id"?: string; - /** The channel id this webhook is for */ - "channel_id": string; - /** The user this webhook was created by(not returned when getting a webhook with its token) */ - user?: UserPayload; - /** The default name of the webhook */ - name?: string; - /** The default avatar of the webhook */ - avatar?: string; - /** The secure token of the webhook(returned for Incoming Webhooks) */ - token?: string; -} - -export enum WebhookType { - /** Incoming Webhooks can post messages to channels with a generated token */ - INCOMING = 1, - /** Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels */ - CHANNEL_FOLLOWER = 2, -} - -export interface WebhookCreateOptions { - /** Name of the webhook (1-80 characters) */ - name: string; - /** Image url for avatar image for the default webhook avatar */ - avatar?: string; -} - -export interface WebhookEditOptions { - /** Name of the webhook (1-80 characters) */ - name?: string; - /** Image url for avatar image for the default webhook avatar */ - avatar?: string | null; - /** The new channel id this webhook should be moved to */ - channelID?: string; -} - -export interface ExecuteWebhookOptions { - /** waits for server confirmation of message send before response, and returns the created message body (defaults to false; when false a message that is not saved does not return an error) */ - wait?: boolean; - /** the message contents (up to 2000 characters) */ - content?: string; - /** override the default username of the webhook */ - username?: string; - /** override the default avatar of the webhook*/ - "avatar_url"?: string; - /** true if this is a TTS message */ - tts?: boolean; - /** file contents the contents of the file being sent one of content, file, embeds */ - file?: { blob: Blob; name: string }; - /** array of up to 10 embed objects embedded rich content. */ - embeds?: Embed[]; - /** allowed mentions for the message */ - mentions?: { - /** An array of allowed mention types to parse from the content. */ - parse: ("roles" | "users" | "everyone")[]; - /** Array of role_ids to mention (Max size of 100) */ - roles?: string[]; - /** Array of user_ids to mention (Max size of 100) */ - users?: string[]; - }; -} - -export interface EditWebhookMessageOptions { - content?: string; - embeds?: Embed[]; - "allowed_mentions"?: AllowedMentions; -} - -export interface CreateSlashCommandOptions { - /** The name of the slash command. */ - name: string; - /** The description of the slash command. */ - description: string; - /** If a guildID is provided, this will be a GUILD command. If none is provided it will be a GLOBAL command. */ - guildID?: string; - /** The options for this command */ - options?: SlashCommandOption[]; -} - -export interface SlashCommand { - /** unique id of the command */ - id: string; - /** unique id of the parent application */ - "application_id": string; - /** 3-32 character name */ - name: string; - /** 1-100 character description */ - description: string; - /** the parameters for the command */ - options?: SlashCommandOption[]; -} - -export interface SlashCommandOption { - /** The type of option */ - type: SlashCommandOptionType; - /** 1-32 character name */ - name: string; - /** 1-100 character description*/ - description: string; - /** the first `required` option for the user to complete--only one option can be `default` */ - default?: boolean; - /** if the parameter is required or optional--default `false`*/ - required?: boolean; - /** - * If you specify `choices` for an option, they are the **only** valid values for a user to pick. - * choices for `string` and `int` types for the user to pick from - */ - choices?: SlashCommandOptionChoice[]; - /** if the option is a subcommand or subcommand group type, this nested options will be the parameters */ - options?: SlashCommandOption[]; -} - -export interface SlashCommandOptionChoice { - /** The name of the choice */ - name: string; - /** The value of the choice */ - value: string | number; -} - -export enum SlashCommandOptionType { - SUB_COMMAND = 1, - SUB_COMMAND_GROUP = 2, - STRING = 3, - INTEGER = 4, - BOOLEAN = 5, - USER = 6, - CHANNEL = 7, - ROLE = 8, -} - -export interface Interaction { - /** The id of the interaction */ - id: string; - /** The type of interaction */ - type: InteractionType; - /** The command data payload */ - data?: SlashCommandInteractionData; - /** The id of the guild it was sent from */ - "guild_id": string; - /** The id of the channel it was sent from */ - "channel_id": string; - /** The Payload of the member it was sent from */ - member: UserPayload; - /** The token for this interaction */ - token: string; -} - -export interface SlashCommandInteractionData { - /** The id of the command */ - id: string; - /** The name of the command */ - name: string; - /** the params and values from the user */ - options: SlashCommandInteractionDataOption[]; -} - -export interface SlashCommandInteractionDataOption { - /** The name of the parammeter */ - name: string; - /** The value of the pair */ - // deno-lint-ignore no-explicit-any - value?: any; - /** Present if this option is a group or subcommand */ - options?: SlashCommandInteractionDataOption[]; -} - -export interface InteractionResponse { - /** The type of response */ - type: InteractionResponseType; - /** The optional response message */ - data?: SlashCommandCallbackData; -} - -export interface SlashCommandCallbackData { - /** is the response TTS */ - tts?: boolean; - /** message content */ - content: string; - /** supports up to 10 embeds */ - embeds?: Embed[]; - /** allowed mentions for the message */ - "allowed_mentions"?: AllowedMentions; - /** acceptable values are message flags, set to 64 to make your response ephemeral */ - flags?: number; -} - -export enum InteractionResponseType { - /** ACK a `Ping` */ - PONG = 1, - /** Respond with a message, showing the user's input */ - CHANNEL_MESSAGE_WITH_SOURCE = 4, - /** ACK an interaction and edit to a response later, the user sees a loading state */ - DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE, -} - -// TODO: remove this interface for v11 -/** @deprecated Use `UpsertSlashCommandOptions` instead */ -export interface EditSlashCommandOptions { - /** 3-32 character command name */ - name: string; - /** 1-100 character description */ - description: string; - /** The parameters for the command */ - options?: SlashCommandOption[]; -} - -export interface SendInteractionResponseOptions { - type: InteractionResponseType; - data: SlashCommandCallbackData; -} - -export interface SlashCommandResponseOptions - extends SendInteractionResponseOptions { - /** Whether to make this response visible ONLY to the user who used this command. It will also be deleted after some time. */ - private?: boolean; -} - -export interface EditSlashResponseOptions extends SlashCommandCallbackData { - /** If this is not provided, it will default to editing the original response. */ - messageID?: string; -} - -export interface UpsertSlashCommandOptions { - /** 1-32 character name matching ^[\w-]{1,32}$ */ - name?: string; - /** 1-100 character description */ - description?: string; - /** The parameters for the command */ - options?: SlashCommandOption[] | null; -} - -export interface UpsertSlashCommandsOptions extends UpsertSlashCommandOptions { - /** The id of the command */ - id: string; -} diff --git a/src/util/permissions.ts b/src/util/permissions.ts index 8d632f555..4a4e31376 100644 --- a/src/util/permissions.ts +++ b/src/util/permissions.ts @@ -1,7 +1,6 @@ import { botID } from "../bot.ts"; import { cacheHandlers } from "../cache.ts"; import { Channel, Guild, Member, Role } from "../structures/mod.ts"; -import { Errors, Permission, Permissions } from "../types/mod.ts"; async function getCached( table: "guilds", diff --git a/src/util/utils.ts b/src/util/utils.ts index 8f435a46f..d65febec9 100644 --- a/src/util/utils.ts +++ b/src/util/utils.ts @@ -1,15 +1,4 @@ import { encode } from "../../deps.ts"; -import { - Errors, - GatewayOpcode, - GatewayStatusUpdatePayload, - ImageFormats, - ImageSize, - SlashCommandOption, - SlashCommandOptionChoice, - SlashCommandOptionType, - UpsertSlashCommandOptions, -} from "../types/mod.ts"; import { basicShards, sendWS } from "../ws/shard.ts"; import { SLASH_COMMANDS_NAME_REGEX } from "./constants.ts"; diff --git a/src/ws/shard.ts b/src/ws/shard.ts index a384d72f5..79a45a465 100644 --- a/src/ws/shard.ts +++ b/src/ws/shard.ts @@ -1,13 +1,4 @@ import { botGatewayData, eventHandlers, proxyWSURL } from "../bot.ts"; -import { - DiscordBotGatewayData, - DiscordHeartbeatPayload, - DiscordIdentify, - DiscordPayload, - FetchMembersOptions, - GatewayOpcode, - ReadyPayload, -} from "../types/mod.ts"; import { Collection } from "../util/collection.ts"; import { delay } from "../util/utils.ts"; import { decompressWith } from "./deps.ts"; @@ -19,24 +10,6 @@ const utf8decoder = new TextDecoder(); const RequestMembersQueue: RequestMemberQueuedRequest[] = []; let processQueue = false; -export interface BasicShard { - id: number; - ws: WebSocket; - resumeInterval: number; - sessionID: string; - previousSequenceNumber: number | null; - needToResume: boolean; - ready: boolean; - unavailableGuildIDs: Set; -} - -interface RequestMemberQueuedRequest { - guildID: string; - shardID: number; - nonce: string; - options?: FetchMembersOptions; -} - export function createShard( data: DiscordBotGatewayData, identifyPayload: DiscordIdentify, diff --git a/src/ws/shard_manager.ts b/src/ws/shard_manager.ts index a6e991c40..d9902e2a6 100644 --- a/src/ws/shard_manager.ts +++ b/src/ws/shard_manager.ts @@ -2,13 +2,6 @@ import { eventHandlers } from "../bot.ts"; import { cache } from "../cache.ts"; import { handlers } from "../handlers/mod.ts"; import { Member } from "../structures/mod.ts"; -import { - DiscordBotGatewayData, - DiscordIdentify, - DiscordPayload, - FetchMembersOptions, - GatewayOpcode, -} from "../types/mod.ts"; import { Collection } from "../util/collection.ts"; import { delay } from "../util/utils.ts"; import { createShard, requestGuildMembers } from "./mod.ts";