diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 99e1a8ca6..f1ab551df 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @ayntee @Skillz4Killz @itohatweb +* @Skillz4Killz @itohatweb diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 96406d251..f7e3a5591 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ jobs: - name: Cache dependencies run: deno cache --no-check mod.ts - name: Run test script for maintainers - if: ${{ github.actor == 'ayntee' || github.actor == 'Skillz4Killz' || github.actor == 'itohatweb' }} + if: ${{ github.actor == 'Skillz4Killz' || github.actor == 'itohatweb' }} run: deno test --unstable --coverage=coverage -A --no-check tests/mod.ts - name: Run test script if label added if: ${{ github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'run-tests' }} diff --git a/mod.ts b/mod.ts index a3f729ec0..c56b93ff0 100644 --- a/mod.ts +++ b/mod.ts @@ -6,6 +6,7 @@ export * from "./src/rest/mod.ts"; export * from "./src/structures/channel.ts"; export * from "./src/structures/guild.ts"; 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"; diff --git a/src/bot.ts b/src/bot.ts index b077dbfc0..c36939832 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -65,31 +65,42 @@ export function setApplicationId(id: string) { * * Advanced Devs: This function will allow you to have an insane amount of customization potential as when you get to large bots you need to be able to optimize every tiny detail to make you bot work the way you need. */ -export async function startBigBrainBot(data: BigBrainBotConfig) { - if (data.secretKey) secretKey = data.secretKey; - if (data.restURL) baseEndpoints.BASE_URL = data.restURL; - if (data.cdnURL) baseEndpoints.CDN_URL = data.cdnURL; - if (data.eventHandlers) eventHandlers = data.eventHandlers; - if (data.compress) { - ws.identifyPayload.compress = data.compress; - } +export async function startBigBrainBot(options: BigBrainBotConfig) { + rest.token = `Bot ${options.token}`; - ws.identifyPayload.intents = data.intents.reduce( - ( - bits, - next, - ) => (bits |= typeof next === "string" - ? DiscordGatewayIntents[next] - : next), - 0, - ); + if (options.secretKey) secretKey = options.secretKey; + if (options.restURL) baseEndpoints.BASE_URL = options.restURL; + if (options.cdnURL) baseEndpoints.CDN_URL = options.cdnURL; + if (options.eventHandlers) eventHandlers = options.eventHandlers; // PROXY DOESNT NEED US SPAWNING SHARDS - if (!data.wsPort) { + if (!options.wsPort) { + ws.identifyPayload.token = `Bot ${options.token}`; + + if (options.compress) { + ws.identifyPayload.compress = options.compress; + } + + ws.identifyPayload.intents = options.intents.reduce( + ( + bits, + next, + ) => (bits |= typeof next === "string" + ? DiscordGatewayIntents[next] + : next), + 0, + ); + // Initial API connection to get info about bots connection ws.botGatewayData = await getGatewayBot(); + ws.maxShards = ws.maxShards || + ws.botGatewayData.shards; + ws.lastShardId = options.lastShardId || ws.botGatewayData.shards; + // Explicitly append gateway version and encoding + ws.botGatewayData.url += `?v=${GATEWAY_VERSION}&encoding=json`; proxyWSURL = ws.botGatewayData.url; - ws.spawnShards(data.firstShardId); + + ws.spawnShards(options.firstShardId); } } @@ -105,6 +116,8 @@ export interface BigBrainBotConfig extends BotConfig { firstShardId: number; /** The last shard to start for this worker. By default it will be 25 + the firstShardId. */ lastShardId?: number; + /** The maximum shard Id number. Useful for zero-downtime updates or resharding. */ + maxShards?: number; /** This can be used to forward the ws handling to a proxy. It will disable the sharding done by the bot side. */ wsPort?: number; /** This can be used to forward the REST handling to a proxy. */ diff --git a/src/handlers/voice/VOICE_STATE_UPDATE.ts b/src/handlers/voice/VOICE_STATE_UPDATE.ts index e5915d28e..127d9619f 100644 --- a/src/handlers/voice/VOICE_STATE_UPDATE.ts +++ b/src/handlers/voice/VOICE_STATE_UPDATE.ts @@ -2,16 +2,11 @@ import { eventHandlers } from "../../bot.ts"; import { cacheHandlers } from "../../cache.ts"; import { structures } from "../../structures/mod.ts"; import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; -import { - DiscordVoiceState, - VoiceState, -} from "../../types/voice/voice_state.ts"; -import { snakeKeysToCamelCase } from "../../util/utils.ts"; +import { VoiceState } from "../../types/voice/voice_state.ts"; export async function handleVoiceStateUpdate(data: DiscordGatewayPayload) { - const payload = snakeKeysToCamelCase( - data.d as DiscordVoiceState, - ); + const payload = data.d as VoiceState; + if (!payload.guildId) return; const guild = await cacheHandlers.get("guilds", payload.guildId); diff --git a/src/helpers/channels/clone_channel.ts b/src/helpers/channels/clone_channel.ts index 76ca0a7b0..e84e039e0 100644 --- a/src/helpers/channels/clone_channel.ts +++ b/src/helpers/channels/clone_channel.ts @@ -29,8 +29,8 @@ export async function cloneChannel(channelId: string, reason?: string) { ) => ({ id: overwrite.id, type: overwrite.type, - allow: calculatePermissions(BigInt(overwrite.allow)), - deny: calculatePermissions(BigInt(overwrite.deny)), + allow: calculatePermissions(overwrite.allow), + deny: calculatePermissions(overwrite.deny), })), }; diff --git a/src/helpers/commands/batch_edit_slash_command_permissions.ts b/src/helpers/commands/batch_edit_slash_command_permissions.ts new file mode 100644 index 000000000..514b546b7 --- /dev/null +++ b/src/helpers/commands/batch_edit_slash_command_permissions.ts @@ -0,0 +1,17 @@ +import { applicationId } from "../../bot.ts"; +import { rest } from "../../rest/rest.ts"; +import { ApplicationCommandPermissions } from "../../types/interactions/application_command_permissions.ts"; +import { endpoints } from "../../util/constants.ts"; +import { camelKeysToSnakeCase } from "../../util/utils.ts"; + +/** Batch edits permissions for all commands in a guild. Takes an array of partial GuildApplicationCommandPermissions objects including `id` and `permissions`. */ +export async function batchEditSlashCommandPermissions( + guildId: string, + options: { id: string; permissions: ApplicationCommandPermissions[] }[], +) { + return await rest.runMethod( + "put", + endpoints.COMMANDS_PERMISSIONS(applicationId, guildId), + camelKeysToSnakeCase(options), + ); +} diff --git a/src/helpers/commands/create_slash_command.ts b/src/helpers/commands/create_slash_command.ts index 2da719f56..c756570e5 100644 --- a/src/helpers/commands/create_slash_command.ts +++ b/src/helpers/commands/create_slash_command.ts @@ -21,7 +21,7 @@ import { */ export async function createSlashCommand( options: CreateGlobalApplicationCommand, - guildId: string, + guildId?: string, ) { validateSlashCommands([options], true); diff --git a/src/helpers/commands/edit_slash_command_permissions.ts b/src/helpers/commands/edit_slash_command_permissions.ts new file mode 100644 index 000000000..1ea764d8a --- /dev/null +++ b/src/helpers/commands/edit_slash_command_permissions.ts @@ -0,0 +1,18 @@ +import { applicationId } from "../../bot.ts"; +import { rest } from "../../rest/rest.ts"; +import { ApplicationCommandPermissions } from "../../types/interactions/application_command_permissions.ts"; +import { endpoints } from "../../util/constants.ts"; +import { camelKeysToSnakeCase } from "../../util/utils.ts"; + +/** Edits command permissions for a specific command for your application in a guild. */ +export async function editSlashCommandPermissions( + guildId: string, + commandId: string, + options: ApplicationCommandPermissions[], +) { + return await rest.runMethod( + "put", + endpoints.COMMANDS_PERMISSION(applicationId, guildId, commandId), + { permissions: camelKeysToSnakeCase(options) }, + ); +} diff --git a/src/helpers/commands/get_slash_command_permission.ts b/src/helpers/commands/get_slash_command_permission.ts new file mode 100644 index 000000000..f34362b9f --- /dev/null +++ b/src/helpers/commands/get_slash_command_permission.ts @@ -0,0 +1,15 @@ +import { applicationId } from "../../bot.ts"; +import { rest } from "../../rest/rest.ts"; +import { GuildApplicationCommandPermissions } from "../../types/interactions/guild_application_command_permissions.ts"; +import { endpoints } from "../../util/constants.ts"; + +/** Fetches command permissions for a specific command for your application in a guild. Returns a GuildApplicationCommandPermissions object. */ +export async function getSlashCommandPermission( + guildId: string, + commandId: string, +) { + return await rest.runMethod( + "get", + endpoints.COMMANDS_PERMISSION(applicationId, guildId, commandId), + ); +} diff --git a/src/helpers/commands/get_slash_command_permissions.ts b/src/helpers/commands/get_slash_command_permissions.ts new file mode 100644 index 000000000..4d69204bf --- /dev/null +++ b/src/helpers/commands/get_slash_command_permissions.ts @@ -0,0 +1,12 @@ +import { applicationId } from "../../bot.ts"; +import { rest } from "../../rest/rest.ts"; +import { GuildApplicationCommandPermissions } from "../../types/interactions/guild_application_command_permissions.ts"; +import { endpoints } from "../../util/constants.ts"; + +/** Fetches command permissions for all commands for your application in a guild. Returns an array of GuildApplicationCommandPermissions objects. */ +export async function getSlashCommandPermissions(guildId: string) { + return await rest.runMethod( + "get", + endpoints.COMMANDS_PERMISSIONS(applicationId, guildId), + ); +} diff --git a/src/helpers/discovery/valid_discovery_term.ts b/src/helpers/discovery/valid_discovery_term.ts index 824af8528..5a96016af 100644 --- a/src/helpers/discovery/valid_discovery_term.ts +++ b/src/helpers/discovery/valid_discovery_term.ts @@ -1,9 +1,9 @@ import { rest } from "../../rest/rest.ts"; -import { DiscordValidateDiscoverySearchTerm } from "../../types/discovery/validate_discovery_search_term.ts"; +import { ValidateDiscoverySearchTerm } from "../../types/discovery/validate_discovery_search_term.ts"; import { endpoints } from "../../util/constants.ts"; export async function validDiscoveryTerm(term: string) { - const result = await rest.runMethod( + const result = await rest.runMethod( "get", endpoints.DISCOVERY_VALID_TERM, { term }, diff --git a/src/helpers/guilds/delete_server.ts b/src/helpers/guilds/delete_guild.ts similarity index 68% rename from src/helpers/guilds/delete_server.ts rename to src/helpers/guilds/delete_guild.ts index 8dcf42eaf..496ac3088 100644 --- a/src/helpers/guilds/delete_server.ts +++ b/src/helpers/guilds/delete_guild.ts @@ -1,9 +1,8 @@ import { rest } from "../../rest/rest.ts"; import { endpoints } from "../../util/constants.ts"; -/** Delete a guild permanently. User must be owner. Returns 204 No Content on success. Fires a Guild Delete Gateway event. - */ -export async function deleteServer(guildId: string) { +/** Delete a guild permanently. User must be owner. Returns 204 No Content on success. Fires a Guild Delete Gateway event. */ +export async function deleteGuild(guildId: string) { return await rest.runMethod( "delete", endpoints.GUILDS_BASE(guildId), diff --git a/src/helpers/guilds/get_widget.ts b/src/helpers/guilds/get_widget.ts index 2e5b4d84a..ed9450510 100644 --- a/src/helpers/guilds/get_widget.ts +++ b/src/helpers/guilds/get_widget.ts @@ -12,5 +12,5 @@ export async function getWidget(guildId: string, options?: { force: boolean }) { if (!guild?.widgetEnabled) throw new Error(Errors.GUILD_WIDGET_NOT_ENABLED); } - return await rest.runMethod("get", `${endpoints.GUILD_WIDGET(guildId)}.json`) as GuildWidgetDetails; + return await rest.runMethod("get", `${endpoints.GUILD_WIDGET(guildId)}.json`); } diff --git a/src/helpers/members/fetch_members.ts b/src/helpers/members/fetch_members.ts index 9a0428aad..aee4ed00c 100644 --- a/src/helpers/members/fetch_members.ts +++ b/src/helpers/members/fetch_members.ts @@ -1,8 +1,11 @@ +import { cache } from "../../cache.ts"; import { DiscordenoMember } from "../../structures/member.ts"; +import { DiscordGatewayOpcodes } from "../../types/codes/gateway_opcodes.ts"; import { DiscordGatewayIntents } from "../../types/gateway/gateway_intents.ts"; -import { RequestGuildMembers } from "../../types/guilds/request_guild_members.ts"; +import type { RequestGuildMembers } from "../../types/guilds/request_guild_members.ts"; import { Errors } from "../../types/misc/errors.ts"; import { Collection } from "../../util/collection.ts"; +import { sendShardMessage } from "../../ws/send_shard_message.ts"; import { ws } from "../../ws/ws.ts"; /** @@ -16,12 +19,12 @@ import { ws } from "../../ws/ws.ts"; export function fetchMembers( guildId: string, shardId: number, - options?: RequestGuildMembers, + options?: Omit, ) { // You can request 1 member without the intent if ( (!options?.limit || options.limit > 1) && - !(ws.identifyPayload.intents && DiscordGatewayIntents.GUILD_MEMBERS) + !(ws.identifyPayload.intents & DiscordGatewayIntents.GUILD_MEMBERS) ) { throw new Error(Errors.MISSING_INTENT_GUILD_MEMBERS); } @@ -31,21 +34,20 @@ export function fetchMembers( } return new Promise((resolve) => { - return requestAllMembers(guildId, shardId, resolve, options); + const nonce = `${guildId}-${Date.now()}`; + cache.fetchAllMembersProcessingRequests.set(nonce, resolve); + + sendShardMessage(shardId, { + op: DiscordGatewayOpcodes.RequestGuildMembers, + d: { + guild_id: guildId, + // If a query is provided use it, OR if a limit is NOT provided use "" + query: options?.query || (options?.limit ? undefined : ""), + limit: options?.limit || 0, + presences: options?.presences || false, + user_ids: options?.userIds, + nonce, + }, + }); }) as Promise>; } - -// TODO: finish implementing this -function requestAllMembers( - _guildId: string, - _shardId: number, - _resolve: ( - value: - | Collection - | PromiseLike>, - ) => void, - // deno-lint-ignore no-explicit-any - _options: any, -): void { - throw new Error("Function not implemented."); -} diff --git a/src/helpers/members/get_members.ts b/src/helpers/members/get_members.ts index b51fff45a..202c4a70d 100644 --- a/src/helpers/members/get_members.ts +++ b/src/helpers/members/get_members.ts @@ -19,7 +19,10 @@ import { ws } from "../../ws/ws.ts"; * REST(this function): 50/s global(across all shards) rate limit with ALL requests this included * GW(fetchMembers): 120/m(PER shard) rate limit. Meaning if you have 8 shards your limit is 960/m. */ -export async function getMembers(guildId: string, options?: ListGuildMembers) { +export async function getMembers( + guildId: string, + options?: ListGuildMembers & { addToCache?: boolean }, +) { if (!(ws.identifyPayload.intents && DiscordGatewayIntents.GUILD_MEMBERS)) { throw new Error(Errors.MISSING_INTENT_GUILD_MEMBERS); } @@ -61,11 +64,13 @@ export async function getMembers(guildId: string, options?: ListGuildMembers) { guildId, ); - await cacheHandlers.set( - "members", - discordenoMember.id, - discordenoMember, - ); + if (options?.addToCache !== false) { + await cacheHandlers.set( + "members", + discordenoMember.id, + discordenoMember, + ); + } return discordenoMember; }), diff --git a/src/helpers/members/get_members_by_query.ts b/src/helpers/members/get_members_by_query.ts deleted file mode 100644 index f0bd9b126..000000000 --- a/src/helpers/members/get_members_by_query.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { cacheHandlers } from "../../cache.ts"; -import { DiscordenoMember } from "../../structures/member.ts"; -import { Collection } from "../../util/collection.ts"; - -/** Returns guild member objects for the specified user by their nickname/username. - * - * ⚠️ **ADVANCED USE ONLY: Your members will be cached in your guild most likely. Only use this when you are absolutely sure the member is not cached.** - */ -export async function getMembersByQuery( - guildId: string, - name: string, - limit = 1, -) { - const guild = await cacheHandlers.get("guilds", guildId); - if (!guild) return; - - return new Promise((resolve) => { - return requestAllMembers(guild.id, guild.shardId, resolve, { - query: name, - limit, - }); - }) as Promise>; -} - -// TODO: implement this -function requestAllMembers( - _id: string, - _shardId: number, - _resolve: ( - value: - | Collection - | PromiseLike>, - ) => void, - _arg3: { query: string; limit: number }, -): void { - throw new Error("Function not implemented."); -} diff --git a/src/helpers/messages/remove_reaction.ts b/src/helpers/messages/remove_reaction.ts index b8bd2f707..36866d010 100644 --- a/src/helpers/messages/remove_reaction.ts +++ b/src/helpers/messages/remove_reaction.ts @@ -1,12 +1,18 @@ import { rest } from "../../rest/rest.ts"; import { endpoints } from "../../util/constants.ts"; +import { requireBotChannelPermissions } from "../../util/permissions.ts"; -/** Removes a reaction from the bot on this message. Reaction takes the form of **name:id** for custom guild emoji, or Unicode characters. */ +/** Removes a reaction from the given user on this message, defaults to bot. Reaction takes the form of **name:id** for custom guild emoji, or Unicode characters. */ export async function removeReaction( channelId: string, messageId: string, reaction: string, + options?: { userId?: string }, ) { + if (options?.userId) { + await requireBotChannelPermissions(channelId, ["MANAGE_MESSAGES"]); + } + if (reaction.startsWith("<:")) { reaction = reaction.substring(2, reaction.length - 1); } else if (reaction.startsWith("( "delete", - endpoints.CHANNEL_MESSAGE_REACTION_ME(channelId, messageId, reaction), + options?.userId + ? endpoints.CHANNEL_MESSAGE_REACTION_USER( + channelId, + messageId, + reaction, + options.userId, + ) + : endpoints.CHANNEL_MESSAGE_REACTION_ME(channelId, messageId, reaction), ); } diff --git a/src/helpers/messages/remove_user_reaction.ts b/src/helpers/messages/remove_user_reaction.ts deleted file mode 100644 index 7f5b67dfd..000000000 --- a/src/helpers/messages/remove_user_reaction.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { rest } from "../../rest/rest.ts"; -import { endpoints } from "../../util/constants.ts"; -import { requireBotChannelPermissions } from "../../util/permissions.ts"; - -/** Removes a reaction from the specified user on this message. Reaction takes the form of **name:id** for custom guild emoji, or Unicode characters. */ -export async function removeUserReaction( - channelId: string, - messageId: string, - reaction: string, - userId: string, -) { - await requireBotChannelPermissions(channelId, ["MANAGE_MESSAGES"]); - - if (reaction.startsWith("<:")) { - reaction = reaction.substring(2, reaction.length - 1); - } else if (reaction.startsWith("( - "delete", - endpoints.CHANNEL_MESSAGE_REACTION_USER( - channelId, - messageId, - reaction, - userId, - ), - ); -} diff --git a/src/helpers/messages/send_message.ts b/src/helpers/messages/send_message.ts index a15e97881..331c69560 100644 --- a/src/helpers/messages/send_message.ts +++ b/src/helpers/messages/send_message.ts @@ -5,7 +5,7 @@ import { DiscordChannelTypes } from "../../types/channels/channel_types.ts"; import { DiscordAllowedMentionsTypes } from "../../types/messages/allowed_mentions_types.ts"; import { ButtonStyles } from "../../types/messages/components/button_styles.ts"; import { CreateMessage } from "../../types/messages/create_message.ts"; -import { DiscordMessage, Message } from "../../types/messages/message.ts"; +import { Message } from "../../types/messages/message.ts"; import { Errors } from "../../types/misc/errors.ts"; import { PermissionStrings } from "../../types/permissions/permission_strings.ts"; import { endpoints } from "../../util/constants.ts"; @@ -153,7 +153,7 @@ export async function sendMessage( const result = await rest.runMethod( "post", endpoints.CHANNEL_MESSAGES(channelId), - camelKeysToSnakeCase({ + camelKeysToSnakeCase({ ...content, ...(content.messageReference?.messageId ? { diff --git a/src/helpers/misc/edit_bot_status.ts b/src/helpers/misc/edit_bot_status.ts index 35e09c6bc..bfed6b0bc 100644 --- a/src/helpers/misc/edit_bot_status.ts +++ b/src/helpers/misc/edit_bot_status.ts @@ -1,6 +1,7 @@ import { eventHandlers } from "../../bot.ts"; import { DiscordGatewayOpcodes } from "../../types/codes/gateway_opcodes.ts"; import type { StatusUpdate } from "../../types/gateway/status_update.ts"; +import { sendShardMessage } from "../../ws/send_shard_message.ts"; import { ws } from "../../ws/ws.ts"; export function editBotStatus(data: Omit) { @@ -10,7 +11,7 @@ export function editBotStatus(data: Omit) { `Running forEach loop in editBotStatus function.`, ); - shard.queue.push({ + sendShardMessage(shard, { op: DiscordGatewayOpcodes.StatusUpdate, d: { since: null, @@ -18,6 +19,5 @@ export function editBotStatus(data: Omit) { ...data, }, }); - ws.processQueue(shard.id); }); } diff --git a/src/helpers/mod.ts b/src/helpers/mod.ts index 22799a964..483f7378f 100644 --- a/src/helpers/mod.ts +++ b/src/helpers/mod.ts @@ -13,15 +13,24 @@ import { getPins } from "./channels/get_pins.ts"; import { isChannelSynced } from "./channels/is_channel_synced.ts"; import { startTyping } from "./channels/start_typing.ts"; import { swapChannels } from "./channels/swap_channels.ts"; +import { batchEditSlashCommandPermissions } from "./commands/batch_edit_slash_command_permissions.ts"; import { createSlashCommand } from "./commands/create_slash_command.ts"; import { deleteSlashCommand } from "./commands/delete_slash_command.ts"; import { deleteSlashResponse } from "./commands/delete_slash_response.ts"; +import { editSlashCommandPermissions } from "./commands/edit_slash_command_permissions.ts"; import { editSlashResponse } from "./commands/edit_slash_response.ts"; import { getSlashCommand } from "./commands/get_slash_command.ts"; import { getSlashCommands } from "./commands/get_slash_commands.ts"; +import { getSlashCommandPermission } from "./commands/get_slash_command_permission.ts"; +import { getSlashCommandPermissions } from "./commands/get_slash_command_permissions.ts"; import { sendInteractionResponse } from "./commands/send_interaction_response.ts"; import { upsertSlashCommand } from "./commands/upsert_slash_command.ts"; import { upsertSlashCommands } from "./commands/upsert_slash_commands.ts"; +import { addDiscoverySubcategory } from "./discovery/add_discovery_subcategory.ts"; +import { editDiscovery } from "./discovery/edit_discovery.ts"; +import { getDiscoveryCategories } from "./discovery/get_discovery_categories.ts"; +import { removeDiscoverySubcategory } from "./discovery/remove_discovery_subcategory.ts"; +import { validDiscoveryTerm } from "./discovery/valid_discovery_term.ts"; import { createEmoji } from "./emojis/create_emoji.ts"; import { deleteEmoji } from "./emojis/delete_emoji.ts"; import { editEmoji } from "./emojis/edit_emoji.ts"; @@ -29,7 +38,7 @@ import { emojiURL } from "./emojis/emoji_url.ts"; import { getEmoji } from "./emojis/get_emoji.ts"; import { getEmojis } from "./emojis/get_emojis.ts"; import { createGuild } from "./guilds/create_guild.ts"; -import { deleteServer } from "./guilds/delete_server.ts"; +import { deleteGuild } from "./guilds/delete_guild.ts"; import { editGuild } from "./guilds/edit_guild.ts"; import { editWelcomeScreen } from "./guilds/edit_welcome_screen.ts"; import { editWidget } from "./guilds/edit_widget.ts"; @@ -66,7 +75,6 @@ import { editMember } from "./members/edit_member.ts"; import { fetchMembers } from "./members/fetch_members.ts"; import { getMember } from "./members/get_member.ts"; import { getMembers } from "./members/get_members.ts"; -import { getMembersByQuery } from "./members/get_members_by_query.ts"; import { kick, kickMember } from "./members/kick_member.ts"; import { moveMember } from "./members/move_member.ts"; import { pruneMembers } from "./members/prune_members.ts"; @@ -85,7 +93,6 @@ import { publishMessage } from "./messages/publish_message.ts"; import { removeAllReactions } from "./messages/remove_all_reactions.ts"; import { removeReaction } from "./messages/remove_reaction.ts"; import { removeReactionEmoji } from "./messages/remove_reaction_emoji.ts"; -import { removeUserReaction } from "./messages/remove_user_reaction.ts"; import { sendMessage } from "./messages/send_message.ts"; import { unpin, unpinMessage } from "./messages/unpin_message.ts"; import { editBotStatus } from "./misc/edit_bot_status.ts"; @@ -115,11 +122,6 @@ import { executeWebhook } from "./webhooks/execute_webhook.ts"; import { getWebhook } from "./webhooks/get_webhook.ts"; import { getWebhooks } from "./webhooks/get_webhooks.ts"; import { getWebhookWithToken } from "./webhooks/get_webhook_with_token.ts"; -import { addDiscoverySubcategory } from "./discovery/add_discovery_subcategory.ts"; -import { editDiscovery } from "./discovery/edit_discovery.ts"; -import { getDiscoveryCategories } from "./discovery/get_discovery_categories.ts"; -import { removeDiscoverySubcategory } from "./discovery/remove_discovery_subcategory.ts"; -import { validDiscoveryTerm } from "./discovery/valid_discovery_term.ts"; export { addDiscoverySubcategory, @@ -129,6 +131,7 @@ export { avatarURL, ban, banMember, + batchEditSlashCommandPermissions, categoryChildren, channelOverwriteHasPermission, createChannel, @@ -143,13 +146,13 @@ export { deleteChannel, deleteChannelOverwrite, deleteEmoji, + deleteGuild, deleteGuildTemplate, deleteIntegration, deleteInvite, deleteMessage, deleteMessages, deleteRole, - deleteServer, deleteSlashCommand, deleteSlashResponse, deleteWebhook, @@ -198,7 +201,6 @@ export { getInvites, getMember, getMembers, - getMembersByQuery, getMessage, getMessages, getPins, @@ -206,6 +208,8 @@ export { getReactions, getRoles, getSlashCommand, + getSlashCommandPermission, + getSlashCommandPermissions, getSlashCommands, getTemplate, getUser, @@ -235,7 +239,6 @@ export { removeReaction, removeReactionEmoji, removeRole, - removeUserReaction, sendDirectMessage, sendInteractionResponse, sendMessage, @@ -272,6 +275,10 @@ export let helpers = { deleteSlashCommand, deleteSlashResponse, editSlashResponse, + getSlashCommandPermission, + getSlashCommandPermissions, + batchEditSlashCommandPermissions, + editSlashCommandPermissions, sendInteractionResponse, getSlashCommand, getSlashCommands, @@ -286,7 +293,7 @@ export let helpers = { // guilds categoryChildren, createGuild, - deleteServer, + deleteGuild, editGuild, editWidget, editWelcomeScreen, @@ -332,7 +339,6 @@ export let helpers = { editMember, fetchMembers, getMember, - getMembersByQuery, getMembers, kickMember, moveMember, @@ -353,7 +359,6 @@ export let helpers = { removeAllReactions, removeReactionEmoji, removeReaction, - removeUserReaction, sendMessage, unpinMessage, // misc diff --git a/src/structures/guild.ts b/src/structures/guild.ts index 4dda13665..562440c25 100644 --- a/src/structures/guild.ts +++ b/src/structures/guild.ts @@ -1,6 +1,6 @@ import { botId, eventHandlers } from "../bot.ts"; import { cache, cacheHandlers } from "../cache.ts"; -import { deleteServer } from "../helpers/guilds/delete_server.ts"; +import { deleteGuild } from "../helpers/guilds/delete_guild.ts"; import { editGuild } from "../helpers/guilds/edit_guild.ts"; import { getAuditLogs } from "../helpers/guilds/get_audit_logs.ts"; import { getBan } from "../helpers/guilds/get_ban.ts"; @@ -79,7 +79,7 @@ const baseGuild: Partial = { return guildSplashURL(this.id!, this.splash!, size, format); }, delete() { - return deleteServer(this.id!); + return deleteGuild(this.id!); }, edit(options) { return editGuild(this.id!, options); @@ -272,7 +272,7 @@ export interface DiscordenoGuild extends format?: DiscordImageFormat, ): string | undefined; /** Delete a guild permanently. User must be owner. Returns 204 No Content on success. Fires a Guild Delete Gateway event. */ - delete(): ReturnType; + delete(): ReturnType; /** Leave a guild */ leave(): ReturnType; /** Edit the server. Requires the MANAGE_GUILD permission. */ diff --git a/src/structures/message.ts b/src/structures/message.ts index 033ee223a..014e6ea37 100644 --- a/src/structures/message.ts +++ b/src/structures/message.ts @@ -121,8 +121,8 @@ const baseMessage: Partial = { removeReactionEmoji(reaction) { return removeReactionEmoji(this.channelId!, this.id!, reaction); }, - removeReaction(reaction) { - return removeReaction(this.channelId!, this.id!, reaction); + removeReaction(reaction, userId) { + return removeReaction(this.channelId!, this.id!, reaction, { userId }); }, }; @@ -155,6 +155,7 @@ export async function createDiscordenoMessage(data: Message) { ...props, /** The message id of the original message if this message was sent as a reply. If null, the original message was deleted. */ channelId: createNewProp(channelId), + content: createNewProp(data.content || ""), guildId: createNewProp(guildIdFinal), mentionedUserIds: createNewProp(mentions.map((m) => m.id)), mentionedRoleIds: createNewProp(mentionRoles), @@ -177,8 +178,12 @@ export async function createDiscordenoMessage(data: Message) { } export interface DiscordenoMessage - extends Omit { + extends Omit { // For better user experience + /** Id of the guild which the massage has been send in. Empty string if it a DM */ + guildId: string; + /** The message content for this message. Empty string if no content was sent like an attachment only. */ + content: string; /** Ids of users specifically mentioned in the message */ mentionedUserIds: string[]; /** Ids of roles specifically mentioned in this message */ @@ -245,10 +250,13 @@ export interface DiscordenoMessage timeout?: number, reason?: string, ): Promise; - /** Remove all reactions */ + /** Removes all reactions for all emojis on this message */ removeAllReactions(): ReturnType; - /** Remove all reactions */ + /** Removes all reactions for a single emoji on this message */ removeReactionEmoji(reaction: string): ReturnType; - /** Remove all reactions */ - removeReaction(reaction: string): ReturnType; + /** Removes a reaction from the given user on this message, defaults to bot */ + removeReaction( + reaction: string, + userId?: string, + ): ReturnType; } diff --git a/src/types/audit_log/audit_log.ts b/src/types/audit_log/audit_log.ts index bc335f694..41ccff42b 100644 --- a/src/types/audit_log/audit_log.ts +++ b/src/types/audit_log/audit_log.ts @@ -1,9 +1,9 @@ import { Integration } from "../integration/integration.ts"; import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { Webhook } from "../webhooks/webhook.ts"; import { AuditLogEntry } from "./audit_log_entry.ts"; +/** https://discord.com/developers/docs/resources/audit-log#audit-log-object */ export interface AuditLog { /** List of webhooks found in the audit log */ webhooks: Webhook[]; @@ -14,6 +14,3 @@ export interface AuditLog { /** List of partial integration objects */ integrations: Partial[]; } - -/** https://discord.com/developers/docs/resources/audit-log#audit-log-object */ -export type DiscordAuditLog = SnakeCasedPropertiesDeep; diff --git a/src/types/audit_log/audit_log_change.ts b/src/types/audit_log/audit_log_change.ts index 55e3b7a19..7ded886b4 100644 --- a/src/types/audit_log/audit_log_change.ts +++ b/src/types/audit_log/audit_log_change.ts @@ -1,6 +1,6 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { AuditLogChangeValue } from "./audit_log_change_value.ts"; +/** https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure */ export interface AuditLogChange { /** New value of the key */ newValue?: AuditLogChangeValue; @@ -9,6 +9,3 @@ export interface AuditLogChange { /** 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 DiscordAuditLogChange = SnakeCasedPropertiesDeep; diff --git a/src/types/audit_log/audit_log_change_value.ts b/src/types/audit_log/audit_log_change_value.ts index c1372004c..6a779b2c1 100644 --- a/src/types/audit_log/audit_log_change_value.ts +++ b/src/types/audit_log/audit_log_change_value.ts @@ -1,7 +1,7 @@ import { Overwrite } from "../channels/overwrite.ts"; import { Role } from "../permissions/role.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure */ export type AuditLogChangeValue = | { newValue: string; @@ -83,8 +83,3 @@ export type AuditLogChangeValue = oldValue: string | number; key: "type"; }; - -/** https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure */ -export type DiscordAuditLogChangeValue = SnakeCasedPropertiesDeep< - AuditLogChangeValue ->; diff --git a/src/types/audit_log/audit_log_entry.ts b/src/types/audit_log/audit_log_entry.ts index 9b804d1f1..ee85ed25d 100644 --- a/src/types/audit_log/audit_log_entry.ts +++ b/src/types/audit_log/audit_log_entry.ts @@ -1,8 +1,8 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { AuditLogChange } from "./audit_log_change.ts"; import { DiscordAuditLogEvents } from "./audit_log_events.ts"; import { OptionalAuditEntryInfo } from "./optional_audit_entry_info.ts"; +/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure */ export interface AuditLogEntry { /** id of the affected entity (webhook, user, role, etc.) */ targetId: string | null; @@ -19,6 +19,3 @@ export interface AuditLogEntry { /** The reason for the change (0-512 characters) */ reason?: string; } - -/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure */ -export type DiscordAuditLogEntry = SnakeCasedPropertiesDeep; diff --git a/src/types/audit_log/audit_log_events.ts b/src/types/audit_log/audit_log_events.ts index c1c000254..0620c1465 100644 --- a/src/types/audit_log/audit_log_events.ts +++ b/src/types/audit_log/audit_log_events.ts @@ -36,3 +36,6 @@ export enum DiscordAuditLogEvents { INTEGRATION_UPDATE, INTEGRATION_DELETE, } + +export type AuditLogEvents = DiscordAuditLogEvents; +export const AuditLogEvents = DiscordAuditLogEvents; diff --git a/src/types/audit_log/get_guild_audit_log.ts b/src/types/audit_log/get_guild_audit_log.ts index ef2fab575..6d5e853c6 100644 --- a/src/types/audit_log/get_guild_audit_log.ts +++ b/src/types/audit_log/get_guild_audit_log.ts @@ -1,6 +1,6 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { DiscordAuditLogEvents } from "./audit_log_events.ts"; +/** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log-query-string-parameters */ export interface GetGuildAuditLog { /** Filter the log for actions made by a user */ userId: string; @@ -11,8 +11,3 @@ export interface GetGuildAuditLog { /** How many entries are returned (default 50, minimum 1, maximum 100) */ limit: number; } - -/** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log-query-string-parameters */ -export type DiscordGetGuildAuditLog = SnakeCasedPropertiesDeep< - GetGuildAuditLog ->; diff --git a/src/types/audit_log/optional_audit_entry_info.ts b/src/types/audit_log/optional_audit_entry_info.ts index ec89b1a6d..cfd9057ca 100644 --- a/src/types/audit_log/optional_audit_entry_info.ts +++ b/src/types/audit_log/optional_audit_entry_info.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info */ export interface OptionalAuditEntryInfo { /** Number of days after which inactive members were kicked */ deleteMemberDays: string; @@ -18,8 +17,3 @@ export interface OptionalAuditEntryInfo { /** Name of the role if type is "0" (not present if type is "1") */ roleName: string; } - -/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info */ -export type DiscordOptionalAuditEntryInfo = SnakeCasedPropertiesDeep< - OptionalAuditEntryInfo ->; diff --git a/src/types/channels/channel.ts b/src/types/channels/channel.ts index 9361bbeb3..e71377410 100644 --- a/src/types/channels/channel.ts +++ b/src/types/channels/channel.ts @@ -1,9 +1,9 @@ import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { DiscordChannelTypes } from "./channel_types.ts"; -import { DiscordOverwrite, Overwrite } from "./overwrite.ts"; +import { Overwrite } from "./overwrite.ts"; import { DiscordVideoQualityModes } from "./video_quality_modes.ts"; +/** https://discord.com/developers/docs/resources/channel#channel-object */ export interface Channel { /** The id of the channel */ id: string; @@ -46,9 +46,3 @@ export interface Channel { /** The camera video quality mode of the voice channel, 1 when not present */ videoQualityMode?: DiscordVideoQualityModes; } - -/** https://discord.com/developers/docs/resources/channel#channel-object */ -export interface DiscordChannel - extends SnakeCasedPropertiesDeep> { - permission_overwrites?: DiscordOverwrite[]; -} diff --git a/src/types/channels/channel_mention.ts b/src/types/channels/channel_mention.ts index f6ec4def0..9acc8bf91 100644 --- a/src/types/channels/channel_mention.ts +++ b/src/types/channels/channel_mention.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/channel#channel-mention-object */ export interface ChannelMention { /** id of the channel */ id: string; @@ -10,6 +9,3 @@ export interface ChannelMention { /** The name of the channel */ name: string; } - -/** https://discord.com/developers/docs/resources/channel#channel-mention-object */ -export type DiscordChannelMention = SnakeCasedPropertiesDeep; diff --git a/src/types/channels/channel_pins_update.ts b/src/types/channels/channel_pins_update.ts index 65de83815..5483f155d 100644 --- a/src/types/channels/channel_pins_update.ts +++ b/src/types/channels/channel_pins_update.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/topics/gateway#channel-pins-update */ export interface ChannelPinsUpdate { /** The id of the guild */ guildId?: string; @@ -8,8 +7,3 @@ export interface ChannelPinsUpdate { /** The time at which the most recent pinned message was pinned */ lastPinTimestamp?: string | null; } - -/** https://discord.com/developers/docs/topics/gateway#channel-pins-update */ -export type DiscordChannelPinsUpdate = SnakeCasedPropertiesDeep< - ChannelPinsUpdate ->; diff --git a/src/types/channels/channel_types.ts b/src/types/channels/channel_types.ts index e7a47deab..02d2c85b2 100644 --- a/src/types/channels/channel_types.ts +++ b/src/types/channels/channel_types.ts @@ -17,3 +17,6 @@ export enum DiscordChannelTypes { /** A voice channel for hosting events with an audience */ GUILD_STAGE_VOICE = 13, } + +export type ChannelTypes = DiscordChannelTypes; +export const ChannelTypes = DiscordChannelTypes; diff --git a/src/types/channels/followed_channel.ts b/src/types/channels/followed_channel.ts index c293c5316..2b86ced62 100644 --- a/src/types/channels/followed_channel.ts +++ b/src/types/channels/followed_channel.ts @@ -1,11 +1,7 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/channel#followed-channel-object */ export interface FollowedChannel { /** Source message id */ channelId: string; /** Created target webhook id */ webhookId: string; } - -/** https://discord.com/developers/docs/resources/channel#followed-channel-object */ -export type DiscordFollowedChannel = SnakeCasedPropertiesDeep; diff --git a/src/types/channels/modify_channel.ts b/src/types/channels/modify_channel.ts index fcb9ecaff..b6defe24b 100644 --- a/src/types/channels/modify_channel.ts +++ b/src/types/channels/modify_channel.ts @@ -37,3 +37,5 @@ export interface DiscordModifyChannel extends > { permission_overwrites?: DiscordOverwrite[]; } + +//TODO: check this diff --git a/src/types/channels/overwrite.ts b/src/types/channels/overwrite.ts index 3e3e5f21d..533246e75 100644 --- a/src/types/channels/overwrite.ts +++ b/src/types/channels/overwrite.ts @@ -17,3 +17,5 @@ export interface DiscordOverwrite extends Omit { allow: string; deny: string; } + +// TODO: check this diff --git a/src/types/channels/overwrite_types.ts b/src/types/channels/overwrite_types.ts index 8d0830d68..5ee32e76d 100644 --- a/src/types/channels/overwrite_types.ts +++ b/src/types/channels/overwrite_types.ts @@ -2,3 +2,6 @@ export enum DiscordOverwriteTypes { ROLE, MEMBER, } + +export type OverwriteTypes = DiscordOverwriteTypes; +export const OverwriteTypes = DiscordOverwriteTypes; diff --git a/src/types/channels/video_quality_modes.ts b/src/types/channels/video_quality_modes.ts index 71f633016..e32931f1c 100644 --- a/src/types/channels/video_quality_modes.ts +++ b/src/types/channels/video_quality_modes.ts @@ -4,3 +4,6 @@ export enum DiscordVideoQualityModes { /** 720p */ Full, } + +export type VideoQualityModes = DiscordVideoQualityModes; +export const VideoQualityModes = DiscordVideoQualityModes; diff --git a/src/types/codes/gateway_close_event_codes.ts b/src/types/codes/gateway_close_event_codes.ts index c84e766d1..b3b9b2854 100644 --- a/src/types/codes/gateway_close_event_codes.ts +++ b/src/types/codes/gateway_close_event_codes.ts @@ -15,3 +15,6 @@ export enum DiscordGatewayCloseEventCodes { InvalidIntents, DisallowedIntents, } + +export type GatewayCloseEventCodes = DiscordGatewayCloseEventCodes; +export const GatewayCloseEventCodes = DiscordGatewayCloseEventCodes; diff --git a/src/types/codes/gateway_opcodes.ts b/src/types/codes/gateway_opcodes.ts index cb027701d..7f250219b 100644 --- a/src/types/codes/gateway_opcodes.ts +++ b/src/types/codes/gateway_opcodes.ts @@ -12,3 +12,6 @@ export enum DiscordGatewayOpcodes { Hello, HeartbeatACK, } + +export type GatewayOpcodes = DiscordGatewayOpcodes; +export const GatewayOpcodes = DiscordGatewayOpcodes; diff --git a/src/types/codes/http_response_codes.ts b/src/types/codes/http_response_codes.ts index 22cfaa34d..6d543f9e9 100644 --- a/src/types/codes/http_response_codes.ts +++ b/src/types/codes/http_response_codes.ts @@ -12,3 +12,6 @@ export enum DiscordHTTPResponseCodes { TooManyRequests = 429, GatewayUnavailable = 502, } + +export type HTTPPResponseCodes = DiscordHTTPResponseCodes; +export const HTTPPResponseCodes = DiscordHTTPResponseCodes; diff --git a/src/types/codes/json_error_codes.ts b/src/types/codes/json_error_codes.ts index dc6ed3cda..8efd3f186 100644 --- a/src/types/codes/json_error_codes.ts +++ b/src/types/codes/json_error_codes.ts @@ -43,6 +43,7 @@ export enum DiscordJsonErrorCodes { MaximumNumberOfInvitesReached, MaximumNumberOfGuildDiscoverySubcategoriesHasBeenReached = 30030, GuildAlreadyHasTemplate = 30031, + MaximumNumberOfBansForNonGuildMembersHaveBeenExceeded = 30035, UnauthorizedProvideAValidTokenAndTryAgain = 40001, YouNeedToVerifyYourAccountInOrderToPerformThisAction, RequestEntityTooLargeTrySendingSomethingSmallerInSize = 40005, @@ -81,3 +82,6 @@ export enum DiscordJsonErrorCodes { ReqctionWasBlocked = 90001, ApiResourceIsCurrentlyOverloadedTryAgainALittleLater = 130000, } + +export type JsonErrrorCodes = DiscordJsonErrorCodes; +export const JsonErrrorCodes = DiscordJsonErrorCodes; diff --git a/src/types/codes/rpc_close_event_codes.ts b/src/types/codes/rpc_close_event_codes.ts index b51cc31db..6329727b0 100644 --- a/src/types/codes/rpc_close_event_codes.ts +++ b/src/types/codes/rpc_close_event_codes.ts @@ -7,3 +7,6 @@ export enum DiscordRpcCloseEventCodes { InvalidVersion, InvalidEncoding, } + +export type RpcCloseEventCodes = DiscordRpcCloseEventCodes; +export const RpcCloseEventCodes = DiscordRpcCloseEventCodes; diff --git a/src/types/codes/rpc_error_codes.ts b/src/types/codes/rpc_error_codes.ts index 71f534c6d..4d57a9d4a 100644 --- a/src/types/codes/rpc_error_codes.ts +++ b/src/types/codes/rpc_error_codes.ts @@ -17,3 +17,6 @@ export enum DiscordRpcErrorCodes { SelectVoiceForceRequired, CaptureShortcutAlreadyListening, } + +export type RpcErrorCodes = DiscordRpcErrorCodes; +export const RpcErrorCodes = DiscordRpcErrorCodes; diff --git a/src/types/codes/voice_close_event_codes.ts b/src/types/codes/voice_close_event_codes.ts index d8ad543df..a447dd853 100644 --- a/src/types/codes/voice_close_event_codes.ts +++ b/src/types/codes/voice_close_event_codes.ts @@ -13,3 +13,6 @@ export enum DiscordVoiceCloseEventCodes { VoiceServerCrashed, UnknownEncryptionMode, } + +export type VoiceCloseEventCodes = DiscordVoiceCloseEventCodes; +export const VoiceCloseEventCodes = DiscordVoiceCloseEventCodes; diff --git a/src/types/codes/voice_opcodes.ts b/src/types/codes/voice_opcodes.ts index 4e411f67e..ffeb02fc9 100644 --- a/src/types/codes/voice_opcodes.ts +++ b/src/types/codes/voice_opcodes.ts @@ -12,3 +12,6 @@ export enum DiscordVoiceOpcodes { Resumed, ClientDisconnect = 13, } + +export type VoiceOpcodes = DiscordVoiceOpcodes; +export const VoiceOpcodes = DiscordVoiceOpcodes; diff --git a/src/types/discordeno/eventHandlers.ts b/src/types/discordeno/eventHandlers.ts index f60fda6e2..8dba6659e 100644 --- a/src/types/discordeno/eventHandlers.ts +++ b/src/types/discordeno/eventHandlers.ts @@ -161,8 +161,6 @@ export interface EventHandlers { ) => unknown; /** Sent before every event execution. Discordeno will not await its execution. */ raw?: (data: GatewayPayload) => unknown; - // TODO: remove this? - // rawGateway?: (data: unknown) => unknown; /** Sent when all shards went ready. */ ready?: () => unknown; /** Sent when a user adds a reaction to a message. */ diff --git a/src/types/discovery/add_guild_discovery_subcategory.ts b/src/types/discovery/add_guild_discovery_subcategory.ts index af38cb9fc..9b1f580a7 100644 --- a/src/types/discovery/add_guild_discovery_subcategory.ts +++ b/src/types/discovery/add_guild_discovery_subcategory.ts @@ -1,12 +1,6 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - export interface AddGuildDiscoverySubcategory { /** The guild Id of the subcategory was added to */ guildId: string; /** The Id of the subcategory added */ categoryId: number; } - -export type DiscordAddGuildDiscoverySubcategory = SnakeCasedPropertiesDeep< - AddGuildDiscoverySubcategory ->; diff --git a/src/types/discovery/discovery_category.ts b/src/types/discovery/discovery_category.ts index 64701227b..8b82e25cc 100644 --- a/src/types/discovery/discovery_category.ts +++ b/src/types/discovery/discovery_category.ts @@ -1,6 +1,6 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { DiscoveryName } from "./discovery_name.ts"; +//TODO: add docs link export interface DiscoveryCategory { /** Numeric id of the category */ id: number; @@ -9,8 +9,3 @@ export interface DiscoveryCategory { /** Whether this category can be set as a guild's primary category */ isPrimary: boolean; } - -//TODO: add docs link -export type DiscordDiscoveryCategory = SnakeCasedPropertiesDeep< - DiscoveryCategory ->; diff --git a/src/types/discovery/discovery_metadata.ts b/src/types/discovery/discovery_metadata.ts index 117bf3869..3d8571761 100644 --- a/src/types/discovery/discovery_metadata.ts +++ b/src/types/discovery/discovery_metadata.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +// TODO: add docs link export interface DiscoveryMetadata { /** The guild Id */ guildId: string; @@ -16,8 +15,3 @@ export interface DiscoveryMetadata { /** Ids of up to 5 discovery subcategories set for this guild */ categoryIds: number[]; } - -// TODO: add docs link -export type DiscordDiscoveryMetadata = SnakeCasedPropertiesDeep< - DiscoveryMetadata ->; diff --git a/src/types/discovery/discovery_name.ts b/src/types/discovery/discovery_name.ts index d2e9479d6..58199327f 100644 --- a/src/types/discovery/discovery_name.ts +++ b/src/types/discovery/discovery_name.ts @@ -1,8 +1,7 @@ +//TODO: add docs link export interface DiscoveryName { /** The name in English */ default: string; /** The name in other languages */ localizations?: Record; } - -export type DiscordDiscoveryName = DiscoveryName; diff --git a/src/types/discovery/modify_guild_discovery_metadata.ts b/src/types/discovery/modify_guild_discovery_metadata.ts index 1a91138a1..e517bfdea 100644 --- a/src/types/discovery/modify_guild_discovery_metadata.ts +++ b/src/types/discovery/modify_guild_discovery_metadata.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +// TODO: add docs link export interface ModifyGuildDiscoveryMetadata { /** The id of the primary discovery category. Default: 0 */ primaryCategoryId?: number | null; @@ -8,7 +7,3 @@ export interface ModifyGuildDiscoveryMetadata { /** Whether guild info is shown when custom emojis are clicked. Default: true */ emojiDiscoverabilityEnabled?: boolean | null; } - -export type DiscordModifyGuildDiscoveryMetadata = SnakeCasedPropertiesDeep< - ModifyGuildDiscoveryMetadata ->; diff --git a/src/types/discovery/validate_discovery_search_term.ts b/src/types/discovery/validate_discovery_search_term.ts index 184b533d8..ff230f5ac 100644 --- a/src/types/discovery/validate_discovery_search_term.ts +++ b/src/types/discovery/validate_discovery_search_term.ts @@ -1,6 +1,5 @@ +// TODO: add docs link export interface ValidateDiscoverySearchTerm { /** Whether the provided term is valid */ valid: boolean; } - -export type DiscordValidateDiscoverySearchTerm = ValidateDiscoverySearchTerm; diff --git a/src/types/discovery/validate_discovery_search_term_params.ts b/src/types/discovery/validate_discovery_search_term_params.ts index 18d3e409b..8ad447206 100644 --- a/src/types/discovery/validate_discovery_search_term_params.ts +++ b/src/types/discovery/validate_discovery_search_term_params.ts @@ -1,8 +1,5 @@ +// TODO: add docs link export interface ValidateDiscoverySearchTermParams { /** The search term to check */ term: string; } - -// TODO: add docs link -export type DiscordValidateDiscoverySearchTermParams = - ValidateDiscoverySearchTermParams; diff --git a/src/types/embeds/embed.ts b/src/types/embeds/embed.ts index 5f63bf982..9b8a27970 100644 --- a/src/types/embeds/embed.ts +++ b/src/types/embeds/embed.ts @@ -7,6 +7,7 @@ import { EmbedThumbnail } from "./embed_thumbnail.ts"; import { DiscordEmbedTypes } from "./embed_types.ts"; import { EmbedVideo } from "./embed_video.ts"; +/** https://discord.com/developers/docs/resources/channel#embed-object */ export interface Embed { /** Title of embed */ title?: string; @@ -35,6 +36,3 @@ export interface Embed { /** Fields information */ fields?: EmbedField[]; } - -/** https://discord.com/developers/docs/resources/channel#embed-object */ -export type DiscordEmbed = Embed; diff --git a/src/types/embeds/embed_author.ts b/src/types/embeds/embed_author.ts index c6ff2bf25..4ec07a7e9 100644 --- a/src/types/embeds/embed_author.ts +++ b/src/types/embeds/embed_author.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure */ export interface EmbedAuthor { /** Name of author */ name?: string; @@ -10,6 +9,3 @@ export interface EmbedAuthor { /** A proxied url of author icon */ proxyIconUrl?: string; } - -/** https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure */ -export type DiscordEmbedAuthor = SnakeCasedPropertiesDeep; diff --git a/src/types/embeds/embed_field.ts b/src/types/embeds/embed_field.ts index 02ee5ee23..6d009d4d6 100644 --- a/src/types/embeds/embed_field.ts +++ b/src/types/embeds/embed_field.ts @@ -1,3 +1,4 @@ +/** https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure */ export interface EmbedField { /** Name of the field */ name: string; @@ -6,6 +7,3 @@ export interface EmbedField { /** Whether or not this field should display inline */ inline?: boolean; } - -/** https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure */ -export type DiscordEmbedField = EmbedField; diff --git a/src/types/embeds/embed_footer.ts b/src/types/embeds/embed_footer.ts index 9ccfe268d..a90aa10e1 100644 --- a/src/types/embeds/embed_footer.ts +++ b/src/types/embeds/embed_footer.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure */ export interface EmbedFooter { /** Footer text */ text: string; @@ -8,6 +7,3 @@ export interface EmbedFooter { /** A proxied url of footer icon */ proxyIconUrl?: string; } - -/** https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure */ -export type DiscordEmbedFooter = SnakeCasedPropertiesDeep; diff --git a/src/types/embeds/embed_image.ts b/src/types/embeds/embed_image.ts index 2255c47bc..0b010c56a 100644 --- a/src/types/embeds/embed_image.ts +++ b/src/types/embeds/embed_image.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure */ export interface EmbedImage { /** Source url of image (only supports http(s) and attachments) */ url?: string; @@ -10,6 +9,3 @@ export interface EmbedImage { /** Width of image */ width?: number; } - -/** https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure */ -export type DiscordEmbedImage = SnakeCasedPropertiesDeep; diff --git a/src/types/embeds/embed_provider.ts b/src/types/embeds/embed_provider.ts index 4af0b9e18..afac6dff5 100644 --- a/src/types/embeds/embed_provider.ts +++ b/src/types/embeds/embed_provider.ts @@ -1,9 +1,7 @@ +export type DiscordEmbedProvider = EmbedProvider; export interface EmbedProvider { /** Name of provider */ name?: string; /** Url of provider */ url?: string; } - -/** https://discord.com/developers/docs/resources/channel#embed-object-embed-provider-structure */ -export type DiscordEmbedProvider = EmbedProvider; diff --git a/src/types/embeds/embed_thumbnail.ts b/src/types/embeds/embed_thumbnail.ts index ee715a4f4..824c6f085 100644 --- a/src/types/embeds/embed_thumbnail.ts +++ b/src/types/embeds/embed_thumbnail.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure */ export interface EmbedThumbnail { /** Source url of thumbnail (only supports http(s) and attachments) */ url?: string; @@ -10,6 +9,3 @@ export interface EmbedThumbnail { /** Width of thumbnail */ width?: number; } - -/** https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure */ -export type DiscordEmbedThumbnail = SnakeCasedPropertiesDeep; diff --git a/src/types/embeds/embed_video.ts b/src/types/embeds/embed_video.ts index 468c494d0..c2d8c63d2 100644 --- a/src/types/embeds/embed_video.ts +++ b/src/types/embeds/embed_video.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure */ export interface EmbedVideo { /** Source url of video */ url?: string; @@ -10,6 +9,3 @@ export interface EmbedVideo { /** Width of video */ width?: number; } - -/** https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure */ -export type DiscordEmbedVideo = SnakeCasedPropertiesDeep; diff --git a/src/types/emojis/create_guild_emoji.ts b/src/types/emojis/create_guild_emoji.ts index 3424e9af9..98959d4c8 100644 --- a/src/types/emojis/create_guild_emoji.ts +++ b/src/types/emojis/create_guild_emoji.ts @@ -1,3 +1,4 @@ +/** https://discord.com/developers/docs/resources/emoji#create-guild-emoji */ export interface CreateGuildEmoji { /** Name of the emoji */ name: string; @@ -6,6 +7,3 @@ export interface CreateGuildEmoji { /** Roles allowed to use this emoji */ roles: string[]; } - -/** https://discord.com/developers/docs/resources/emoji#create-guild-emoji */ -export type DiscordCreateGuildEmojis = CreateGuildEmoji; diff --git a/src/types/emojis/emoji.ts b/src/types/emojis/emoji.ts index abeb3f368..5609db102 100644 --- a/src/types/emojis/emoji.ts +++ b/src/types/emojis/emoji.ts @@ -1,6 +1,6 @@ import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/resources/emoji#emoji-object-emoji-structure */ export interface Emoji { /** Emoji id */ id: string | null; @@ -19,6 +19,3 @@ export interface Emoji { /** Whether this emoji can be used, may be false due to loss of Server Boosts */ available?: boolean; } - -/** https://discord.com/developers/docs/resources/emoji#emoji-object-emoji-structure */ -export type DiscordEmoji = SnakeCasedPropertiesDeep; diff --git a/src/types/emojis/guild_emojis_update.ts b/src/types/emojis/guild_emojis_update.ts index d7990f61b..65ede6d26 100644 --- a/src/types/emojis/guild_emojis_update.ts +++ b/src/types/emojis/guild_emojis_update.ts @@ -1,14 +1,9 @@ import { Emoji } from "../emojis/emoji.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/topics/gateway#guild-emojis-update */ export interface GuildEmojisUpdate { /** id of the guild */ guildId: string; /** Array of emojis */ emojis: Emoji[]; } - -/** https://discord.com/developers/docs/topics/gateway#guild-emojis-update */ -export type DiscordGuildEmojisUpdate = SnakeCasedPropertiesDeep< - GuildEmojisUpdate ->; diff --git a/src/types/emojis/modify_guild_emoji.ts b/src/types/emojis/modify_guild_emoji.ts index 319280c41..5da4bc0da 100644 --- a/src/types/emojis/modify_guild_emoji.ts +++ b/src/types/emojis/modify_guild_emoji.ts @@ -1,9 +1,7 @@ +/** https://discord.com/developers/docs/resources/emoji#modify-guild-emoji */ export interface ModifyGuildEmoji { /** Name of the emoji */ name?: string; /** Roles allowed to use this emoji */ roles?: string[] | null; } - -/** https://discord.com/developers/docs/resources/emoji#modify-guild-emoji */ -export type DiscordModifyGuildEmoji = ModifyGuildEmoji; diff --git a/src/types/gateway/gateway_intents.ts b/src/types/gateway/gateway_intents.ts index 411ee7aa6..533556a17 100644 --- a/src/types/gateway/gateway_intents.ts +++ b/src/types/gateway/gateway_intents.ts @@ -88,3 +88,6 @@ export enum DiscordGatewayIntents { */ DIRECT_MESSAGE_TYPING = 1 << 14, } + +export type Intents = DiscordGatewayIntents; +export const Intents = DiscordGatewayIntents; diff --git a/src/types/gateway/gateway_url_params.ts b/src/types/gateway/gateway_url_params.ts index 67be76115..7beb1971a 100644 --- a/src/types/gateway/gateway_url_params.ts +++ b/src/types/gateway/gateway_url_params.ts @@ -1,3 +1,4 @@ +/** https://discord.com/developers/docs/topics/gateway#connecting-gateway-url-params */ export interface GatewayURLParams { /** Gateway version to use */ v: string; @@ -6,6 +7,3 @@ export interface GatewayURLParams { /** The (optional) compression of gateway packets */ compress?: string; } - -/** https://discord.com/developers/docs/topics/gateway#connecting-gateway-url-params */ -export type DiscordGatewayURLParams = GatewayURLParams; diff --git a/src/types/gateway/get_gateway_bot.ts b/src/types/gateway/get_gateway_bot.ts index d7e5954e6..c1ed12069 100644 --- a/src/types/gateway/get_gateway_bot.ts +++ b/src/types/gateway/get_gateway_bot.ts @@ -1,6 +1,6 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { SessionStartLimit } from "./session_start_limit.ts"; +/** https://discord.com/developers/docs/topics/gateway#get-gateway-bot */ export interface GetGatewayBot { /** The WSS URL that can be used for connecting to the gateway */ url: string; @@ -9,6 +9,3 @@ export interface GetGatewayBot { /** Information on the current session start limit */ sessionStartLimit: SessionStartLimit; } - -/** https://discord.com/developers/docs/topics/gateway#get-gateway-bot */ -export type DiscordGetGatewayBot = SnakeCasedPropertiesDeep; diff --git a/src/types/gateway/identify.ts b/src/types/gateway/identify.ts index 4eb45dbdf..adf566206 100644 --- a/src/types/gateway/identify.ts +++ b/src/types/gateway/identify.ts @@ -1,7 +1,7 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { IdentifyConnectionProperties } from "./identify_connection_properties.ts"; import { StatusUpdate } from "./status_update.ts"; +/** https://discord.com/developers/docs/topics/gateway#identify */ export interface Identify { /** Authentication token */ token: string; @@ -18,6 +18,3 @@ export interface Identify { /** The Gateway Intents you wish to receive */ intents: number; } - -/** https://discord.com/developers/docs/topics/gateway#identify */ -export type DiscordIdentify = SnakeCasedPropertiesDeep; diff --git a/src/types/gateway/ready.ts b/src/types/gateway/ready.ts index 258ff3429..e5aafb694 100644 --- a/src/types/gateway/ready.ts +++ b/src/types/gateway/ready.ts @@ -3,6 +3,7 @@ import { Application } from "../oauth2/application.ts"; import { User } from "../users/user.ts"; import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/topics/gateway#ready */ export interface Ready { /** Gateway version */ v: number; @@ -20,5 +21,4 @@ export interface Ready { application: Partial & Pick; } -/** https://discord.com/developers/docs/topics/gateway#ready */ export type DiscordReady = SnakeCasedPropertiesDeep; diff --git a/src/types/gateway/resume.ts b/src/types/gateway/resume.ts index bd6b626c3..8d04d0aa5 100644 --- a/src/types/gateway/resume.ts +++ b/src/types/gateway/resume.ts @@ -1,3 +1,4 @@ +/** https://discord.com/developers/docs/topics/gateway#resume */ export interface Resume { /** Session token */ token: string; @@ -6,6 +7,3 @@ export interface Resume { /** Last sequence number received */ seq: number; } - -/** https://discord.com/developers/docs/topics/gateway#resume */ -export type DiscordResume = Resume; diff --git a/src/types/gateway/session_start_limit.ts b/src/types/gateway/session_start_limit.ts index 01bbac11b..c45bb8767 100644 --- a/src/types/gateway/session_start_limit.ts +++ b/src/types/gateway/session_start_limit.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/topics/gateway#session-start-limit-object */ export interface SessionStartLimit { /** The total number of session starts the current user is allowed */ total: number; @@ -10,8 +9,3 @@ export interface SessionStartLimit { /** The number of identify requests allowed per 5 seconds */ maxConcurrency: number; } - -/** https://discord.com/developers/docs/topics/gateway#session-start-limit-object */ -export type DiscordSessionStartLimit = SnakeCasedPropertiesDeep< - SessionStartLimit ->; diff --git a/src/types/gateway/status_update.ts b/src/types/gateway/status_update.ts index 3f034ee81..27f65b9ca 100644 --- a/src/types/gateway/status_update.ts +++ b/src/types/gateway/status_update.ts @@ -1,7 +1,7 @@ import { Activity } from "../misc/activity.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { DiscordStatusTypes } from "./status_types.ts"; +/** https://discord.com/developers/docs/topics/gateway#update-status */ export interface StatusUpdate { /** Unix time (in milliseconds) of when the client went idle, or null if the client is not idle */ since: number | null; @@ -12,6 +12,3 @@ export interface StatusUpdate { /** Whether or not the client is afk */ afk: boolean; } - -/** https://discord.com/developers/docs/topics/gateway#update-status */ -export type DiscordStatusUpdate = SnakeCasedPropertiesDeep; diff --git a/src/types/guilds/ban.ts b/src/types/guilds/ban.ts index 5fc4c5842..aad8022ec 100644 --- a/src/types/guilds/ban.ts +++ b/src/types/guilds/ban.ts @@ -1,12 +1,9 @@ import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/resources/guild#ban-object */ export interface Ban { /** The reason for the ban */ reason: string | null; /** The banned user */ user: User; } - -/** https://discord.com/developers/docs/resources/guild#ban-object */ -export type DiscordBan = SnakeCasedPropertiesDeep; diff --git a/src/types/guilds/begin_guild_prune.ts b/src/types/guilds/begin_guild_prune.ts index f93bf63dc..cb6c2b677 100644 --- a/src/types/guilds/begin_guild_prune.ts +++ b/src/types/guilds/begin_guild_prune.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/guild#begin-guild-prune */ export interface BeginGuildPrune { /** Number of days to prune (1 or more), default: 7 */ days?: number; @@ -8,6 +7,3 @@ export interface BeginGuildPrune { /** Role(s) ro include, default: none */ includeRoles?: string[]; } - -/** https://discord.com/developers/docs/resources/guild#begin-guild-prune */ -export type DiscordBeginGuildPrune = SnakeCasedPropertiesDeep; diff --git a/src/types/guilds/create_guild.ts b/src/types/guilds/create_guild.ts index d8d50adcb..f0978015d 100644 --- a/src/types/guilds/create_guild.ts +++ b/src/types/guilds/create_guild.ts @@ -1,11 +1,11 @@ import { Channel } from "../channels/channel.ts"; import { Role } from "../permissions/role.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { DiscordDefaultMessageNotificationLevels } from "./default_message_notification_levels.ts"; import { DiscordExplicitContentFilterLevels } from "./explicit_content_filter_levels.ts"; import { DiscordSystemChannelFlags } from "./system_channel_flags.ts"; import { DiscordVerificationLevels } from "./verification_levels.ts"; +/** https://discord.com/developers/docs/resources/guild#create-guild */ export interface CreateGuild { /** Name of the guild (2-100 characters) */ name: string; @@ -32,6 +32,3 @@ export interface CreateGuild { /** System channel flags */ systemChannelFlags?: DiscordSystemChannelFlags; } - -/** https://discord.com/developers/docs/resources/guild#create-guild */ -export type DiscordCreateGuild = SnakeCasedPropertiesDeep; diff --git a/src/types/guilds/create_guild_ban.ts b/src/types/guilds/create_guild_ban.ts index beb2fb837..f5fd9d63d 100644 --- a/src/types/guilds/create_guild_ban.ts +++ b/src/types/guilds/create_guild_ban.ts @@ -1,11 +1,7 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/guild#create-guild-ban */ export interface CreateGuildBan { /** Number of days to delete messages for (0-7) */ deleteMessageDays?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7; /** Reason for the ban */ reason?: string; } - -/** https://discord.com/developers/docs/resources/guild#create-guild-ban */ -export type DiscordCreateGuildBan = SnakeCasedPropertiesDeep; diff --git a/src/types/guilds/create_guild_channel.ts b/src/types/guilds/create_guild_channel.ts index 82ff9d9f8..d6fe506d0 100644 --- a/src/types/guilds/create_guild_channel.ts +++ b/src/types/guilds/create_guild_channel.ts @@ -32,3 +32,4 @@ export interface DiscordCreateGuildChannel extends > { permission_overwrites: DiscordOverwrite[]; } +// TODO: check this diff --git a/src/types/guilds/create_guild_role.ts b/src/types/guilds/create_guild_role.ts index d1be99b30..2183a0f7d 100644 --- a/src/types/guilds/create_guild_role.ts +++ b/src/types/guilds/create_guild_role.ts @@ -18,3 +18,4 @@ export interface DiscordCreateGuildRole extends Omit { permissions?: string; } +// TODO: check this diff --git a/src/types/guilds/default_message_notification_levels.ts b/src/types/guilds/default_message_notification_levels.ts index 51b2f55f2..5c639ebde 100644 --- a/src/types/guilds/default_message_notification_levels.ts +++ b/src/types/guilds/default_message_notification_levels.ts @@ -5,3 +5,8 @@ export enum DiscordDefaultMessageNotificationLevels { /** Members will receive notifications only for messages that @mention them by default */ ONLY_MENTIONS, } + +export type DefaultMessageNotificationLevels = + DiscordDefaultMessageNotificationLevels; +export const DefaultMessageNotificationLevels = + DiscordDefaultMessageNotificationLevels; diff --git a/src/types/guilds/explicit_content_filter_levels.ts b/src/types/guilds/explicit_content_filter_levels.ts index d789e13d4..0fac226ed 100644 --- a/src/types/guilds/explicit_content_filter_levels.ts +++ b/src/types/guilds/explicit_content_filter_levels.ts @@ -7,3 +7,6 @@ export enum DiscordExplicitContentFilterLevels { /** Media content sent by all members will be scanned */ ALL_MEMBERS, } + +export type ExplicitContentFilterLevels = DiscordExplicitContentFilterLevels; +export const ExplicitContentFilterLevels = DiscordExplicitContentFilterLevels; diff --git a/src/types/guilds/get_guild.ts b/src/types/guilds/get_guild.ts index b56abc303..b6845f3c5 100644 --- a/src/types/guilds/get_guild.ts +++ b/src/types/guilds/get_guild.ts @@ -1,9 +1,5 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/guild#get-guild */ export interface GetGuildQuery { /** When true, will return approximate member and presence counts for the guild */ withCounts?: boolean; } - -/** https://discord.com/developers/docs/resources/guild#get-guild */ -export type DiscordGetGuildQuery = SnakeCasedPropertiesDeep; diff --git a/src/types/guilds/get_guild_prune_count.ts b/src/types/guilds/get_guild_prune_count.ts index f0eb6636a..cd80efa1d 100644 --- a/src/types/guilds/get_guild_prune_count.ts +++ b/src/types/guilds/get_guild_prune_count.ts @@ -1,13 +1,7 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */ export interface GetGuildPruneCountQuery { /** Number of days to count prune for (1 or more), default: 7 */ days?: number; /** Role(s) to include, default: none */ includeRoles: string | string[]; } - -/** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */ -export type DiscordGetGuildPruneCountQuery = SnakeCasedPropertiesDeep< - GetGuildPruneCountQuery ->; diff --git a/src/types/guilds/get_guild_widget_image.ts b/src/types/guilds/get_guild_widget_image.ts index f6219ee1a..ca759e27c 100644 --- a/src/types/guilds/get_guild_widget_image.ts +++ b/src/types/guilds/get_guild_widget_image.ts @@ -1,9 +1,7 @@ import { DiscordGetGuildWidgetImageStyleOptions } from "./get_guild_widget_image_style_options.ts"; +/** https://discord.com/developers/docs/resources/guild#get-guild-widget-image-query-string-params */ export interface GetGuildWidgetImageQuery { /** Style of the widget returned, default: shield */ style?: DiscordGetGuildWidgetImageStyleOptions; } - -/** https://discord.com/developers/docs/resources/guild#get-guild-widget-image-query-string-params */ -export type DiscordGetGuildWidgetImage = GetGuildWidgetImageQuery; diff --git a/src/types/guilds/get_guild_widget_image_style_options.ts b/src/types/guilds/get_guild_widget_image_style_options.ts index e605e4975..b5c36c335 100644 --- a/src/types/guilds/get_guild_widget_image_style_options.ts +++ b/src/types/guilds/get_guild_widget_image_style_options.ts @@ -11,3 +11,8 @@ export enum DiscordGetGuildWidgetImageStyleOptions { /** 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 type GetGuildWidgetImageStyleOptions = + DiscordGetGuildWidgetImageStyleOptions; +export const GetGuildWidgetImageStyleOptions = + DiscordGetGuildWidgetImageStyleOptions; diff --git a/src/types/guilds/guild.ts b/src/types/guilds/guild.ts index c346f9f22..4e96ddb0f 100644 --- a/src/types/guilds/guild.ts +++ b/src/types/guilds/guild.ts @@ -2,7 +2,6 @@ import { Channel } from "../channels/channel.ts"; import { Emoji } from "../emojis/emoji.ts"; import { PresenceUpdate } from "../misc/presence_update.ts"; import { Role } from "../permissions/role.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { VoiceState } from "../voice/voice_state.ts"; import { DiscordDefaultMessageNotificationLevels } from "./default_message_notification_levels.ts"; import { DiscordExplicitContentFilterLevels } from "./explicit_content_filter_levels.ts"; @@ -14,6 +13,7 @@ import { DiscordSystemChannelFlags } from "./system_channel_flags.ts"; import { DiscordVerificationLevels } from "./verification_levels.ts"; import { WelcomeScreen } from "./welcome_screen.ts"; +/** https://discord.com/developers/docs/resources/guild#guild-object */ export interface Guild { /** Guild id */ id: string; @@ -107,7 +107,6 @@ export interface Guild { approximatePresenceCount?: number; /** The welcome screen of a Community guild, shown to new members, returned when in the invite object */ welcomeScreen?: WelcomeScreen; + /** `true` if this guild is designated as NSFW */ + nsfw: boolean; } - -/** https://discord.com/developers/docs/resources/guild#guild-object */ -export type DiscordGuild = SnakeCasedPropertiesDeep; diff --git a/src/types/guilds/guild_ban_add_remove.ts b/src/types/guilds/guild_ban_add_remove.ts index 988368946..2f1426a75 100644 --- a/src/types/guilds/guild_ban_add_remove.ts +++ b/src/types/guilds/guild_ban_add_remove.ts @@ -1,14 +1,9 @@ import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/topics/gateway#guild-ban-add */ export interface GuildBanAddRemove { /** id of the guild */ guildId: string; /** The banned user */ user: User; } - -/** https://discord.com/developers/docs/topics/gateway#guild-ban-add */ -export type DiscordGuildBanAddRemove = SnakeCasedPropertiesDeep< - GuildBanAddRemove ->; diff --git a/src/types/guilds/guild_ban_remove.ts b/src/types/guilds/guild_ban_remove.ts index c88a16207..62f3fdef2 100644 --- a/src/types/guilds/guild_ban_remove.ts +++ b/src/types/guilds/guild_ban_remove.ts @@ -1,12 +1,9 @@ import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/topics/gateway#guild-ban-remove */ export interface GuildBanRemove { /** id of the guild */ guildId: string; /** The unbanned user */ user: User; } - -/** https://discord.com/developers/docs/topics/gateway#guild-ban-remove */ -export type DiscordGuildBanRemove = SnakeCasedPropertiesDeep; diff --git a/src/types/guilds/guild_features.ts b/src/types/guilds/guild_features.ts index 3ba9fa4cc..c507bb5be 100644 --- a/src/types/guilds/guild_features.ts +++ b/src/types/guilds/guild_features.ts @@ -17,7 +17,8 @@ export enum DiscordGuildFeatures { /** Guild has access to create news channels */ NEWS = "NEWS", /** Guild is able to be discovered in the directory */ - DISCOVERABLE = "DISCOVERABLE", /** guild cannot be discoverable */ + DISCOVERABLE = "DISCOVERABLE", + /** guild cannot be discoverable */ DISCOVERABLE_DISABLED = "DISCOVERABLE_DISABLED", /** Guild is able to be featured in the directory */ FEATURABLE = "FEATURABLE", @@ -32,3 +33,6 @@ export enum DiscordGuildFeatures { /** Guild can be previewed before joining via Membership Screening or the directory */ PREVIEW_ENABLED = "PREVIEW_ENABLED", } + +export type GuildFeatures = DiscordGuildFeatures; +export const GuildFeatures = DiscordGuildFeatures; diff --git a/src/types/guilds/guild_member.ts b/src/types/guilds/guild_member.ts index 86c4a2053..cc13d095e 100644 --- a/src/types/guilds/guild_member.ts +++ b/src/types/guilds/guild_member.ts @@ -1,6 +1,6 @@ import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/resources/guild#guild-member-object */ export interface GuildMember { /** The user this guild member represents */ user?: User; @@ -20,13 +20,7 @@ export interface GuildMember { pending?: boolean; } -/** https://discord.com/developers/docs/resources/guild#guild-member-object */ -export type DiscordGuildMember = SnakeCasedPropertiesDeep; - // We use these types much since user always exists unless its a `CREATE_MESSAGE` or `MESSAGE_UPDATE` event -export type GuildMemberWithUser = Omit & { user: User }; /** https://discord.com/developers/docs/resources/guild#guild-member-object */ -export type DiscordGuildMemberWithUser = SnakeCasedPropertiesDeep< - GuildMemberWithUser ->; +export type GuildMemberWithUser = Omit & { user: User }; diff --git a/src/types/guilds/guild_preview.ts b/src/types/guilds/guild_preview.ts index e9d96f372..57e17fc3e 100644 --- a/src/types/guilds/guild_preview.ts +++ b/src/types/guilds/guild_preview.ts @@ -1,7 +1,7 @@ import { Emoji } from "../emojis/emoji.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { DiscordGuildFeatures } from "./guild_features.ts"; +/** https://discord.com/developers/docs/resources/guild#guild-preview-object */ export interface GuildPreview { /** Guild id */ id: string; @@ -24,6 +24,3 @@ export interface GuildPreview { /** The description for the guild, if the guild is discoverable */ description: string | null; } - -/** https://discord.com/developers/docs/resources/guild#guild-preview-object */ -export type DiscordGuildPreview = SnakeCasedPropertiesDeep; diff --git a/src/types/guilds/guild_role_create.ts b/src/types/guilds/guild_role_create.ts index 3cb806398..f93ed1623 100644 --- a/src/types/guilds/guild_role_create.ts +++ b/src/types/guilds/guild_role_create.ts @@ -1,12 +1,9 @@ import { Role } from "../permissions/role.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/topics/gateway#guild-role-create */ export interface GuildRoleCreate { /** The id of the guild */ guildId: string; /** The role created */ role: Role; } - -/** https://discord.com/developers/docs/topics/gateway#guild-role-create */ -export type DiscordGuildRoleCreate = SnakeCasedPropertiesDeep; diff --git a/src/types/guilds/guild_role_delete.ts b/src/types/guilds/guild_role_delete.ts index ed0987640..fef68f8fb 100644 --- a/src/types/guilds/guild_role_delete.ts +++ b/src/types/guilds/guild_role_delete.ts @@ -1,11 +1,7 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/topics/gateway#guild-role-delete */ export interface GuildRoleDelete { /** id of the guild */ guildId: string; /** id of the role */ roleId: string; } - -/** https://discord.com/developers/docs/topics/gateway#guild-role-delete */ -export type DiscordGuildRoleDelete = SnakeCasedPropertiesDeep; diff --git a/src/types/guilds/guild_role_update.ts b/src/types/guilds/guild_role_update.ts index e306621a8..bed4c25ed 100644 --- a/src/types/guilds/guild_role_update.ts +++ b/src/types/guilds/guild_role_update.ts @@ -1,12 +1,9 @@ import { Role } from "../permissions/role.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/topics/gateway#guild-role-update */ export interface GuildRoleUpdate { /** The id of the guild */ guildId: string; /** The role updated */ role: Role; } - -/** https://discord.com/developers/docs/topics/gateway#guild-role-update */ -export type DiscordGuildRoleUpdate = SnakeCasedPropertiesDeep; diff --git a/src/types/guilds/guild_widget.ts b/src/types/guilds/guild_widget.ts index 8bb8ffc92..0852161cf 100644 --- a/src/types/guilds/guild_widget.ts +++ b/src/types/guilds/guild_widget.ts @@ -1,11 +1,7 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/guild#guild-widget-object-guild-widget-structure */ export interface GuildWidget { /** Whether the widget is enabled */ enabled: boolean; /** The widget channel id */ channelId: string | null; } - -/** https://discord.com/developers/docs/resources/guild#guild-widget-object-guild-widget-structure */ -export type DiscordGuildWidget = SnakeCasedPropertiesDeep; diff --git a/src/types/guilds/list_guild_members.ts b/src/types/guilds/list_guild_members.ts index ce297344b..d8785ca2a 100644 --- a/src/types/guilds/list_guild_members.ts +++ b/src/types/guilds/list_guild_members.ts @@ -1,9 +1,7 @@ +/** https://discord.com/developers/docs/resources/guild#list-guild-members */ export interface ListGuildMembers { /** 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#list-guild-members */ -export type DiscordListGuildMembers = ListGuildMembers; diff --git a/src/types/guilds/mfa_levels.ts b/src/types/guilds/mfa_levels.ts index a75e87d64..12ef1ad7a 100644 --- a/src/types/guilds/mfa_levels.ts +++ b/src/types/guilds/mfa_levels.ts @@ -5,3 +5,6 @@ export enum DiscordMfaLevels { /** Guild has a 2FA requirement for moderation actions */ ELEVATED, } + +export type MfaLevels = DiscordMfaLevels; +export const MfaLevels = DiscordMfaLevels; diff --git a/src/types/guilds/modify_current_user_nick.ts b/src/types/guilds/modify_current_user_nick.ts index 0bb25da7d..e497b8a75 100644 --- a/src/types/guilds/modify_current_user_nick.ts +++ b/src/types/guilds/modify_current_user_nick.ts @@ -1,7 +1,5 @@ +/** https://discord.com/developers/docs/resources/guild#modify-current-user-nick */ export interface ModifyCurrentUserNick { /** Value to set users nickname to. Requires the CHANGENICKNAME permission */ nick?: string | null; } - -/** https://discord.com/developers/docs/resources/guild#modify-current-user-nick */ -export type DiscordModifyCurrentUserNick = ModifyCurrentUserNick; diff --git a/src/types/guilds/modify_guild.ts b/src/types/guilds/modify_guild.ts index 27ceb3f48..3f3b95b63 100644 --- a/src/types/guilds/modify_guild.ts +++ b/src/types/guilds/modify_guild.ts @@ -1,10 +1,10 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { DiscordDefaultMessageNotificationLevels } from "./default_message_notification_levels.ts"; import { DiscordExplicitContentFilterLevels } from "./explicit_content_filter_levels.ts"; import { DiscordGuildFeatures } from "./guild_features.ts"; import { DiscordSystemChannelFlags } from "./system_channel_flags.ts"; import { DiscordVerificationLevels } from "./verification_levels.ts"; +/** https://discord.com/developers/docs/resources/guild#modify-guild */ export interface ModifyGuild { /** Guild name */ name?: string; @@ -43,6 +43,3 @@ export interface ModifyGuild { /** Enabled guild features */ features?: DiscordGuildFeatures[]; } - -/** https://discord.com/developers/docs/resources/guild#modify-guild */ -export type DiscordModifyGuild = SnakeCasedPropertiesDeep; diff --git a/src/types/guilds/modify_guild_channel_position.ts b/src/types/guilds/modify_guild_channel_position.ts index f23f4fd5a..646cce814 100644 --- a/src/types/guilds/modify_guild_channel_position.ts +++ b/src/types/guilds/modify_guild_channel_position.ts @@ -1,4 +1,5 @@ // TODO: most likely it is but check if lockPositions and parentId really are optional +/** https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions */ export interface ModifyGuildChannelPositions { /** Channel id */ id: string; @@ -9,6 +10,3 @@ export interface ModifyGuildChannelPositions { /** The new parent ID for the channel that is moved */ parentId?: string | null; } - -/** https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions */ -export type DiscordModifyGuildChannelPositions = ModifyGuildChannelPositions; diff --git a/src/types/guilds/modify_guild_member.ts b/src/types/guilds/modify_guild_member.ts index e7756ea07..ceb423dfa 100644 --- a/src/types/guilds/modify_guild_member.ts +++ b/src/types/guilds/modify_guild_member.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/guild#modify-guild-member */ export interface ModifyGuildMember { /** Value to set users nickname to. Requires the `MANAGE_NICKNAMES` permission */ nick?: string | null; @@ -12,8 +11,3 @@ export interface ModifyGuildMember { /** Id of channel to move user to (if they are connected to voice). Requires the `MOVE_MEMBERS` permission */ channelId: string | null; } - -/** https://discord.com/developers/docs/resources/guild#modify-guild-member */ -export type DiscordModifyGuildMember = SnakeCasedPropertiesDeep< - ModifyGuildMember ->; diff --git a/src/types/guilds/modify_guild_role.ts b/src/types/guilds/modify_guild_role.ts index a23d92329..cb5e09006 100644 --- a/src/types/guilds/modify_guild_role.ts +++ b/src/types/guilds/modify_guild_role.ts @@ -18,3 +18,5 @@ export interface DiscordModifyGuildRole extends Omit { permissions?: string | null; } + +// TODO: check this diff --git a/src/types/guilds/modify_guild_role_positions.ts b/src/types/guilds/modify_guild_role_positions.ts index d709e6370..66d3b7dff 100644 --- a/src/types/guilds/modify_guild_role_positions.ts +++ b/src/types/guilds/modify_guild_role_positions.ts @@ -1,9 +1,7 @@ +/** https://discord.com/developers/docs/resources/guild#modify-guild-role-positions */ export interface ModifyGuildRolePositions { /** Role id */ id: string; /** Sorting position of the role */ position?: number | null; } - -/** https://discord.com/developers/docs/resources/guild#modify-guild-role-positions */ -export type DiscordModifyGuildRolePositions = ModifyGuildRolePositions; diff --git a/src/types/guilds/modify_guild_welcome_screen.ts b/src/types/guilds/modify_guild_welcome_screen.ts index d983043af..d63f64fba 100644 --- a/src/types/guilds/modify_guild_welcome_screen.ts +++ b/src/types/guilds/modify_guild_welcome_screen.ts @@ -1,6 +1,6 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { WelcomeScreenChannel } from "./welcome_screen_channel.ts"; +/** https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen */ export interface ModifyGuildWelcomeScreen { /** Whether the welcome screen is enabled */ enabled?: boolean | null; @@ -9,8 +9,3 @@ export interface ModifyGuildWelcomeScreen { /** The server description to show in the welcome screen */ description?: string | null; } - -// TODO: add documentation link -export type DiscordModifyGuildWelcomeScreen = SnakeCasedPropertiesDeep< - ModifyGuildWelcomeScreen ->; diff --git a/src/types/guilds/premium_tiers.ts b/src/types/guilds/premium_tiers.ts index a55c6271c..755c87e00 100644 --- a/src/types/guilds/premium_tiers.ts +++ b/src/types/guilds/premium_tiers.ts @@ -9,3 +9,6 @@ export enum DiscordPremiumTiers { /** Guild has unlocked Server Boost level 3 perks */ TIER_3, } + +export type PremiumTiers = DiscordPremiumTiers; +export const PremiumTiers = DiscordPremiumTiers; diff --git a/src/types/guilds/request_guild_members.ts b/src/types/guilds/request_guild_members.ts index 89d29feea..98cd10472 100644 --- a/src/types/guilds/request_guild_members.ts +++ b/src/types/guilds/request_guild_members.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/topics/gateway#request-guild-members */ export interface RequestGuildMembers { /** id of the guild to get members for */ guildId: string; @@ -14,8 +13,3 @@ export interface RequestGuildMembers { /** Nonce to identify the Guild Members Chunk response */ nonce?: string; } - -/** https://discord.com/developers/docs/topics/gateway#request-guild-members */ -export type DiscordRequestGuildMembers = SnakeCasedPropertiesDeep< - RequestGuildMembers ->; diff --git a/src/types/guilds/system_channel_flags.ts b/src/types/guilds/system_channel_flags.ts index 6738e4167..a2aebd752 100644 --- a/src/types/guilds/system_channel_flags.ts +++ b/src/types/guilds/system_channel_flags.ts @@ -7,3 +7,6 @@ export enum DiscordSystemChannelFlags { /** Suppress server setup tips */ SUPPRESS_GUILD_REMINDER_NOTIFICATIONS = 1 << 2, } + +export type SystemChannelFlags = DiscordSystemChannelFlags; +export const SystemChannelFlags = DiscordSystemChannelFlags; diff --git a/src/types/guilds/unavailable_guild.ts b/src/types/guilds/unavailable_guild.ts index d52f8c5fe..25de4d61a 100644 --- a/src/types/guilds/unavailable_guild.ts +++ b/src/types/guilds/unavailable_guild.ts @@ -1,9 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { Guild } from "./guild.ts"; -export type UnavailableGuild = Pick; - /** https://discord.com/developers/docs/resources/guild#unavailable-guild-object */ -export type DiscordUnavailableGuild = SnakeCasedPropertiesDeep< - UnavailableGuild ->; +export type UnavailableGuild = Pick; diff --git a/src/types/guilds/update_others_voice_state.ts b/src/types/guilds/update_others_voice_state.ts index 6b4c5aa8f..87f524582 100644 --- a/src/types/guilds/update_others_voice_state.ts +++ b/src/types/guilds/update_others_voice_state.ts @@ -1,13 +1,7 @@ -import { SnakeCaseProps } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/guild#update-user-voice-state */ export interface UpdateOthersVoiceState { /** The id of the channel the user is currently in */ channelId: string; /** Toggles the user's suppress state */ suppress?: boolean; } - -// TODO: add corresponding link to the resource -export type DiscordUpdateOthersVoiceState = SnakeCaseProps< - UpdateOthersVoiceState ->; diff --git a/src/types/guilds/update_self_voice_state.ts b/src/types/guilds/update_self_voice_state.ts index 120b60c8e..475a55a75 100644 --- a/src/types/guilds/update_self_voice_state.ts +++ b/src/types/guilds/update_self_voice_state.ts @@ -1,5 +1,4 @@ -import { SnakeCaseProps } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/guild#update-current-user-voice-state */ export interface UpdateSelfVoiceState { /** The id of the channel the user is currently in */ channelId: string; @@ -8,6 +7,3 @@ export interface UpdateSelfVoiceState { /** Sets the user's request to speak */ requestToSpeakTimestamp?: string | null; } - -// TODO: add corresponding link to the resource -export type DiscordUpdateSelfVoiceState = SnakeCaseProps; diff --git a/src/types/guilds/verification_levels.ts b/src/types/guilds/verification_levels.ts index 67d11bab8..5e4e5f98e 100644 --- a/src/types/guilds/verification_levels.ts +++ b/src/types/guilds/verification_levels.ts @@ -11,3 +11,6 @@ export enum DiscordVerificationLevels { /** Must have a verified phone number */ VERY_HIGH, } + +export type VerificationLevels = DiscordVerificationLevels; +export const VerificationLevels = DiscordVerificationLevels; diff --git a/src/types/guilds/welcome_screen.ts b/src/types/guilds/welcome_screen.ts index 092b35ebb..f13f319fe 100644 --- a/src/types/guilds/welcome_screen.ts +++ b/src/types/guilds/welcome_screen.ts @@ -1,12 +1,9 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { WelcomeScreenChannel } from "./welcome_screen_channel.ts"; +/** https://discord.com/developers/docs/resources/guild#welcome-screen-object-welcome-screen-structure */ export interface WelcomeScreen { /** The server description shown in the welcome screen */ description: string | null; /** The channels shown in the welcome screen, up to 5 */ welcomeChannels: WelcomeScreenChannel[]; } - -/** https://discord.com/developers/docs/resources/guild#welcome-screen-object-welcome-screen-structure */ -export type DiscordWelcomeScreen = SnakeCasedPropertiesDeep; diff --git a/src/types/guilds/welcome_screen_channel.ts b/src/types/guilds/welcome_screen_channel.ts index 0b44d9c94..3abfd3802 100644 --- a/src/types/guilds/welcome_screen_channel.ts +++ b/src/types/guilds/welcome_screen_channel.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/guild#welcome-screen-object-welcome-screen-channel-structure */ export interface WelcomeScreenChannel { /** The channel's id */ channelId: string; @@ -10,8 +9,3 @@ export interface WelcomeScreenChannel { /** The emoji name if custom, the unicode character if standard, or `null` if no emoji is set */ emojiName: string | null; } - -/** https://discord.com/developers/docs/resources/guild#welcome-screen-object-welcome-screen-channel-structure */ -export type DiscordWelcomeScreenChannel = SnakeCasedPropertiesDeep< - WelcomeScreenChannel ->; diff --git a/src/types/integration/guild_integrations_update.ts b/src/types/integration/guild_integrations_update.ts index e29351c75..764bbe9cb 100644 --- a/src/types/integration/guild_integrations_update.ts +++ b/src/types/integration/guild_integrations_update.ts @@ -1,11 +1,5 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/topics/gateway#guild-integrations-update */ export interface GuildIntegrationsUpdate { /** id of the guild whose integrations were updated */ guildId: string; } - -/** https://discord.com/developers/docs/topics/gateway#guild-integrations-update */ -export type DiscordGuildIntegrationsUpdate = SnakeCasedPropertiesDeep< - GuildIntegrationsUpdate ->; diff --git a/src/types/integration/integration.ts b/src/types/integration/integration.ts index 0ddb7e7aa..8da189369 100644 --- a/src/types/integration/integration.ts +++ b/src/types/integration/integration.ts @@ -1,9 +1,9 @@ import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { IntegrationAccount } from "./integration_account.ts"; import { IntegrationApplication } from "./integration_application.ts"; import { DiscordIntegrationExpireBehaviors } from "./integration_expire_behaviors.ts"; +/** https://discord.com/developers/docs/resources/guild#integration-object-integration-structure */ export interface Integration { /** Integration Id */ id: string; @@ -36,6 +36,3 @@ export interface Integration { /** The bot/OAuth2 application for discord integrations */ application?: IntegrationApplication; } - -/** https://discord.com/developers/docs/resources/guild#integration-object-integration-structure */ -export type DiscordIntegration = SnakeCasedPropertiesDeep; diff --git a/src/types/integration/integration_account.ts b/src/types/integration/integration_account.ts index d22707860..35ceb8497 100644 --- a/src/types/integration/integration_account.ts +++ b/src/types/integration/integration_account.ts @@ -1,9 +1,7 @@ +/** https://discord.com/developers/docs/resources/guild#integration-account-object-integration-account-structure */ export interface IntegrationAccount { /** Id of the account */ id: string; /** Name of the account */ name: string; } - -/** https://discord.com/developers/docs/resources/guild#integration-account-object-integration-account-structure */ -export type DiscordIntegrationAccount = IntegrationAccount; diff --git a/src/types/integration/integration_application.ts b/src/types/integration/integration_application.ts index 0b20531b3..1b3d20ade 100644 --- a/src/types/integration/integration_application.ts +++ b/src/types/integration/integration_application.ts @@ -1,6 +1,6 @@ import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/resources/guild#integration-application-object-integration-application-structure */ export interface IntegrationApplication { /** The id of the app */ id: string; @@ -15,8 +15,3 @@ export interface IntegrationApplication { /** The bot associated with this application */ bot?: User; } - -/** https://discord.com/developers/docs/resources/guild#integration-application-object-integration-application-structure */ -export type DiscordIntegrationApplication = SnakeCasedPropertiesDeep< - IntegrationApplication ->; diff --git a/src/types/integration/integration_create_update.ts b/src/types/integration/integration_create_update.ts index dda32b493..43a04ec67 100644 --- a/src/types/integration/integration_create_update.ts +++ b/src/types/integration/integration_create_update.ts @@ -1,12 +1,7 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { Integration } from "./integration.ts"; +/** https://github.com/discord/discord-api-docs/blob/master/docs/topics/Gateway.md#integration-create-event-additional-fields */ export interface IntegrationCreateUpdate extends Integration { /** Id of the guild */ guildId: string; } - -/** https://github.com/discord/discord-api-docs/blob/master/docs/topics/Gateway.md#integration-create-event-additional-fields */ -export type DiscordIntegrationCreateUpdate = SnakeCasedPropertiesDeep< - IntegrationCreateUpdate ->; diff --git a/src/types/integration/integration_delete.ts b/src/types/integration/integration_delete.ts index 83d090299..68f488ebe 100644 --- a/src/types/integration/integration_delete.ts +++ b/src/types/integration/integration_delete.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://github.com/discord/discord-api-docs/blob/master/docs/topics/Gateway.md#integration-delete-event-fields */ export interface IntegrationDelete { /** Integration id */ id: string; @@ -8,8 +7,3 @@ export interface IntegrationDelete { /** Id of the bot/OAuth2 application for this discord integration */ applicationId?: string; } - -/** https://github.com/discord/discord-api-docs/blob/master/docs/topics/Gateway.md#integration-delete-event-fields */ -export type DiscordIntegrationDelete = SnakeCasedPropertiesDeep< - IntegrationDelete ->; diff --git a/src/types/integration/integration_expire_behaviors.ts b/src/types/integration/integration_expire_behaviors.ts index 65c6e5c46..da2799d89 100644 --- a/src/types/integration/integration_expire_behaviors.ts +++ b/src/types/integration/integration_expire_behaviors.ts @@ -3,3 +3,6 @@ export enum DiscordIntegrationExpireBehaviors { RemoveRole, Kick, } + +export type IntegrationExpireBehaviors = DiscordIntegrationExpireBehaviors; +export const IntegrationExpireBehaviors = DiscordIntegrationExpireBehaviors; diff --git a/src/types/interactions/application_command.ts b/src/types/interactions/application_command.ts index 24cae6c8d..d6ac55f86 100644 --- a/src/types/interactions/application_command.ts +++ b/src/types/interactions/application_command.ts @@ -1,6 +1,6 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { ApplicationCommandOption } from "./application_command_option.ts"; +/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommand */ export interface ApplicationCommand { /** Unique id of the command */ id: string; @@ -15,8 +15,3 @@ export interface ApplicationCommand { /** Whether the command is enbaled by default when the app is added to a guild */ defaultPermission?: boolean; } - -/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommand */ -export type DiscordApplicationCommand = SnakeCasedPropertiesDeep< - ApplicationCommand ->; diff --git a/src/types/interactions/application_command_callback_data.ts b/src/types/interactions/application_command_callback_data.ts index e5443854e..5844862d2 100644 --- a/src/types/interactions/application_command_callback_data.ts +++ b/src/types/interactions/application_command_callback_data.ts @@ -1,7 +1,7 @@ import { Embed } from "../embeds/embed.ts"; import { AllowedMentions } from "../messages/allowed_mentions.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/interactions/slash-commands#interaction-response-interactionapplicationcommandcallbackdata */ export interface InteractionApplicationCommandCallbackData { /** Is the response TTS */ tts?: boolean; @@ -14,7 +14,3 @@ export interface InteractionApplicationCommandCallbackData { /** Set to `64` to make your response ephemeral */ flags?: number; } - -/** https://discord.com/developers/docs/interactions/slash-commands#interaction-response-interactionapplicationcommandcallbackdata */ -export type DiscordInteractionApplicationCommandCallbackData = - SnakeCasedPropertiesDeep; diff --git a/src/types/interactions/application_command_create_update_delete.ts b/src/types/interactions/application_command_create_update_delete.ts index 83aaaba9a..2d5f57640 100644 --- a/src/types/interactions/application_command_create_update_delete.ts +++ b/src/types/interactions/application_command_create_update_delete.ts @@ -1,12 +1,8 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { ApplicationCommand } from "./application_command.ts"; +/** https://discord.com/developers/docs/topics/gateway#application-command-delete-application-command-extra-fields */ export interface ApplicationCommandCreateUpdateDelete extends ApplicationCommand { /** Id of the guild the command is in */ guildId?: string; } - -/** https://discord.com/developers/docs/topics/gateway#application-command-delete-application-command-extra-fields */ -export type DiscordApplicationCommandCreateUpdateDelete = - SnakeCasedPropertiesDeep; diff --git a/src/types/interactions/application_command_interaction_data.ts b/src/types/interactions/application_command_interaction_data.ts index 5d7502664..e209cd208 100644 --- a/src/types/interactions/application_command_interaction_data.ts +++ b/src/types/interactions/application_command_interaction_data.ts @@ -1,7 +1,7 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { ApplicationCommandInteractionDataOption } from "./application_command_interaction_data_option.ts"; import { ApplicationCommandInteractionDataResolved } from "./application_command_interaction_data_resolved.ts"; +/** https://discord.com/developers/docs/interactions/slash-commands#interaction-applicationcommandinteractiondata */ export interface ApplicationCommandInteractionData { /** The Id of the invoked command */ id?: string; @@ -16,8 +16,3 @@ export interface ApplicationCommandInteractionData { /** The type of this component */ componentType?: 2; } - -/** https://discord.com/developers/docs/interactions/slash-commands#interaction-applicationcommandinteractiondata */ -export type DiscordApplicationCommandInteractionData = SnakeCasedPropertiesDeep< - ApplicationCommandInteractionData ->; diff --git a/src/types/interactions/application_command_interaction_data_option.ts b/src/types/interactions/application_command_interaction_data_option.ts index 2915656b4..99421663d 100644 --- a/src/types/interactions/application_command_interaction_data_option.ts +++ b/src/types/interactions/application_command_interaction_data_option.ts @@ -1,6 +1,6 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { DiscordApplicationCommandOptionTypes } from "./application_command_option_types.ts"; +/** https://discord.com/developers/docs/interactions/slash-commands#interaction-applicationcommandinteractiondataoption */ export interface ApplicationCommandInteractionDataOption { /** The name of the parameter */ name: string; @@ -11,7 +11,3 @@ export interface ApplicationCommandInteractionDataOption { /** Present if this option is a group or subcommand */ options?: ApplicationCommandInteractionDataOption[]; } - -/** https://discord.com/developers/docs/interactions/slash-commands#interaction-applicationcommandinteractiondataoption */ -export type DiscordApplicationCommandInteractionDataOption = - SnakeCasedPropertiesDeep; diff --git a/src/types/interactions/application_command_option.ts b/src/types/interactions/application_command_option.ts index 1491c8898..c8ebbfb3d 100644 --- a/src/types/interactions/application_command_option.ts +++ b/src/types/interactions/application_command_option.ts @@ -1,7 +1,7 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { ApplicationCommandOptionChoice } from "./application_command_option_choice.ts"; import { DiscordApplicationCommandOptionTypes } from "./application_command_option_types.ts"; +/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoption */ export interface ApplicationCommandOption { /** Value of Application Command Option Type */ type: DiscordApplicationCommandOptionTypes; @@ -16,8 +16,3 @@ export interface ApplicationCommandOption { /** If the optino is a subcommand or subcommand group type, this nested options will be the parameters */ options?: ApplicationCommandOption[]; } - -/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoption */ -export type DiscordApplicationCommandOption = SnakeCasedPropertiesDeep< - ApplicationCommandOption ->; diff --git a/src/types/interactions/application_command_option_choice.ts b/src/types/interactions/application_command_option_choice.ts index 7bde91922..78f1846fd 100644 --- a/src/types/interactions/application_command_option_choice.ts +++ b/src/types/interactions/application_command_option_choice.ts @@ -1,10 +1,7 @@ +/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoptionchoice */ export interface ApplicationCommandOptionChoice { /** 1-100 character choice name */ name: string; /** Value of the choice, up to 100 characters if string */ value: string | number; } - -/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoptionchoice */ -export type DiscordApplicationCommandOptionChoice = - ApplicationCommandOptionChoice; diff --git a/src/types/interactions/application_command_option_types.ts b/src/types/interactions/application_command_option_types.ts index 5416ce41a..da0f2ed76 100644 --- a/src/types/interactions/application_command_option_types.ts +++ b/src/types/interactions/application_command_option_types.ts @@ -8,4 +8,10 @@ export enum DiscordApplicationCommandOptionTypes { USER, CHANNEL, ROLE, + MENTIONABLE, } + +export type ApplicationCommandOptionTypes = + DiscordApplicationCommandOptionTypes; +export const ApplicationCommandOptionTypes = + DiscordApplicationCommandOptionTypes; diff --git a/src/types/interactions/application_command_permission_types.ts b/src/types/interactions/application_command_permission_types.ts index db383458c..e07a172c7 100644 --- a/src/types/interactions/application_command_permission_types.ts +++ b/src/types/interactions/application_command_permission_types.ts @@ -2,3 +2,8 @@ export enum DiscordApplicationCommandPermissionTypes { Role = 1, User, } + +export type ApplicationCommandPermissionTypes = + DiscordApplicationCommandPermissionTypes; +export const ApplicationCommandPermissionTypes = + DiscordApplicationCommandPermissionTypes; diff --git a/src/types/interactions/application_command_permissions.ts b/src/types/interactions/application_command_permissions.ts index 48453dfeb..197ce20db 100644 --- a/src/types/interactions/application_command_permissions.ts +++ b/src/types/interactions/application_command_permissions.ts @@ -1,5 +1,6 @@ import { DiscordApplicationCommandPermissionTypes } from "./application_command_permission_types.ts"; +/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommandpermissions */ export interface ApplicationCommandPermissions { /** The id of the role or user */ id: string; @@ -8,7 +9,3 @@ export interface ApplicationCommandPermissions { /** `true` to allow, `false`, to disallow */ permission: boolean; } - -/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommandpermissions */ -export type DiscordApplicationCommandPermissions = - ApplicationCommandPermissions; diff --git a/src/types/interactions/create_global_application_command.ts b/src/types/interactions/create_global_application_command.ts index 760141db4..0779e8207 100644 --- a/src/types/interactions/create_global_application_command.ts +++ b/src/types/interactions/create_global_application_command.ts @@ -1,6 +1,6 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { ApplicationCommandOption } from "./application_command_option.ts"; +/** https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command-json-params */ export interface CreateGlobalApplicationCommand { /** 1-31 character name matching `^[\w-]{1,32}$` */ name: string; @@ -9,8 +9,3 @@ export interface CreateGlobalApplicationCommand { /** The parameters for the command */ options?: ApplicationCommandOption[]; } - -/** https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command-json-params */ -export type DiscordCreateGlobalApplicationCommand = SnakeCasedPropertiesDeep< - CreateGlobalApplicationCommand ->; diff --git a/src/types/interactions/create_guild_application_command.ts b/src/types/interactions/create_guild_application_command.ts index 8c6520826..1053452eb 100644 --- a/src/types/interactions/create_guild_application_command.ts +++ b/src/types/interactions/create_guild_application_command.ts @@ -1,6 +1,6 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { ApplicationCommandOption } from "./application_command_option.ts"; +/** https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command-json-params */ export interface CreateGuildApplicationCommand { /** 1-31 character name matching `^[\w-]{1,32}$` */ name: string; @@ -9,8 +9,3 @@ export interface CreateGuildApplicationCommand { /** The parameters for the command */ options?: ApplicationCommandOption[]; } - -/** https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command-json-params */ -export type DiscordCreateGuildApplicationCommand = SnakeCasedPropertiesDeep< - CreateGuildApplicationCommand ->; diff --git a/src/types/interactions/edit_global_application_command.ts b/src/types/interactions/edit_global_application_command.ts index a9cc2e088..da4f9a0b0 100644 --- a/src/types/interactions/edit_global_application_command.ts +++ b/src/types/interactions/edit_global_application_command.ts @@ -1,6 +1,6 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { ApplicationCommandOption } from "./application_command_option.ts"; +/** https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command-json-params */ export interface EditGlobalApplicationCommand { /** 1-31 character name matching `^[\w-]{1,32}$` */ name?: string; @@ -9,8 +9,3 @@ export interface EditGlobalApplicationCommand { /** The parameters for the command */ options?: ApplicationCommandOption[] | null; } - -/** https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command-json-params */ -export type DiscordEditGlobalApplicationCommand = SnakeCasedPropertiesDeep< - EditGlobalApplicationCommand ->; diff --git a/src/types/interactions/edit_guild_application_command.ts b/src/types/interactions/edit_guild_application_command.ts index d5139f065..e3c842694 100644 --- a/src/types/interactions/edit_guild_application_command.ts +++ b/src/types/interactions/edit_guild_application_command.ts @@ -1,6 +1,6 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { ApplicationCommandOption } from "./application_command_option.ts"; +/** https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command-json-params */ export interface EditGuildApplicationCommand { /** 1-31 character name matching `^[\w-]{1,32}$` */ name?: string; @@ -9,8 +9,3 @@ export interface EditGuildApplicationCommand { /** The parameters for the command */ options?: ApplicationCommandOption[] | null; } - -/** https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command-json-params */ -export type DiscordEditGuildApplicationCommand = SnakeCasedPropertiesDeep< - EditGuildApplicationCommand ->; diff --git a/src/types/interactions/guild_application_command_permissions.ts b/src/types/interactions/guild_application_command_permissions.ts index 6845e90d7..3f940e399 100644 --- a/src/types/interactions/guild_application_command_permissions.ts +++ b/src/types/interactions/guild_application_command_permissions.ts @@ -1,6 +1,6 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { ApplicationCommandPermissions } from "./application_command_permissions.ts"; +/** https://discord.com/developers/docs/interactions/slash-commands#guildapplicationcommandpermissions */ export interface GuildApplicationCommandPermissions { /** The id of the command */ id: string; @@ -11,7 +11,3 @@ export interface GuildApplicationCommandPermissions { /** The permissions for the command in the guild */ permissions: ApplicationCommandPermissions[]; } - -/** https://discord.com/developers/docs/interactions/slash-commands#guildapplicationcommandpermissions */ -export type DiscordGuildApplicationCommandPermissions = - SnakeCasedPropertiesDeep; diff --git a/src/types/interactions/interaction.ts b/src/types/interactions/interaction.ts index 8578c7f62..ed6bcd9f0 100644 --- a/src/types/interactions/interaction.ts +++ b/src/types/interactions/interaction.ts @@ -1,10 +1,10 @@ import { GuildMemberWithUser } from "../guilds/guild_member.ts"; import { Message } from "../messages/message.ts"; import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { ApplicationCommandInteractionData } from "./application_command_interaction_data.ts"; import { DiscordInteractionTypes } from "./interaction_types.ts"; +/** https://discord.com/developers/docs/interactions/slash-commands#interaction */ export interface Interaction { /** Id of the interaction */ id: string; @@ -29,6 +29,3 @@ export interface Interaction { /** for the message the button was attached to */ message?: Message; } - -/** https://discord.com/developers/docs/interactions/slash-commands#interaction */ -export type DiscordInteraction = SnakeCasedPropertiesDeep; diff --git a/src/types/interactions/interaction_guild_member.ts b/src/types/interactions/interaction_guild_member.ts index a37e50b9b..fb9cebc78 100644 --- a/src/types/interactions/interaction_guild_member.ts +++ b/src/types/interactions/interaction_guild_member.ts @@ -1,12 +1,7 @@ import { GuildMember } from "../guilds/guild_member.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/resources/guild#guild-member-object */ export interface InteractionGuildMember extends GuildMember { /** Total permissions of the member in the channel, including overrides, returned when in the interaction object */ permissions: string; } - -/** https://discord.com/developers/docs/resources/guild#guild-member-object */ -export type DiscordInteractionGuildMember = SnakeCasedPropertiesDeep< - InteractionGuildMember ->; diff --git a/src/types/interactions/interaction_response.ts b/src/types/interactions/interaction_response.ts index 044437e74..5460cbb4e 100644 --- a/src/types/interactions/interaction_response.ts +++ b/src/types/interactions/interaction_response.ts @@ -1,15 +1,10 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { InteractionApplicationCommandCallbackData } from "./application_command_callback_data.ts"; import { DiscordInteractionResponseTypes } from "./interaction_response_types.ts"; +/** https://discord.com/developers/docs/interactions/slash-commands#interaction-response */ export interface InteractionResponse { /** The type of response */ type: DiscordInteractionResponseTypes; /** An optional response message */ data?: InteractionApplicationCommandCallbackData; } - -/** https://discord.com/developers/docs/interactions/slash-commands#interaction-response */ -export type DiscordInteractionResponse = SnakeCasedPropertiesDeep< - InteractionResponse ->; diff --git a/src/types/interactions/interaction_response_types.ts b/src/types/interactions/interaction_response_types.ts index 122f22995..2fc9b09c6 100644 --- a/src/types/interactions/interaction_response_types.ts +++ b/src/types/interactions/interaction_response_types.ts @@ -9,3 +9,6 @@ export enum DiscordInteractionResponseTypes { /** It has no data fields. You can send this type **only in response to a button interaction .** It will acknowledge the interaction and update the button to a loading state. */ DeferredMessageUpdate, } + +export type InteractionResponseTypes = DiscordInteractionResponseTypes; +export const InteractionResponseTypes = DiscordInteractionResponseTypes; diff --git a/src/types/interactions/interaction_types.ts b/src/types/interactions/interaction_types.ts index 099c63999..2d0e4e592 100644 --- a/src/types/interactions/interaction_types.ts +++ b/src/types/interactions/interaction_types.ts @@ -4,3 +4,6 @@ export enum DiscordInteractionTypes { ApplicationCommand, Button } + +export type InteractionTypes = DiscordInteractionTypes; +export const InteractionTypes = DiscordInteractionTypes; diff --git a/src/types/interactions/message_interaction.ts b/src/types/interactions/message_interaction.ts index 2ceb98aca..c1471ede1 100644 --- a/src/types/interactions/message_interaction.ts +++ b/src/types/interactions/message_interaction.ts @@ -1,7 +1,7 @@ import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { DiscordInteractionTypes } from "./interaction_types.ts"; +/** https://discord.com/developers/docs/interactions/slash-commands#messageinteraction */ export interface MessageInteraction { /** Id of the interaction */ id: string; @@ -12,8 +12,3 @@ export interface MessageInteraction { /** The user who invoked the interaction */ user: User; } - -/** https://discord.com/developers/docs/interactions/slash-commands#messageinteraction */ -export type DiscordMessageInteraction = SnakeCasedPropertiesDeep< - MessageInteraction ->; diff --git a/src/types/invites/get_invite.ts b/src/types/invites/get_invite.ts index a7b9a4411..d071d1569 100644 --- a/src/types/invites/get_invite.ts +++ b/src/types/invites/get_invite.ts @@ -1,9 +1,7 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/invite#get-invite */ export interface GetInvite { /** Whether the invite should contain approximate member counts */ withCounts?: boolean; + /** Whether the invite should contain the expiration date */ + withExpiration?: boolean; } - -/** https://discord.com/developers/docs/resources/invite#get-invite */ -export type DiscordGetInvite = SnakeCasedPropertiesDeep; diff --git a/src/types/invites/invite.ts b/src/types/invites/invite.ts index 30a4c3e22..107016a8f 100644 --- a/src/types/invites/invite.ts +++ b/src/types/invites/invite.ts @@ -2,9 +2,9 @@ import { Channel } from "../channels/channel.ts"; import { Guild } from "../guilds/guild.ts"; import { Application } from "../oauth2/application.ts"; import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { DiscordTargetTypes } from "./target_types.ts"; +/** https://discord.com/developers/docs/resources/invite#invite-object */ export interface Invite { /** The invite code (unique Id) */ code: string; @@ -24,7 +24,6 @@ export interface Invite { approximatePresenceCount?: number; /** Approximate count of total members */ approximateMemberCount?: number; + /** The expiration date of this invite, returned from the `GET /invites/` endpoint when `with_expiration` is `true` */ + expiresAt?: string | null; } - -/** https://discord.com/developers/docs/resources/invite#invite-object */ -export type DiscordInvite = SnakeCasedPropertiesDeep; diff --git a/src/types/invites/invite_create.ts b/src/types/invites/invite_create.ts index cb194d5a4..3178946dc 100644 --- a/src/types/invites/invite_create.ts +++ b/src/types/invites/invite_create.ts @@ -1,8 +1,8 @@ import { Application } from "../oauth2/application.ts"; import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { DiscordTargetTypes } from "./target_types.ts"; +/** https://discord.com/developers/docs/topics/gateway#invite-create */ export interface InviteCreate { /** The channel the invite is for */ channelId: string; @@ -29,6 +29,3 @@ export interface InviteCreate { /** How many times the invite has been used (always will be 0) */ uses: number; } - -/** https://discord.com/developers/docs/topics/gateway#invite-create */ -export type DiscordInviteCreate = SnakeCasedPropertiesDeep; diff --git a/src/types/invites/invite_delete.ts b/src/types/invites/invite_delete.ts index df324bdd3..0f80aeae1 100644 --- a/src/types/invites/invite_delete.ts +++ b/src/types/invites/invite_delete.ts @@ -1,5 +1,3 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - /** https://discord.com/developers/docs/topics/gateway#invite-delete */ export interface InviteDelete { /** The channel of the invite */ @@ -9,5 +7,3 @@ export interface InviteDelete { /** The unique invite code */ code: string; } - -export type DiscordInviteDelete = SnakeCasedPropertiesDeep; diff --git a/src/types/invites/invite_metadata.ts b/src/types/invites/invite_metadata.ts index ec43a2414..61f1fc3bd 100644 --- a/src/types/invites/invite_metadata.ts +++ b/src/types/invites/invite_metadata.ts @@ -1,6 +1,6 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { Invite } from "./invite.ts"; +/** https://discord.com/developers/docs/resources/invite#invite-metadata-object */ export interface InviteMetadata extends Invite { /** Number of times this invite has been used */ uses: number; @@ -13,6 +13,3 @@ export interface InviteMetadata extends Invite { /** When this invite was created */ createdAt: string; } - -/** https://discord.com/developers/docs/resources/invite#invite-metadata-object */ -export type DiscordInviteMetadata = SnakeCasedPropertiesDeep; diff --git a/src/types/invites/invite_target_types.ts b/src/types/invites/invite_target_types.ts index b645e9b96..ddc29d2b2 100644 --- a/src/types/invites/invite_target_types.ts +++ b/src/types/invites/invite_target_types.ts @@ -3,3 +3,6 @@ export enum DiscordInviteTargetTypes { Stream = 1, EmbeddedApplication, } + +export type InviteTargetTypes = DiscordInviteTargetTypes; +export const InviteTargetTypes = DiscordInviteTargetTypes; diff --git a/src/types/invites/target_types.ts b/src/types/invites/target_types.ts index 957391f48..c8f16d0ac 100644 --- a/src/types/invites/target_types.ts +++ b/src/types/invites/target_types.ts @@ -3,3 +3,6 @@ export enum DiscordTargetTypes { STREAM = 1, EMBEDDED_APPLICATION, } + +export type TargetTypes = DiscordTargetTypes; +export const TargetTypes = DiscordTargetTypes; diff --git a/src/types/members/guild_member_add.ts b/src/types/members/guild_member_add.ts index a92d651d3..a39685228 100644 --- a/src/types/members/guild_member_add.ts +++ b/src/types/members/guild_member_add.ts @@ -1,10 +1,7 @@ import { GuildMemberWithUser } from "../guilds/guild_member.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/topics/gateway#guild-member-add */ export interface GuildMemberAdd extends GuildMemberWithUser { /** id of the guild */ guildId: string; } - -/** https://discord.com/developers/docs/topics/gateway#guild-member-add */ -export type DiscordGuildMemberAdd = SnakeCasedPropertiesDeep; diff --git a/src/types/members/guild_member_remove.ts b/src/types/members/guild_member_remove.ts index 21010be0c..ea791e6ff 100644 --- a/src/types/members/guild_member_remove.ts +++ b/src/types/members/guild_member_remove.ts @@ -1,14 +1,9 @@ import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/topics/gateway#guild-member-remove */ export interface GuildMemberRemove { /** The id of the guild */ guildId: string; /** The user who was removed */ user: User; } - -/** https://discord.com/developers/docs/topics/gateway#guild-member-remove */ -export type DiscordGuildMemberRemove = SnakeCasedPropertiesDeep< - GuildMemberRemove ->; diff --git a/src/types/members/guild_member_update.ts b/src/types/members/guild_member_update.ts index c78bb8caf..803318a10 100644 --- a/src/types/members/guild_member_update.ts +++ b/src/types/members/guild_member_update.ts @@ -1,6 +1,6 @@ import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/topics/gateway#guild-member-update */ export interface GuildMemberUpdate { /** The id of the guild */ guildId: string; @@ -21,8 +21,3 @@ export interface GuildMemberUpdate { /** whether the user is muted in voice channels */ mute?: boolean; } - -/** https://discord.com/developers/docs/topics/gateway#guild-member-update */ -export type DiscordGuildMemberUpdate = SnakeCasedPropertiesDeep< - GuildMemberUpdate ->; diff --git a/src/types/members/guild_members_chunk.ts b/src/types/members/guild_members_chunk.ts index d346550e4..a4b801f33 100644 --- a/src/types/members/guild_members_chunk.ts +++ b/src/types/members/guild_members_chunk.ts @@ -1,7 +1,7 @@ import { GuildMemberWithUser } from "../guilds/guild_member.ts"; import { PresenceUpdate } from "../misc/presence_update.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/topics/gateway#guild-members-chunk */ export interface GuildMembersChunk { /** The id of the guild */ guildId: string; @@ -18,8 +18,3 @@ export interface GuildMembersChunk { /** The nonce used in the Guild Members Request */ nonce?: string; } - -/** https://discord.com/developers/docs/topics/gateway#guild-members-chunk */ -export type DiscordGuildMembersChunk = SnakeCasedPropertiesDeep< - GuildMembersChunk ->; diff --git a/src/types/members/search_guild_members.ts b/src/types/members/search_guild_members.ts index 6a984618d..f7da50c16 100644 --- a/src/types/members/search_guild_members.ts +++ b/src/types/members/search_guild_members.ts @@ -1,9 +1,7 @@ +/** https://discord.com/developers/docs/resources/guild#search-guild-members-query-string-params */ export interface SearchGuildMembers { /** Query string to match username(s) and nickname(s) against */ query: string; /** Max number of members to return (1-1000). Default: 1 */ limit?: number; } - -/** https://discord.com/developers/docs/resources/guild#search-guild-members-query-string-params */ -export type DiscordSearchGuildMembers = SearchGuildMembers; diff --git a/src/types/messages/allowed_mentions.ts b/src/types/messages/allowed_mentions.ts index 8054ad286..f5e43a94d 100644 --- a/src/types/messages/allowed_mentions.ts +++ b/src/types/messages/allowed_mentions.ts @@ -1,6 +1,6 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { DiscordAllowedMentionsTypes } from "./allowed_mentions_types.ts"; +/** https://discord.com/developers/docs/resources/channel#allowed-mentions-object */ export interface AllowedMentions { /** An array of allowed mention types to parse from the content. */ parse?: DiscordAllowedMentionsTypes[]; @@ -11,6 +11,3 @@ export interface AllowedMentions { /** For replies, whether to mention the author of the message being replied to (default false) */ repliedUser?: boolean; } - -/** https://discord.com/developers/docs/resources/channel#allowed-mentions-object */ -export type DiscordAllowedMentions = SnakeCasedPropertiesDeep; diff --git a/src/types/messages/allowed_mentions_types.ts b/src/types/messages/allowed_mentions_types.ts index 9c986c36c..48aa8d08f 100644 --- a/src/types/messages/allowed_mentions_types.ts +++ b/src/types/messages/allowed_mentions_types.ts @@ -7,3 +7,6 @@ export enum DiscordAllowedMentionsTypes { /** Controls @everyone and @here mentions */ EveryoneMentions = "everyone", } + +export type AllowedMentionsTypes = DiscordAllowedMentionsTypes; +export const AllowedMentionsTypes = DiscordAllowedMentionsTypes; diff --git a/src/types/messages/attachment.ts b/src/types/messages/attachment.ts index 638945348..62bc4fc07 100644 --- a/src/types/messages/attachment.ts +++ b/src/types/messages/attachment.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/channel#attachment-object */ export interface Attachment { /** Attachment id */ id: string; @@ -18,6 +17,3 @@ export interface Attachment { /** Width of file (if image) */ width?: number | null; } - -/** https://discord.com/developers/docs/resources/channel#attachment-object */ -export type DiscordAttachment = SnakeCasedPropertiesDeep; diff --git a/src/types/messages/create_message.ts b/src/types/messages/create_message.ts index fa1704f90..836b0040c 100644 --- a/src/types/messages/create_message.ts +++ b/src/types/messages/create_message.ts @@ -28,3 +28,5 @@ export interface CreateMessage { export type DiscordCreateMessage = SnakeCasedPropertiesDeep< Omit >; + +// TODO: check this diff --git a/src/types/messages/edit_message.ts b/src/types/messages/edit_message.ts index fc586dab8..41169bc55 100644 --- a/src/types/messages/edit_message.ts +++ b/src/types/messages/edit_message.ts @@ -1,7 +1,8 @@ import { Embed } from "../embeds/embed.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { AllowedMentions } from "./allowed_mentions.ts"; +import { Attachment } from "./attachment.ts"; +/** https://discord.com/developers/docs/resources/channel#edit-message-json-params */ export interface EditMessage { /** The new message contents (up to 2000 characters) */ content?: string | null; @@ -11,7 +12,6 @@ export interface EditMessage { flags?: 4 | null; /** Allowed mentions for the message */ allowedMentions?: AllowedMentions | null; + /** Attached files to keep */ + attachments?: Attachment | null; } - -/** https://discord.com/developers/docs/resources/channel#edit-message-json-params */ -export type DiscordEditMessage = SnakeCasedPropertiesDeep; diff --git a/src/types/messages/get_messages.ts b/src/types/messages/get_messages.ts index 3c5767f99..9231d5577 100644 --- a/src/types/messages/get_messages.ts +++ b/src/types/messages/get_messages.ts @@ -1,28 +1,30 @@ +/** https://discord.com/developers/docs/resources/channel#get-channel-messages-query-string-params */ export interface GetMessagesLimit { /** Max number of messages to return (1-100) default 50 */ limit?: number; } +/** https://discord.com/developers/docs/resources/channel#get-channel-messages-query-string-params */ export interface GetMessagesAround extends GetMessagesLimit { /** Get messages around this message id */ around?: string; } +/** https://discord.com/developers/docs/resources/channel#get-channel-messages-query-string-params */ export interface GetMessagesBefore extends GetMessagesLimit { /** Get messages before this message id */ before?: string; } +/** https://discord.com/developers/docs/resources/channel#get-channel-messages-query-string-params */ export interface GetMessagesAfter extends GetMessagesLimit { /** Get messages after this message id */ after?: string; } +/** https://discord.com/developers/docs/resources/channel#get-channel-messages-query-string-params */ export type GetMessages = & GetMessagesLimit & GetMessagesAfter & GetMessagesBefore & GetMessagesAround; - -/** https://discord.com/developers/docs/resources/channel#get-channel-messages-query-string-params */ -export type DiscordGetMessages = GetMessages; diff --git a/src/types/messages/message.ts b/src/types/messages/message.ts index bfc456465..330152008 100644 --- a/src/types/messages/message.ts +++ b/src/types/messages/message.ts @@ -4,15 +4,15 @@ import { GuildMember } from "../guilds/guild_member.ts"; import { MessageInteraction } from "../interactions/message_interaction.ts"; import { Application } from "../oauth2/application.ts"; import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { Attachment } from "./attachment.ts"; import { MessageComponents } from "./components/message_components.ts"; import { MessageActivity } from "./message_activity.ts"; import { MessageReference } from "./message_reference.ts"; import { MessageSticker } from "./message_sticker.ts"; import { DiscordMessageTypes } from "./message_types.ts"; -import { DiscordReaction } from "./reaction.ts"; +import { Reaction } from "./reaction.ts"; +/** https://discord.com/developers/docs/resources/channel#message-object */ export interface Message { /** id of the message */ id: string; @@ -57,7 +57,7 @@ export interface Message { /** Any embedded content */ embeds: Embed[]; /** Reactions to the message */ - reactions?: DiscordReaction[]; + reactions?: Reaction[]; /** Used for validating a message was sent */ nonce?: number | string; /** Whether this message is pinned */ @@ -86,6 +86,3 @@ export interface Message { /** The components related to this message */ components: MessageComponents; } - -/** https://discord.com/developers/docs/resources/channel#message-object */ -export type DiscordMessage = SnakeCasedPropertiesDeep; diff --git a/src/types/messages/message_activity.ts b/src/types/messages/message_activity.ts index 6cadebd28..8feab94cf 100644 --- a/src/types/messages/message_activity.ts +++ b/src/types/messages/message_activity.ts @@ -1,12 +1,9 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { DiscordMessageActivityTypes } from "./message_activity_types.ts"; +/** https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure */ export interface MessageActivity { /** Type of message activity */ type: DiscordMessageActivityTypes; /** `party_id` from a Rich Presence event */ partyId?: string; } - -/** https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure */ -export type DiscordMessageActivity = SnakeCasedPropertiesDeep; diff --git a/src/types/messages/message_activity_types.ts b/src/types/messages/message_activity_types.ts index 7ec568212..5340111b9 100644 --- a/src/types/messages/message_activity_types.ts +++ b/src/types/messages/message_activity_types.ts @@ -5,3 +5,6 @@ export enum DiscordMessageActivityTypes { LISTEN, JOIN_REQUEST, } + +export type MessageActivityTypes = DiscordMessageActivityTypes; +export const MessageActivityTypes = DiscordMessageActivityTypes; diff --git a/src/types/messages/message_delete.ts b/src/types/messages/message_delete.ts index d292e9e62..222d0d8cf 100644 --- a/src/types/messages/message_delete.ts +++ b/src/types/messages/message_delete.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/topics/gateway#message-delete */ export interface MessageDelete { /** The id of the message */ id: string; @@ -8,6 +7,3 @@ export interface MessageDelete { /** The id of the guild */ guildId?: string; } - -/** https://discord.com/developers/docs/topics/gateway#message-delete */ -export type DiscordMessageDelete = SnakeCasedPropertiesDeep; diff --git a/src/types/messages/message_delete_bulk.ts b/src/types/messages/message_delete_bulk.ts index 9d1a0f163..e4994af86 100644 --- a/src/types/messages/message_delete_bulk.ts +++ b/src/types/messages/message_delete_bulk.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/topics/gateway#message-delete-bulk */ export interface MessageDeleteBulk { /** The ids of the messages */ ids: string[]; @@ -8,8 +7,3 @@ export interface MessageDeleteBulk { /** The id of the guild */ guildId?: string; } - -/** https://discord.com/developers/docs/topics/gateway#message-delete-bulk */ -export type DiscordMessageDeleteBulk = SnakeCasedPropertiesDeep< - MessageDeleteBulk ->; diff --git a/src/types/messages/message_flags.ts b/src/types/messages/message_flags.ts index 4f55463d9..57de222e1 100644 --- a/src/types/messages/message_flags.ts +++ b/src/types/messages/message_flags.ts @@ -15,3 +15,6 @@ export enum DiscordMessageFlags { /** This message is an Interaction Response and the bot is "thinking" */ LOADING = 1 << 7, } + +export type MessageFlags = DiscordMessageFlags; +export const MessageFlags = DiscordMessageFlags; diff --git a/src/types/messages/message_get_reactions.ts b/src/types/messages/message_get_reactions.ts index 2a91ba4fb..615bfd030 100644 --- a/src/types/messages/message_get_reactions.ts +++ b/src/types/messages/message_get_reactions.ts @@ -1,9 +1,7 @@ +/** https://discord.com/developers/docs/resources/channel#get-reactions-query-string-params */ export interface GetReactions { /** 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#get-reactions-query-string-params */ -export type DiscordGetReactions = GetReactions; diff --git a/src/types/messages/message_reaction_add.ts b/src/types/messages/message_reaction_add.ts index af3530ff6..ef3709af3 100644 --- a/src/types/messages/message_reaction_add.ts +++ b/src/types/messages/message_reaction_add.ts @@ -1,7 +1,7 @@ import { Emoji } from "../emojis/emoji.ts"; import { GuildMemberWithUser } from "../guilds/guild_member.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/topics/gateway#message-reaction-add */ export interface MessageReactionAdd { /** The id of the user */ userId: string; @@ -16,8 +16,3 @@ export interface MessageReactionAdd { /** The emoji used to react */ emoji: Partial; } - -/** https://discord.com/developers/docs/topics/gateway#message-reaction-add */ -export type DiscordMessageReactionAdd = SnakeCasedPropertiesDeep< - MessageReactionAdd ->; diff --git a/src/types/messages/message_reaction_remove.ts b/src/types/messages/message_reaction_remove.ts index 8ffd7c996..1fa3f4ef8 100644 --- a/src/types/messages/message_reaction_remove.ts +++ b/src/types/messages/message_reaction_remove.ts @@ -1,9 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { MessageReactionAdd } from "./message_reaction_add.ts"; -export type MessageReactionRemove = Omit; - /** https://discord.com/developers/docs/topics/gateway#message-reaction-remove */ -export type DiscordMessageReactionRemove = SnakeCasedPropertiesDeep< - MessageReactionRemove ->; +export type MessageReactionRemove = Omit; diff --git a/src/types/messages/message_reaction_remove_all.ts b/src/types/messages/message_reaction_remove_all.ts index 6e7264889..b8f91f4bb 100644 --- a/src/types/messages/message_reaction_remove_all.ts +++ b/src/types/messages/message_reaction_remove_all.ts @@ -1,12 +1,7 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { MessageReactionAdd } from "./message_reaction_add.ts"; +/** https://discord.com/developers/docs/topics/gateway#message-reaction-remove-all */ export type MessageReactionRemoveAll = Pick< MessageReactionAdd, "channelId" | "messageId" | "guildId" >; - -/** https://discord.com/developers/docs/topics/gateway#message-reaction-remove-all */ -export type DiscordMessageReactionRemoveAll = SnakeCasedPropertiesDeep< - MessageReactionRemoveAll ->; diff --git a/src/types/messages/message_reaction_remove_emoji.ts b/src/types/messages/message_reaction_remove_emoji.ts index 6460ef99a..829bd0dae 100644 --- a/src/types/messages/message_reaction_remove_emoji.ts +++ b/src/types/messages/message_reaction_remove_emoji.ts @@ -1,12 +1,7 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { MessageReactionAdd } from "./message_reaction_add.ts"; +/** https://discord.com/developers/docs/topics/gateway#message-reaction-remove-emoji */ export type MessageReactionRemoveEmoji = Pick< MessageReactionAdd, "channelId" | "guildId" | "messageId" | "emoji" >; - -/** https://discord.com/developers/docs/topics/gateway#message-reaction-remove-emoji */ -export type DiscordMessageReactionRemoveEmoji = SnakeCasedPropertiesDeep< - MessageReactionRemoveEmoji ->; diff --git a/src/types/messages/message_reference.ts b/src/types/messages/message_reference.ts index ba2b143e8..7978e50cd 100644 --- a/src/types/messages/message_reference.ts +++ b/src/types/messages/message_reference.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure */ export interface MessageReference { /** id of the originating message */ messageId?: string; @@ -13,8 +12,3 @@ export interface MessageReference { /** When sending, whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message, default true */ failIfNotExists: boolean; } - -/** https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure */ -export type DiscordMessageReference = SnakeCasedPropertiesDeep< - MessageReference ->; diff --git a/src/types/messages/message_sticker.ts b/src/types/messages/message_sticker.ts index e7f3b2ff1..d1a9bf04e 100644 --- a/src/types/messages/message_sticker.ts +++ b/src/types/messages/message_sticker.ts @@ -1,6 +1,6 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { DiscordMessageStickerFormatTypes } from "./message_sticker_format_types.ts"; +/** https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure */ export interface MessageSticker { /** id of the sticker */ id: string; @@ -17,14 +17,6 @@ export interface MessageSticker { * Note: The URL for fetching sticker assets is currently private. */ asset: string; - /** - * Sticker preview asset hash - * Note: The URL for fetching sticker assets is currently private. - */ - previewAsset?: string | null; /** Type of sticker format */ formatType: DiscordMessageStickerFormatTypes; } - -/** https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure */ -export type DiscordMessageSticker = SnakeCasedPropertiesDeep; diff --git a/src/types/messages/message_sticker_format_types.ts b/src/types/messages/message_sticker_format_types.ts index 5c271a657..3a2baa629 100644 --- a/src/types/messages/message_sticker_format_types.ts +++ b/src/types/messages/message_sticker_format_types.ts @@ -4,3 +4,6 @@ export enum DiscordMessageStickerFormatTypes { APNG, LOTTIE, } + +export type MessageStickerFormatTypes = DiscordMessageStickerFormatTypes; +export const MessageStickerFormatTypes = DiscordMessageStickerFormatTypes; diff --git a/src/types/messages/message_types.ts b/src/types/messages/message_types.ts index ba4c6a58a..263c8851f 100644 --- a/src/types/messages/message_types.ts +++ b/src/types/messages/message_types.ts @@ -21,3 +21,6 @@ export enum DiscordMessageTypes { APPLICATION_COMMAND, GUILD_INVITE_REMINDER = 22, } + +export type MessageTypes = DiscordMessageTypes; +export const MessageTypes = DiscordMessageTypes; diff --git a/src/types/messages/reaction.ts b/src/types/messages/reaction.ts index dbb30e28c..ff673f604 100644 --- a/src/types/messages/reaction.ts +++ b/src/types/messages/reaction.ts @@ -1,5 +1,6 @@ import { Emoji } from "../emojis/emoji.ts"; +/** https://discord.com/developers/docs/resources/channel#reaction-object */ export interface Reaction { /** Times this emoji has been used to react */ count: number; @@ -8,6 +9,3 @@ export interface Reaction { /** Emoji information */ emoji: Partial; } - -/** https://discord.com/developers/docs/resources/channel#reaction-object */ -export type DiscordReaction = Reaction; diff --git a/src/types/misc/activity.ts b/src/types/misc/activity.ts index abf020027..a56f6102d 100644 --- a/src/types/misc/activity.ts +++ b/src/types/misc/activity.ts @@ -1,4 +1,3 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { ActivityAssets } from "./activity_assets.ts"; import { ActivityButton } from "./activity_button.ts"; import { ActivityEmoji } from "./activity_emoji.ts"; @@ -7,6 +6,7 @@ import { ActivitySecrets } from "./activity_secrets.ts"; import { ActivityTimestamps } from "./activity_timestamps.ts"; import { DiscordActivityTypes } from "./activity_types.ts"; +/** https://discord.com/developers/docs/topics/gateway#activity-object */ export interface Activity { /** The activity's name */ name: string; @@ -39,6 +39,3 @@ export interface Activity { /** The custom buttons shown in the Rich Presence (max 2) */ buttons?: ActivityButton[]; } - -/** https://discord.com/developers/docs/topics/gateway#activity-object */ -export type DiscordActivity = SnakeCasedPropertiesDeep; diff --git a/src/types/misc/activity_assets.ts b/src/types/misc/activity_assets.ts index 84141aec5..41a742b17 100644 --- a/src/types/misc/activity_assets.ts +++ b/src/types/misc/activity_assets.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/topics/gateway#activity-object-activity-assets */ export interface ActivityAssets { /** The id for a large asset of the activity, usually a snowflake */ largeImage?: string; @@ -10,6 +9,3 @@ export interface ActivityAssets { /** Text displayed when hovering over the small image of the activity */ smallText?: string; } - -/** https://discord.com/developers/docs/topics/gateway#activity-object-activity-assets */ -export type DiscordActivityAssets = SnakeCasedPropertiesDeep; diff --git a/src/types/misc/activity_button.ts b/src/types/misc/activity_button.ts index 10e57fd72..7872c32e5 100644 --- a/src/types/misc/activity_button.ts +++ b/src/types/misc/activity_button.ts @@ -1,10 +1,8 @@ +// https://github.com/discord/discord-api-docs/pull/2219 +// TODO: add documentation link export interface ActivityButton { /** The text shown on the button (1-32 characters) */ label: string; /** The url opened when clicking the button (1-512 characters) */ url: string; } - -// https://github.com/discord/discord-api-docs/pull/2219 -// TODO: add documentation link -export type DiscordActivityButton = ActivityButton; diff --git a/src/types/misc/activity_emoji.ts b/src/types/misc/activity_emoji.ts index 8f9e6de77..3ca97ab3d 100644 --- a/src/types/misc/activity_emoji.ts +++ b/src/types/misc/activity_emoji.ts @@ -1,3 +1,4 @@ +/** https://discord.com/developers/docs/topics/gateway#activity-object-activity-emoji */ export interface ActivityEmoji { /** The name of the emoji */ name: string; @@ -6,6 +7,3 @@ export interface ActivityEmoji { /** Whether this emoji is animated */ animated?: boolean; } - -/** https://discord.com/developers/docs/topics/gateway#activity-object-activity-emoji */ -export type DiscordActivityEmoji = ActivityEmoji; diff --git a/src/types/misc/activity_flags.ts b/src/types/misc/activity_flags.ts index 47fc818ef..7b0abdd40 100644 --- a/src/types/misc/activity_flags.ts +++ b/src/types/misc/activity_flags.ts @@ -7,3 +7,6 @@ export enum DiscordActivityFlags { SYNC = 1 << 4, PLAY = 1 << 5, } + +export type ActivityFlags = DiscordActivityFlags; +export const ActivityFlags = DiscordActivityFlags; diff --git a/src/types/misc/activity_party.ts b/src/types/misc/activity_party.ts index e3d53dba1..0a241f781 100644 --- a/src/types/misc/activity_party.ts +++ b/src/types/misc/activity_party.ts @@ -5,5 +5,3 @@ export interface ActivityParty { /** Used to show the party's current and maximum size */ size?: [currentSize: number, maxSize: number]; } - -export type DiscordActivityParty = ActivityParty; diff --git a/src/types/misc/activity_secrets.ts b/src/types/misc/activity_secrets.ts index b6d188eaa..e6d996a26 100644 --- a/src/types/misc/activity_secrets.ts +++ b/src/types/misc/activity_secrets.ts @@ -1,3 +1,4 @@ +/** https://discord.com/developers/docs/topics/gateway#activity-object-activity-secrets */ export interface ActivitySecrets { /** The secret for joining a party */ join?: string; @@ -6,6 +7,3 @@ export interface ActivitySecrets { /** The secret for a specific instanced match */ match?: string; } - -/** https://discord.com/developers/docs/topics/gateway#activity-object-activity-secrets */ -export type DiscordActivitySecrets = ActivitySecrets; diff --git a/src/types/misc/activity_timestamps.ts b/src/types/misc/activity_timestamps.ts index ac9bc3173..e60681c4b 100644 --- a/src/types/misc/activity_timestamps.ts +++ b/src/types/misc/activity_timestamps.ts @@ -1,9 +1,7 @@ +/** https://discord.com/developers/docs/topics/gateway#activity-object-activity-timestamps */ export interface ActivityTimestamps { /** 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-timestamps */ -export type DiscordactivityTimestamps = ActivityTimestamps; diff --git a/src/types/misc/activity_types.ts b/src/types/misc/activity_types.ts index ecba78fbe..637dffb57 100644 --- a/src/types/misc/activity_types.ts +++ b/src/types/misc/activity_types.ts @@ -7,3 +7,6 @@ export enum DiscordActivityTypes { Custom = 4, Competing, } + +export type ActivityTypes = DiscordActivityTypes; +export const ActivityTypes = DiscordActivityTypes; diff --git a/src/types/misc/client_status.ts b/src/types/misc/client_status.ts index 52435ed89..6cf61c38f 100644 --- a/src/types/misc/client_status.ts +++ b/src/types/misc/client_status.ts @@ -1,3 +1,4 @@ +/** https://discord.com/developers/docs/topics/gateway#client-status-object */ export interface ClientStatus { /** The user's status set for an active desktop (Windows, Linux, Mac) application session */ desktop?: string; @@ -6,6 +7,3 @@ export interface ClientStatus { /** The user's status set for an active web (browser, bot account) application session */ web?: string; } - -/** https://discord.com/developers/docs/topics/gateway#client-status-object */ -export type DiscordClientStatus = ClientStatus; diff --git a/src/types/misc/presence_update.ts b/src/types/misc/presence_update.ts index dc7a30b1b..ca75d07b9 100644 --- a/src/types/misc/presence_update.ts +++ b/src/types/misc/presence_update.ts @@ -1,8 +1,8 @@ import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { Activity } from "./activity.ts"; import { ClientStatus } from "./client_status.ts"; +/** https://discord.com/developers/docs/topics/gateway#presence-update */ export interface PresenceUpdate { /** The user presence is being updated for */ user: User; @@ -15,6 +15,3 @@ export interface PresenceUpdate { /** User's platform-dependent status */ clientStatus: ClientStatus; } - -/** https://discord.com/developers/docs/topics/gateway#presence-update */ -export type DiscordPresenceUpdate = SnakeCasedPropertiesDeep; diff --git a/src/types/misc/typing_start.ts b/src/types/misc/typing_start.ts index 82f34f84d..4c23b7d2b 100644 --- a/src/types/misc/typing_start.ts +++ b/src/types/misc/typing_start.ts @@ -1,6 +1,6 @@ import { GuildMember } from "../guilds/guild_member.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/topics/gateway#typing-start */ export interface TypingStart { /** id of the channel */ channelId: string; @@ -13,6 +13,3 @@ export interface TypingStart { /** The member who started typing if this happened in a guild */ member?: GuildMember; } - -/** https://discord.com/developers/docs/topics/gateway#typing-start */ -export type DiscordTypingStart = SnakeCasedPropertiesDeep; diff --git a/src/types/oauth2/application.ts b/src/types/oauth2/application.ts index 43b71a119..0febc1ebc 100644 --- a/src/types/oauth2/application.ts +++ b/src/types/oauth2/application.ts @@ -1,8 +1,8 @@ import { Team } from "../teams/team.ts"; import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { DiscordApplicationFlags } from "./application_flags.ts"; +/** https://discord.com/developers/docs/topics/oauth2#application-object */ export interface Application { /** The id of the app */ id: string; @@ -41,6 +41,3 @@ export interface Application { /** The application's public flags */ flags: DiscordApplicationFlags; } - -/** https://discord.com/developers/docs/topics/oauth2#application-object */ -export type DiscordApplication = SnakeCasedPropertiesDeep; diff --git a/src/types/oauth2/application_flags.ts b/src/types/oauth2/application_flags.ts index 0b9a1b1f1..5fe9538f2 100644 --- a/src/types/oauth2/application_flags.ts +++ b/src/types/oauth2/application_flags.ts @@ -8,3 +8,6 @@ export enum DiscordApplicationFlags { VerificationPendingGuildLimit = 1 << 16, Embedded = 1 << 17, } + +export type ApplicationFlags = DiscordApplicationFlags; +export const ApplicationFlags = DiscordApplicationFlags; diff --git a/src/types/oauth2/bot_auth_query.ts b/src/types/oauth2/bot_auth_query.ts index 90137da04..301d6fb8a 100644 --- a/src/types/oauth2/bot_auth_query.ts +++ b/src/types/oauth2/bot_auth_query.ts @@ -1,6 +1,6 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { DiscordOAuth2Scopes } from "./scopes.ts"; +/** https://discord.com/developers/docs/topics/oauth2#bot-authorization-flow-bot-auth-parameters */ export interface BotAuthenticationFlowQuery { /** App's client id */ clientId: string; @@ -13,8 +13,3 @@ export interface BotAuthenticationFlowQuery { /** True or false—disallows the user from changing the guild dropdown */ disableGuildSelect: boolean; } - -/** https://discord.com/developers/docs/topics/oauth2#bot-authorization-flow-bot-auth-parameters */ -export type DiscordBotAuthenticationFlowQuery = SnakeCasedPropertiesDeep< - BotAuthenticationFlowQuery ->; diff --git a/src/types/oauth2/get_current_authorization_information.ts b/src/types/oauth2/get_current_authorization_information.ts index 0a8009c16..a56cc6ea2 100644 --- a/src/types/oauth2/get_current_authorization_information.ts +++ b/src/types/oauth2/get_current_authorization_information.ts @@ -1,8 +1,8 @@ import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { Application } from "./application.ts"; import { DiscordOAuth2Scopes } from "./scopes.ts"; +/** https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information-response-structure */ export interface GetCurrentAuthorizationInformation { /** The current application */ application: Partial; @@ -13,8 +13,3 @@ export interface GetCurrentAuthorizationInformation { /** The user who has authorized, if the user has authorized with the `identify` scope */ user?: User; } - -/** https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information-response-structure */ -export type DiscordGetCurrentAuthoriationInformation = SnakeCasedPropertiesDeep< - GetCurrentAuthorizationInformation ->; diff --git a/src/types/permissions/bitwise_permission_flags.ts b/src/types/permissions/bitwise_permission_flags.ts index c6d8218a4..cd539e5d0 100644 --- a/src/types/permissions/bitwise_permission_flags.ts +++ b/src/types/permissions/bitwise_permission_flags.ts @@ -67,3 +67,6 @@ export enum DiscordBitwisePermissionFlags { /** Allows for requesting to speak in stage channels. */ REQUEST_TO_SPEAK = 0x100000000, } + +export type BitwisePermissions = DiscordBitwisePermissionFlags; +export const BitwisePermissions = DiscordBitwisePermissionFlags; diff --git a/src/types/permissions/permission_strings.ts b/src/types/permissions/permission_strings.ts index a209e9707..9a8c73bae 100644 --- a/src/types/permissions/permission_strings.ts +++ b/src/types/permissions/permission_strings.ts @@ -1,3 +1,4 @@ import { DiscordBitwisePermissionFlags } from "./bitwise_permission_flags.ts"; export type PermissionStrings = keyof typeof DiscordBitwisePermissionFlags; +export type Permission = PermissionStrings; diff --git a/src/types/permissions/role.ts b/src/types/permissions/role.ts index 7aa92fdb0..4191c3b20 100644 --- a/src/types/permissions/role.ts +++ b/src/types/permissions/role.ts @@ -1,6 +1,6 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { RoleTags } from "./role_tags.ts"; +/** https://discord.com/developers/docs/topics/permissions#role-object-role-structure */ export interface Role { /** Role id */ id: string; @@ -21,6 +21,3 @@ export interface Role { /** The tags this role has */ tags?: RoleTags; } - -/** https://discord.com/developers/docs/topics/permissions#role-object-role-structure */ -export type DiscordRole = SnakeCasedPropertiesDeep; diff --git a/src/types/permissions/role_tags.ts b/src/types/permissions/role_tags.ts index 4b2e31d0d..1bb175277 100644 --- a/src/types/permissions/role_tags.ts +++ b/src/types/permissions/role_tags.ts @@ -1,5 +1,4 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; - +/** https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure */ export interface RoleTags { /** The id of the bot this role belongs to */ botId?: string; @@ -8,6 +7,3 @@ export interface RoleTags { /** Whether this is the guild's premium subscriber role */ premiumSubscriber?: null; } - -/** https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure */ -export type DiscordRoleTags = SnakeCasedPropertiesDeep; diff --git a/src/types/teams/team.ts b/src/types/teams/team.ts index 1174cfd0a..bff45924c 100644 --- a/src/types/teams/team.ts +++ b/src/types/teams/team.ts @@ -1,6 +1,6 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { TeamMember } from "./team_member.ts"; +/** https://discord.com/developers/docs/topics/teams#data-models-team-object */ export interface Team { /** A hash of the image of the team's icon */ icon: string | null; @@ -11,6 +11,3 @@ export interface Team { /** The user id of the current team owner */ ownerUserId: string; } - -/** https://discord.com/developers/docs/topics/teams#data-models-team-object */ -export type DiscordTeam = SnakeCasedPropertiesDeep; diff --git a/src/types/teams/team_member.ts b/src/types/teams/team_member.ts index f3249bdbd..5191e1dba 100644 --- a/src/types/teams/team_member.ts +++ b/src/types/teams/team_member.ts @@ -1,7 +1,7 @@ import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { DiscordTeamMembershipStates } from "./team_membership_states.ts"; +/** https://discord.com/developers/docs/topics/teams#data-models-team-members-object */ export interface TeamMember { /** The user's membership state on the team */ membershipState: DiscordTeamMembershipStates; @@ -14,6 +14,3 @@ export interface TeamMember { & Partial & Pick; } - -/** https://discord.com/developers/docs/topics/teams#data-models-team-members-object */ -export type DiscordTeamMember = SnakeCasedPropertiesDeep; diff --git a/src/types/teams/team_membership_states.ts b/src/types/teams/team_membership_states.ts index 83093ab4b..151fb4868 100644 --- a/src/types/teams/team_membership_states.ts +++ b/src/types/teams/team_membership_states.ts @@ -3,3 +3,6 @@ export enum DiscordTeamMembershipStates { INVITED = 1, ACCEPTED, } + +export type TeamMembershipStates = DiscordTeamMembershipStates; +export const TeamMembershipStates = DiscordTeamMembershipStates; diff --git a/src/types/templates/create_guild_from_template.ts b/src/types/templates/create_guild_from_template.ts index 5f2ec272a..cf2a059ed 100644 --- a/src/types/templates/create_guild_from_template.ts +++ b/src/types/templates/create_guild_from_template.ts @@ -1,9 +1,7 @@ +/** https://discord.com/developers/docs/resources/template#create-guild-from-template-json-params */ export interface CreateGuildFromTemplate { /** 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-from-template-json-params */ -export type DiscordCreateGuildFromTemplate = CreateGuildFromTemplate; diff --git a/src/types/templates/modify_guild_template.ts b/src/types/templates/modify_guild_template.ts index 892c3cf44..664fb150f 100644 --- a/src/types/templates/modify_guild_template.ts +++ b/src/types/templates/modify_guild_template.ts @@ -1,9 +1,7 @@ +/** https://discord.com/developers/docs/resources/template#modify-guild-template */ export interface ModifyGuildTemplate { /** Name of the template (1-100 characters) */ name?: string; /** Description of the template (0-120 characters) */ description?: string | null; } - -/** https://discord.com/developers/docs/resources/template#modify-guild-template */ -export type DiscordModifyGuildTemplate = ModifyGuildTemplate; diff --git a/src/types/templates/template.ts b/src/types/templates/template.ts index 2e4920e9a..12bd382ff 100644 --- a/src/types/templates/template.ts +++ b/src/types/templates/template.ts @@ -1,7 +1,7 @@ import { Guild } from "../guilds/guild.ts"; import { User } from "../users/user.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; +/** https://discord.com/developers/docs/resources/template#template-object-template-structure */ export interface Template { /** The template code (unique Id) */ code: string; @@ -26,6 +26,3 @@ export interface Template { /** Whether the template has unsynced changes */ isDirty: boolean | null; } - -/** https://discord.com/developers/docs/resources/template#template-object-template-structure */ -export type DiscordTemplate = SnakeCasedPropertiesDeep