hopefully the last dir change

This commit is contained in:
ITOH
2021-05-05 20:06:32 +02:00
parent ee2e263d63
commit 7ff0d242ff
113 changed files with 267 additions and 250 deletions
+1 -1
View File
@@ -3,8 +3,8 @@ import type { DiscordenoChannel } from "./structures/channel.ts";
import type { DiscordenoGuild } from "./structures/guild.ts"; import type { DiscordenoGuild } from "./structures/guild.ts";
import type { DiscordenoMember } from "./structures/member.ts"; import type { DiscordenoMember } from "./structures/member.ts";
import type { DiscordenoMessage } from "./structures/message.ts"; import type { DiscordenoMessage } from "./structures/message.ts";
import type { PresenceUpdate } from "./types/activity/presence_update.ts";
import type { Emoji } from "./types/emojis/emoji.ts"; import type { Emoji } from "./types/emojis/emoji.ts";
import type { PresenceUpdate } from "./types/misc/presence_update.ts";
import { Collection } from "./util/collection.ts"; import { Collection } from "./util/collection.ts";
export const cache = { export const cache = {
@@ -2,7 +2,7 @@ import { eventHandlers } from "../../bot.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { import type {
ApplicationCommandCreateUpdateDelete, ApplicationCommandCreateUpdateDelete,
} from "../../types/interactions/application_command_create_update_delete.ts"; } from "../../types/interactions/commands/application_command_create_update_delete.ts";
export function handleApplicationCommandCreate( export function handleApplicationCommandCreate(
data: DiscordGatewayPayload, data: DiscordGatewayPayload,
@@ -2,7 +2,7 @@ import { eventHandlers } from "../../bot.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { import type {
ApplicationCommandCreateUpdateDelete, ApplicationCommandCreateUpdateDelete,
} from "../../types/interactions/application_command_create_update_delete.ts"; } from "../../types/interactions/commands/application_command_create_update_delete.ts";
export function handleApplicationCommandDelete(data: DiscordGatewayPayload) { export function handleApplicationCommandDelete(data: DiscordGatewayPayload) {
eventHandlers.applicationCommandDelete?.( eventHandlers.applicationCommandDelete?.(
@@ -2,7 +2,7 @@ import { eventHandlers } from "../../bot.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { import type {
ApplicationCommandCreateUpdateDelete, ApplicationCommandCreateUpdateDelete,
} from "../../types/interactions/application_command_create_update_delete.ts"; } from "../../types/interactions/commands/application_command_create_update_delete.ts";
export function handleApplicationCommandUpdate(data: DiscordGatewayPayload) { export function handleApplicationCommandUpdate(data: DiscordGatewayPayload) {
eventHandlers.applicationCommandUpdate?.( eventHandlers.applicationCommandUpdate?.(
@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts"; import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts"; import { cacheHandlers } from "../../cache.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { GuildIntegrationsUpdate } from "../../types/integration/guild_integrations_update.ts"; import type { GuildIntegrationsUpdate } from "../../types/integrations/guild_integrations_update.ts";
import { snowflakeToBigint } from "../../util/bigint.ts"; import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleGuildIntegrationsUpdate( export async function handleGuildIntegrationsUpdate(
@@ -2,7 +2,7 @@ import { eventHandlers } from "../../bot.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { import type {
IntegrationCreateUpdate, IntegrationCreateUpdate,
} from "../../types/integration/integration_create_update.ts"; } from "../../types/integrations/integration_create_update.ts";
export function handleIntegrationCreate( export function handleIntegrationCreate(
data: DiscordGatewayPayload, data: DiscordGatewayPayload,
@@ -1,6 +1,6 @@
import { eventHandlers } from "../../bot.ts"; import { eventHandlers } from "../../bot.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { IntegrationDelete } from "../../types/integration/integration_delete.ts"; import type { IntegrationDelete } from "../../types/integrations/integration_delete.ts";
export function handleIntegrationDelete(data: DiscordGatewayPayload) { export function handleIntegrationDelete(data: DiscordGatewayPayload) {
eventHandlers.integrationDelete?.( eventHandlers.integrationDelete?.(
@@ -2,7 +2,7 @@ import { eventHandlers } from "../../bot.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { import type {
IntegrationCreateUpdate, IntegrationCreateUpdate,
} from "../../types/integration/integration_create_update.ts"; } from "../../types/integrations/integration_create_update.ts";
export function handleIntegrationUpdate(data: DiscordGatewayPayload) { export function handleIntegrationUpdate(data: DiscordGatewayPayload) {
eventHandlers.integrationUpdate?.( eventHandlers.integrationUpdate?.(
@@ -2,8 +2,8 @@ import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts"; import { cacheHandlers } from "../../cache.ts";
import { structures } from "../../structures/mod.ts"; import { structures } from "../../structures/mod.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { GuildMemberWithUser } from "../../types/guilds/guild_member.ts";
import type { Interaction } from "../../types/interactions/interaction.ts"; import type { Interaction } from "../../types/interactions/interaction.ts";
import type { GuildMemberWithUser } from "../../types/members/guild_member.ts";
import { snowflakeToBigint } from "../../util/bigint.ts"; import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleInteractionCreate(data: DiscordGatewayPayload) { export async function handleInteractionCreate(data: DiscordGatewayPayload) {
+1 -1
View File
@@ -2,7 +2,7 @@ import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts"; import { cacheHandlers } from "../../cache.ts";
import { structures } from "../../structures/mod.ts"; import { structures } from "../../structures/mod.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { GuildMemberWithUser } from "../../types/guilds/guild_member.ts"; import type { GuildMemberWithUser } from "../../types/members/guild_member.ts";
import type { Message } from "../../types/messages/message.ts"; import type { Message } from "../../types/messages/message.ts";
import { snowflakeToBigint } from "../../util/bigint.ts"; import { snowflakeToBigint } from "../../util/bigint.ts";
@@ -6,7 +6,6 @@ import type {
MessageReactionAdd, MessageReactionAdd,
} from "../../types/messages/message_reaction_add.ts"; } from "../../types/messages/message_reaction_add.ts";
import { snowflakeToBigint } from "../../util/bigint.ts"; import { snowflakeToBigint } from "../../util/bigint.ts";
import { snakeKeysToCamelCase } from "../../util/utils.ts";
export async function handleMessageReactionAdd(data: DiscordGatewayPayload) { export async function handleMessageReactionAdd(data: DiscordGatewayPayload) {
const payload = data.d as MessageReactionAdd; const payload = data.d as MessageReactionAdd;
@@ -56,7 +55,7 @@ export async function handleMessageReactionAdd(data: DiscordGatewayPayload) {
} }
eventHandlers.reactionAdd?.( eventHandlers.reactionAdd?.(
snakeKeysToCamelCase<MessageReactionAdd>(payload), payload,
message, message,
); );
} }
+1 -1
View File
@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts"; import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts"; import { cacheHandlers } from "../../cache.ts";
import type { PresenceUpdate } from "../../types/activity/presence_update.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { PresenceUpdate } from "../../types/misc/presence_update.ts";
import { snowflakeToBigint } from "../../util/bigint.ts"; import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handlePresenceUpdate(data: DiscordGatewayPayload) { export async function handlePresenceUpdate(data: DiscordGatewayPayload) {
+2 -2
View File
@@ -12,7 +12,7 @@ import {
calculateBits, calculateBits,
requireOverwritePermissions, requireOverwritePermissions,
} from "../../util/permissions.ts"; } from "../../util/permissions.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts"; import { snakelize } from "../../util/utils.ts";
/** Create a channel in your server. Bot needs MANAGE_CHANNEL permissions in the server. */ /** Create a channel in your server. Bot needs MANAGE_CHANNEL permissions in the server. */
export async function createChannel( export async function createChannel(
@@ -34,7 +34,7 @@ export async function createChannel(
"post", "post",
endpoints.GUILD_CHANNELS(guildId), endpoints.GUILD_CHANNELS(guildId),
{ {
...camelKeysToSnakeCase<DiscordCreateGuildChannel>(options ?? {}), ...snakelize<DiscordCreateGuildChannel>(options ?? {}),
permission_overwrites: options?.permissionOverwrites?.map((perm) => ({ permission_overwrites: options?.permissionOverwrites?.map((perm) => ({
...perm, ...perm,
allow: calculateBits(perm.allow), allow: calculateBits(perm.allow),
+2 -2
View File
@@ -12,7 +12,7 @@ import {
requireBotChannelPermissions, requireBotChannelPermissions,
requireOverwritePermissions, requireOverwritePermissions,
} from "../../util/permissions.ts"; } from "../../util/permissions.ts";
import { camelKeysToSnakeCase, hasOwnProperty } from "../../util/utils.ts"; import { hasOwnProperty, snakelize } from "../../util/utils.ts";
//TODO: implement DM group channel edit //TODO: implement DM group channel edit
//TODO(threads): check thread perms //TODO(threads): check thread perms
@@ -88,7 +88,7 @@ export async function editChannel(
} }
const payload = { const payload = {
...camelKeysToSnakeCase<Record<string, unknown>>(options), ...snakelize<Record<string, unknown>>(options),
// deno-lint-ignore camelcase // deno-lint-ignore camelcase
permission_overwrites: permission_overwrites:
hasOwnProperty<ModifyChannel>(options, "permissionOverwrites") hasOwnProperty<ModifyChannel>(options, "permissionOverwrites")
@@ -1,7 +1,7 @@
import { rest } from "../../../rest/rest.ts"; import { rest } from "../../../rest/rest.ts";
import { ListPublicArchivedThreads } from "../../../types/channels/threads/list_public_archived_threads.ts"; import { ListPublicArchivedThreads } from "../../../types/channels/threads/list_public_archived_threads.ts";
import { endpoints } from "../../../util/constants.ts"; import { endpoints } from "../../../util/constants.ts";
import { camelKeysToSnakeCase } from "../../../util/utils.ts"; import { snakelize } from "../../../util/utils.ts";
export async function getArchivedThreads( export async function getArchivedThreads(
channelId: bigint, channelId: bigint,
@@ -19,6 +19,6 @@ export async function getArchivedThreads(
: options?.type === "private" : options?.type === "private"
? endpoints.THREAD_ARCHIVED_PRIVATE(channelId) ? endpoints.THREAD_ARCHIVED_PRIVATE(channelId)
: endpoints.THREAD_ARCHIVED_PUBLIC(channelId), : endpoints.THREAD_ARCHIVED_PUBLIC(channelId),
camelKeysToSnakeCase(options ?? {}), snakelize(options ?? {}),
); );
} }
+2 -2
View File
@@ -4,7 +4,7 @@ import { ChannelTypes } from "../../../types/channels/channel_types.ts";
import { StartThread } from "../../../types/channels/threads/start_thread.ts"; import { StartThread } from "../../../types/channels/threads/start_thread.ts";
import { Errors } from "../../../types/discordeno/errors.ts"; import { Errors } from "../../../types/discordeno/errors.ts";
import { endpoints } from "../../../util/constants.ts"; import { endpoints } from "../../../util/constants.ts";
import { camelKeysToSnakeCase } from "../../../util/utils.ts"; import { snakelize } from "../../../util/utils.ts";
/** /**
* Creates a new public thread from an existing message. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters. Fires a Thread Create Gateway event. * Creates a new public thread from an existing message. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters. Fires a Thread Create Gateway event.
@@ -33,6 +33,6 @@ export async function startThread(
options?.messageId options?.messageId
? endpoints.THREAD_START_PUBLIC(channelId, options.messageId) ? endpoints.THREAD_START_PUBLIC(channelId, options.messageId)
: endpoints.THREAD_START_PRIVATE(channelId), : endpoints.THREAD_START_PRIVATE(channelId),
camelKeysToSnakeCase(options), snakelize(options),
); );
} }
@@ -1,18 +0,0 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import type { 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: bigint,
commandId: bigint,
options: ApplicationCommandPermissions[],
) {
return await rest.runMethod(
"put",
endpoints.COMMANDS_PERMISSION(applicationId, guildId, commandId),
{ permissions: camelKeysToSnakeCase(options) },
);
}
+2 -2
View File
@@ -3,7 +3,7 @@ import type { DiscoveryMetadata } from "../../types/discovery/discovery_metadata
import type { ModifyGuildDiscoveryMetadata } from "../../types/discovery/modify_guild_discovery_metadata.ts"; import type { ModifyGuildDiscoveryMetadata } from "../../types/discovery/modify_guild_discovery_metadata.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts"; import { snakelize } from "../../util/utils.ts";
/** Modify the discovery metadata for the guild. Requires the MANAGE_GUILD permission. Returns the updated discovery metadata object on success. */ /** Modify the discovery metadata for the guild. Requires the MANAGE_GUILD permission. Returns the updated discovery metadata object on success. */
export async function editDiscovery( export async function editDiscovery(
@@ -15,6 +15,6 @@ export async function editDiscovery(
return await rest.runMethod<DiscoveryMetadata>( return await rest.runMethod<DiscoveryMetadata>(
"patch", "patch",
endpoints.DISCOVERY_MODIFY(guildId), endpoints.DISCOVERY_MODIFY(guildId),
camelKeysToSnakeCase(data), snakelize(data),
); );
} }
+2 -2
View File
@@ -2,7 +2,7 @@ import { rest } from "../../rest/rest.ts";
import type { ModifyGuildWelcomeScreen } from "../../types/guilds/modify_guild_welcome_screen.ts"; import type { ModifyGuildWelcomeScreen } from "../../types/guilds/modify_guild_welcome_screen.ts";
import type { WelcomeScreen } from "../../types/guilds/welcome_screen.ts"; import type { WelcomeScreen } from "../../types/guilds/welcome_screen.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts"; import { snakelize } from "../../util/utils.ts";
export async function editWelcomeScreen( export async function editWelcomeScreen(
guildId: bigint, guildId: bigint,
@@ -11,6 +11,6 @@ export async function editWelcomeScreen(
return await rest.runMethod<WelcomeScreen>( return await rest.runMethod<WelcomeScreen>(
"patch", "patch",
endpoints.GUILD_WELCOME_SCREEN(guildId), endpoints.GUILD_WELCOME_SCREEN(guildId),
camelKeysToSnakeCase(options), snakelize(options),
); );
} }
+2 -2
View File
@@ -3,7 +3,7 @@ import type { AuditLog } from "../../types/audit_log/audit_log.ts";
import type { GetGuildAuditLog } from "../../types/audit_log/get_guild_audit_log.ts"; import type { GetGuildAuditLog } from "../../types/audit_log/get_guild_audit_log.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts"; import { snakelize } from "../../util/utils.ts";
/** Returns the audit logs for the guild. Requires VIEW AUDIT LOGS permission */ /** Returns the audit logs for the guild. Requires VIEW AUDIT LOGS permission */
export async function getAuditLogs( export async function getAuditLogs(
@@ -15,7 +15,7 @@ export async function getAuditLogs(
return await rest.runMethod<AuditLog>( return await rest.runMethod<AuditLog>(
"get", "get",
endpoints.GUILD_AUDIT_LOGS(guildId), endpoints.GUILD_AUDIT_LOGS(guildId),
camelKeysToSnakeCase({ snakelize({
...options, ...options,
limit: options.limit && options.limit >= 1 && options.limit <= 100 limit: options.limit && options.limit >= 1 && options.limit <= 100
? options.limit ? options.limit
+3 -3
View File
@@ -1,9 +1,9 @@
import { rest } from "../../rest/rest.ts"; import { rest } from "../../rest/rest.ts";
import type { GetGuildPruneCountQuery } from "../../types/guilds/get_guild_prune_count.ts";
import { Errors } from "../../types/discordeno/errors.ts"; import { Errors } from "../../types/discordeno/errors.ts";
import type { GetGuildPruneCountQuery } from "../../types/guilds/get_guild_prune_count.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts"; import { snakelize } from "../../util/utils.ts";
/** Check how many members would be removed from the server in a prune operation. Requires the KICK_MEMBERS permission */ /** Check how many members would be removed from the server in a prune operation. Requires the KICK_MEMBERS permission */
export async function getPruneCount( export async function getPruneCount(
@@ -20,7 +20,7 @@ export async function getPruneCount(
const result = await rest.runMethod( const result = await rest.runMethod(
"get", "get",
endpoints.GUILD_PRUNE(guildId), endpoints.GUILD_PRUNE(guildId),
camelKeysToSnakeCase(options ?? {}), snakelize(options ?? {}),
); );
return result.pruned as number; return result.pruned as number;
+2 -2
View File
@@ -3,7 +3,7 @@ import type {
UpdateSelfVoiceState, UpdateSelfVoiceState,
} from "../../types/guilds/update_self_voice_state.ts"; } from "../../types/guilds/update_self_voice_state.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts"; import { snakelize } from "../../util/utils.ts";
/** /**
* Updates the current user's voice state. * Updates the current user's voice state.
@@ -21,6 +21,6 @@ export async function updateBotVoiceState(
return await rest.runMethod( return await rest.runMethod(
"patch", "patch",
endpoints.UPDATE_VOICE_STATE(guildId), endpoints.UPDATE_VOICE_STATE(guildId),
camelKeysToSnakeCase(data), snakelize(data),
); );
} }
@@ -3,7 +3,7 @@ import type {
UpdateOthersVoiceState, UpdateOthersVoiceState,
} from "../../types/guilds/update_others_voice_state.ts"; } from "../../types/guilds/update_others_voice_state.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts"; import { snakelize } from "../../util/utils.ts";
/** /**
* Updates another user's voice state. * Updates another user's voice state.
@@ -22,6 +22,6 @@ export function updateVoiceState(
return rest.runMethod( return rest.runMethod(
"patch", "patch",
endpoints.UPDATE_VOICE_STATE(guildId, userId), endpoints.UPDATE_VOICE_STATE(guildId, userId),
camelKeysToSnakeCase(data), snakelize(data),
); );
} }
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts"; import { rest } from "../../rest/rest.ts";
import type { Integration } from "../../types/integration/integration.ts"; import type { Integration } from "../../types/integrations/integration.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts";
@@ -1,8 +1,8 @@
import { applicationId } from "../../bot.ts"; import { applicationId } from "../../../bot.ts";
import { rest } from "../../rest/rest.ts"; import { rest } from "../../../rest/rest.ts";
import type { ApplicationCommandPermissions } from "../../types/interactions/application_command_permissions.ts"; import type { ApplicationCommandPermissions } from "../../../types/interactions/commands/application_command_permissions.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../../util/constants.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts"; import { snakelize } from "../../../util/utils.ts";
/** Batch edits permissions for all commands in a guild. Takes an array of partial GuildApplicationCommandPermissions objects including `id` and `permissions`. */ /** Batch edits permissions for all commands in a guild. Takes an array of partial GuildApplicationCommandPermissions objects including `id` and `permissions`. */
export async function batchEditSlashCommandPermissions( export async function batchEditSlashCommandPermissions(
@@ -12,6 +12,6 @@ export async function batchEditSlashCommandPermissions(
return await rest.runMethod( return await rest.runMethod(
"put", "put",
endpoints.COMMANDS_PERMISSIONS(applicationId, guildId), endpoints.COMMANDS_PERMISSIONS(applicationId, guildId),
camelKeysToSnakeCase(options), snakelize(options),
); );
} }
@@ -1,12 +1,9 @@
import { applicationId } from "../../bot.ts"; import { applicationId } from "../../../bot.ts";
import { rest } from "../../rest/rest.ts"; import { rest } from "../../../rest/rest.ts";
import type { ApplicationCommand } from "../../types/interactions/application_command.ts"; import type { ApplicationCommand } from "../../../types/interactions/commands/application_command.ts";
import type { CreateGlobalApplicationCommand } from "../../types/interactions/create_global_application_command.ts"; import type { CreateGlobalApplicationCommand } from "../../../types/interactions/commands/create_global_application_command.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../../util/constants.ts";
import { import { snakelize, validateSlashCommands } from "../../../util/utils.ts";
camelKeysToSnakeCase,
validateSlashCommands,
} from "../../util/utils.ts";
/** /**
* There are two kinds of Slash Commands: global commands and guild commands. Global commands are available for every guild that adds your app; guild commands are specific to the guild you specify when making them. Command names are unique per application within each scope (global and guild). That means: * There are two kinds of Slash Commands: global commands and guild commands. Global commands are available for every guild that adds your app; guild commands are specific to the guild you specify when making them. Command names are unique per application within each scope (global and guild). That means:
@@ -30,6 +27,6 @@ export async function createSlashCommand(
guildId guildId
? endpoints.COMMANDS_GUILD(applicationId, guildId) ? endpoints.COMMANDS_GUILD(applicationId, guildId)
: endpoints.COMMANDS(applicationId), : endpoints.COMMANDS(applicationId),
camelKeysToSnakeCase(options), snakelize(options),
); );
} }
@@ -1,6 +1,6 @@
import { applicationId } from "../../bot.ts"; import { applicationId } from "../../../bot.ts";
import { rest } from "../../rest/rest.ts"; import { rest } from "../../../rest/rest.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../../util/constants.ts";
/** Deletes a slash command. */ /** Deletes a slash command. */
export async function deleteSlashCommand( export async function deleteSlashCommand(
@@ -1,6 +1,6 @@
import { applicationId } from "../../bot.ts"; import { applicationId } from "../../../bot.ts";
import { rest } from "../../rest/rest.ts"; import { rest } from "../../../rest/rest.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../../util/constants.ts";
/** To delete your response to a slash command. If a message id is not provided, it will default to deleting the original response. */ /** To delete your response to a slash command. If a message id is not provided, it will default to deleting the original response. */
export async function deleteSlashResponse( export async function deleteSlashResponse(
@@ -0,0 +1,18 @@
import { applicationId } from "../../../bot.ts";
import { rest } from "../../../rest/rest.ts";
import type { ApplicationCommandPermissions } from "../../../types/interactions/commands/application_command_permissions.ts";
import { endpoints } from "../../../util/constants.ts";
import { snakelize } from "../../../util/utils.ts";
/** Edits command permissions for a specific command for your application in a guild. */
export async function editSlashCommandPermissions(
guildId: bigint,
commandId: bigint,
options: ApplicationCommandPermissions[],
) {
return await rest.runMethod(
"put",
endpoints.COMMANDS_PERMISSION(applicationId, guildId, commandId),
{ permissions: snakelize(options) },
);
}
@@ -1,10 +1,10 @@
import { applicationId } from "../../bot.ts"; import { applicationId } from "../../../bot.ts";
import { rest } from "../../rest/rest.ts"; import { rest } from "../../../rest/rest.ts";
import { structures } from "../../structures/mod.ts"; import { structures } from "../../../structures/mod.ts";
import type { DiscordenoEditWebhookMessage } from "../../types/discordeno/edit_webhook_message.ts"; import type { DiscordenoEditWebhookMessage } from "../../../types/discordeno/edit_webhook_message.ts";
import { DiscordAllowedMentionsTypes } from "../../types/messages/allowed_mentions_types.ts"; import { Errors } from "../../../types/discordeno/errors.ts";
import { Errors } from "../../types/discordeno/errors.ts"; import { DiscordAllowedMentionsTypes } from "../../../types/messages/allowed_mentions_types.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../../util/constants.ts";
/** To edit your response to a slash command. If a messageId is not provided it will default to editing the original response. */ /** To edit your response to a slash command. If a messageId is not provided it will default to editing the original response. */
export async function editSlashResponse( export async function editSlashResponse(
@@ -1,7 +1,7 @@
import { applicationId } from "../../bot.ts"; import { applicationId } from "../../../bot.ts";
import { rest } from "../../rest/rest.ts"; import { rest } from "../../../rest/rest.ts";
import type { ApplicationCommand } from "../../types/interactions/application_command.ts"; import type { ApplicationCommand } from "../../../types/interactions/commands/application_command.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../../util/constants.ts";
/** Fetchs the global command for the given Id. If a guildId is provided, the guild command will be fetched. */ /** Fetchs the global command for the given Id. If a guildId is provided, the guild command will be fetched. */
export async function getSlashCommand(commandId: bigint, guildId?: bigint) { export async function getSlashCommand(commandId: bigint, guildId?: bigint) {
@@ -1,7 +1,7 @@
import { applicationId } from "../../bot.ts"; import { applicationId } from "../../../bot.ts";
import { rest } from "../../rest/rest.ts"; import { rest } from "../../../rest/rest.ts";
import type { GuildApplicationCommandPermissions } from "../../types/interactions/guild_application_command_permissions.ts"; import type { GuildApplicationCommandPermissions } from "../../../types/interactions/commands/guild_application_command_permissions.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../../util/constants.ts";
/** Fetches command permissions for a specific command for your application in a guild. Returns a GuildApplicationCommandPermissions object. */ /** Fetches command permissions for a specific command for your application in a guild. Returns a GuildApplicationCommandPermissions object. */
export async function getSlashCommandPermission( export async function getSlashCommandPermission(
@@ -1,7 +1,7 @@
import { applicationId } from "../../bot.ts"; import { applicationId } from "../../../bot.ts";
import { rest } from "../../rest/rest.ts"; import { rest } from "../../../rest/rest.ts";
import type { GuildApplicationCommandPermissions } from "../../types/interactions/guild_application_command_permissions.ts"; import type { GuildApplicationCommandPermissions } from "../../../types/interactions/commands/guild_application_command_permissions.ts";
import { endpoints } from "../../util/constants.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. */ /** Fetches command permissions for all commands for your application in a guild. Returns an array of GuildApplicationCommandPermissions objects. */
export async function getSlashCommandPermissions(guildId: bigint) { export async function getSlashCommandPermissions(guildId: bigint) {
@@ -1,8 +1,8 @@
import { applicationId } from "../../bot.ts"; import { applicationId } from "../../../bot.ts";
import { rest } from "../../rest/rest.ts"; import { rest } from "../../../rest/rest.ts";
import type { ApplicationCommand } from "../../types/interactions/application_command.ts"; import type { ApplicationCommand } from "../../../types/interactions/commands/application_command.ts";
import { Collection } from "../../util/collection.ts"; import { Collection } from "../../../util/collection.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../../util/constants.ts";
/** Fetch all of the global commands for your application. */ /** Fetch all of the global commands for your application. */
export async function getSlashCommands(guildId?: bigint) { export async function getSlashCommands(guildId?: bigint) {
@@ -1,9 +1,9 @@
import { applicationId } from "../../bot.ts"; import { applicationId } from "../../../bot.ts";
import { rest } from "../../rest/rest.ts"; import { rest } from "../../../rest/rest.ts";
import type { ApplicationCommand } from "../../types/interactions/application_command.ts"; import type { ApplicationCommand } from "../../../types/interactions/commands/application_command.ts";
import type { EditGlobalApplicationCommand } from "../../types/interactions/edit_global_application_command.ts"; import type { EditGlobalApplicationCommand } from "../../../types/interactions/commands/edit_global_application_command.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../../util/constants.ts";
import { validateSlashCommands } from "../../util/utils.ts"; import { validateSlashCommands } from "../../../util/utils.ts";
/** /**
* Edit an existing slash command. If this command did not exist, it will create it. * Edit an existing slash command. If this command did not exist, it will create it.
@@ -1,9 +1,9 @@
import { applicationId } from "../../bot.ts"; import { applicationId } from "../../../bot.ts";
import { rest } from "../../rest/rest.ts"; import { rest } from "../../../rest/rest.ts";
import type { ApplicationCommand } from "../../types/interactions/application_command.ts"; import type { ApplicationCommand } from "../../../types/interactions/commands/application_command.ts";
import type { EditGlobalApplicationCommand } from "../../types/interactions/edit_global_application_command.ts"; import type { EditGlobalApplicationCommand } from "../../../types/interactions/commands/edit_global_application_command.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../../util/constants.ts";
import { validateSlashCommands } from "../../util/utils.ts"; import { validateSlashCommands } from "../../../util/utils.ts";
/** /**
* Bulk edit existing slash commands. If a command does not exist, it will create it. * Bulk edit existing slash commands. If a command does not exist, it will create it.
+2 -2
View File
@@ -2,13 +2,13 @@ import { rest } from "../../rest/rest.ts";
import { GetInvite } from "../../types/invites/get_invite.ts"; import { GetInvite } from "../../types/invites/get_invite.ts";
import type { Invite } from "../../types/invites/invite.ts"; import type { Invite } from "../../types/invites/invite.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts"; import { snakelize } from "../../util/utils.ts";
/** Returns an invite for the given code or throws an error if the invite doesn't exists. */ /** Returns an invite for the given code or throws an error if the invite doesn't exists. */
export async function getInvite(inviteCode: string, options?: GetInvite) { export async function getInvite(inviteCode: string, options?: GetInvite) {
return await rest.runMethod<Invite>( return await rest.runMethod<Invite>(
"get", "get",
endpoints.INVITE(inviteCode), endpoints.INVITE(inviteCode),
camelKeysToSnakeCase(options ?? {}), snakelize(options ?? {}),
); );
} }
+2 -2
View File
@@ -2,7 +2,7 @@ import { rest } from "../../rest/rest.ts";
import type { CreateGuildBan } from "../../types/guilds/create_guild_ban.ts"; import type { CreateGuildBan } from "../../types/guilds/create_guild_ban.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts"; import { snakelize } from "../../util/utils.ts";
/** Ban a user from the guild and optionally delete previous messages sent by the user. Requires the BAN_MEMBERS permission. */ /** Ban a user from the guild and optionally delete previous messages sent by the user. Requires the BAN_MEMBERS permission. */
export async function ban( export async function ban(
@@ -15,7 +15,7 @@ export async function ban(
return await rest.runMethod<undefined>( return await rest.runMethod<undefined>(
"put", "put",
endpoints.GUILD_BAN(guildId, id), endpoints.GUILD_BAN(guildId, id),
camelKeysToSnakeCase(options), snakelize(options),
); );
} }
+4 -4
View File
@@ -1,9 +1,9 @@
import { cacheHandlers } from "../../cache.ts"; import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts"; import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts"; import { structures } from "../../structures/mod.ts";
import type { GuildMemberWithUser } from "../../types/guilds/guild_member.ts";
import type { ModifyGuildMember } from "../../types/guilds/modify_guild_member.ts";
import { Errors } from "../../types/discordeno/errors.ts"; import { Errors } from "../../types/discordeno/errors.ts";
import type { ModifyGuildMember } from "../../types/guilds/modify_guild_member.ts";
import type { GuildMemberWithUser } from "../../types/members/guild_member.ts";
import type { PermissionStrings } from "../../types/permissions/permission_strings.ts"; import type { PermissionStrings } from "../../types/permissions/permission_strings.ts";
import { bigintToSnowflake } from "../../util/bigint.ts"; import { bigintToSnowflake } from "../../util/bigint.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
@@ -11,7 +11,7 @@ import {
requireBotChannelPermissions, requireBotChannelPermissions,
requireBotGuildPermissions, requireBotGuildPermissions,
} from "../../util/permissions.ts"; } from "../../util/permissions.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts"; import { snakelize } from "../../util/utils.ts";
/** Edit the member */ /** Edit the member */
export async function editMember( export async function editMember(
@@ -73,7 +73,7 @@ export async function editMember(
const result = await rest.runMethod<GuildMemberWithUser>( const result = await rest.runMethod<GuildMemberWithUser>(
"patch", "patch",
endpoints.GUILD_MEMBER(guildId, memberId), endpoints.GUILD_MEMBER(guildId, memberId),
camelKeysToSnakeCase({ snakelize({
...options, ...options,
channelId: options.channelId channelId: options.channelId
? bigintToSnowflake(options.channelId) ? bigintToSnowflake(options.channelId)
+2 -2
View File
@@ -1,9 +1,9 @@
import { cache } from "../../cache.ts"; import { cache } from "../../cache.ts";
import { DiscordenoMember } from "../../structures/member.ts"; import { DiscordenoMember } from "../../structures/member.ts";
import { DiscordGatewayOpcodes } from "../../types/codes/gateway_opcodes.ts"; import { DiscordGatewayOpcodes } from "../../types/codes/gateway_opcodes.ts";
import { DiscordGatewayIntents } from "../../types/gateway/gateway_intents.ts";
import type { RequestGuildMembers } from "../../types/guilds/request_guild_members.ts";
import { Errors } from "../../types/discordeno/errors.ts"; import { Errors } from "../../types/discordeno/errors.ts";
import { DiscordGatewayIntents } from "../../types/gateway/gateway_intents.ts";
import type { RequestGuildMembers } from "../../types/members/request_guild_members.ts";
import { Collection } from "../../util/collection.ts"; import { Collection } from "../../util/collection.ts";
import { sendShardMessage } from "../../ws/send_shard_message.ts"; import { sendShardMessage } from "../../ws/send_shard_message.ts";
import { ws } from "../../ws/ws.ts"; import { ws } from "../../ws/ws.ts";
+1 -1
View File
@@ -1,7 +1,7 @@
import { cacheHandlers } from "../../cache.ts"; import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts"; import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts"; import { structures } from "../../structures/mod.ts";
import type { GuildMemberWithUser } from "../../types/guilds/guild_member.ts"; import type { GuildMemberWithUser } from "../../types/members/guild_member.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
/** Returns a guild member object for the specified user. /** Returns a guild member object for the specified user.
+3 -3
View File
@@ -3,10 +3,10 @@ import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts"; import { rest } from "../../rest/rest.ts";
import { DiscordenoMember } from "../../structures/member.ts"; import { DiscordenoMember } from "../../structures/member.ts";
import { structures } from "../../structures/mod.ts"; import { structures } from "../../structures/mod.ts";
import { DiscordGatewayIntents } from "../../types/gateway/gateway_intents.ts";
import type { GuildMemberWithUser } from "../../types/guilds/guild_member.ts";
import type { ListGuildMembers } from "../../types/guilds/list_guild_members.ts";
import { Errors } from "../../types/discordeno/errors.ts"; import { Errors } from "../../types/discordeno/errors.ts";
import { DiscordGatewayIntents } from "../../types/gateway/gateway_intents.ts";
import type { GuildMemberWithUser } from "../../types/members/guild_member.ts";
import type { ListGuildMembers } from "../../types/members/list_guild_members.ts";
import { bigintToSnowflake } from "../../util/bigint.ts"; import { bigintToSnowflake } from "../../util/bigint.ts";
import { Collection } from "../../util/collection.ts"; import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
+3 -3
View File
@@ -1,9 +1,9 @@
import { rest } from "../../rest/rest.ts"; import { rest } from "../../rest/rest.ts";
import type { BeginGuildPrune } from "../../types/guilds/begin_guild_prune.ts";
import { Errors } from "../../types/discordeno/errors.ts"; import { Errors } from "../../types/discordeno/errors.ts";
import type { BeginGuildPrune } from "../../types/guilds/begin_guild_prune.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts"; import { snakelize } from "../../util/utils.ts";
/** /**
* Begin a prune operation. Requires the KICK_MEMBERS permission. Returns an object with one 'pruned' key indicating the number of members that were removed in the prune operation. For large guilds it's recommended to set the computePruneCount option to false, forcing 'pruned' to null. Fires multiple Guild Member Remove Gateway events. * Begin a prune operation. Requires the KICK_MEMBERS permission. Returns an object with one 'pruned' key indicating the number of members that were removed in the prune operation. For large guilds it's recommended to set the computePruneCount option to false, forcing 'pruned' to null. Fires multiple Guild Member Remove Gateway events.
@@ -22,7 +22,7 @@ export async function pruneMembers(
const result = await rest.runMethod<{ pruned: number }>( const result = await rest.runMethod<{ pruned: number }>(
"post", "post",
endpoints.GUILD_PRUNE(guildId), endpoints.GUILD_PRUNE(guildId),
camelKeysToSnakeCase(options), snakelize(options),
); );
return result.pruned; return result.pruned;
+2 -2
View File
@@ -2,9 +2,9 @@ import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts"; import { rest } from "../../rest/rest.ts";
import { DiscordenoMember } from "../../structures/member.ts"; import { DiscordenoMember } from "../../structures/member.ts";
import { structures } from "../../structures/mod.ts"; import { structures } from "../../structures/mod.ts";
import type { GuildMemberWithUser } from "../../types/guilds/guild_member.ts";
import type { SearchGuildMembers } from "../../types/members/search_guild_members.ts";
import { Errors } from "../../types/discordeno/errors.ts"; import { Errors } from "../../types/discordeno/errors.ts";
import type { GuildMemberWithUser } from "../../types/members/guild_member.ts";
import type { SearchGuildMembers } from "../../types/members/search_guild_members.ts";
import { Collection } from "../../util/collection.ts"; import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
+3 -3
View File
@@ -2,15 +2,15 @@ import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts"; import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts"; import { structures } from "../../structures/mod.ts";
import { DiscordChannelTypes } from "../../types/channels/channel_types.ts"; import { DiscordChannelTypes } from "../../types/channels/channel_types.ts";
import { Errors } from "../../types/discordeno/errors.ts";
import { DiscordAllowedMentionsTypes } from "../../types/messages/allowed_mentions_types.ts"; import { DiscordAllowedMentionsTypes } from "../../types/messages/allowed_mentions_types.ts";
import { ButtonStyles } from "../../types/messages/components/button_styles.ts"; import { ButtonStyles } from "../../types/messages/components/button_styles.ts";
import type { CreateMessage } from "../../types/messages/create_message.ts"; import type { CreateMessage } from "../../types/messages/create_message.ts";
import type { Message } from "../../types/messages/message.ts"; import type { Message } from "../../types/messages/message.ts";
import { Errors } from "../../types/discordeno/errors.ts";
import type { PermissionStrings } from "../../types/permissions/permission_strings.ts"; import type { PermissionStrings } from "../../types/permissions/permission_strings.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts"; import { requireBotChannelPermissions } from "../../util/permissions.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts"; import { snakelize } from "../../util/utils.ts";
import { validateLength } from "../../util/validate_length.ts"; import { validateLength } from "../../util/validate_length.ts";
import { isActionRow } from "../type_guards/is_action_row.ts"; import { isActionRow } from "../type_guards/is_action_row.ts";
import { isButton } from "../type_guards/is_button.ts"; import { isButton } from "../type_guards/is_button.ts";
@@ -148,7 +148,7 @@ export async function sendMessage(
const result = await rest.runMethod<Message>( const result = await rest.runMethod<Message>(
"post", "post",
endpoints.CHANNEL_MESSAGES(channelId), endpoints.CHANNEL_MESSAGES(channelId),
camelKeysToSnakeCase({ snakelize({
...content, ...content,
...(content.messageReference?.messageId ...(content.messageReference?.messageId
? { ? {
+15 -15
View File
@@ -13,20 +13,6 @@ import { getPins } from "./channels/get_pins.ts";
import { isChannelSynced } from "./channels/is_channel_synced.ts"; import { isChannelSynced } from "./channels/is_channel_synced.ts";
import { startTyping } from "./channels/start_typing.ts"; import { startTyping } from "./channels/start_typing.ts";
import { swapChannels } from "./channels/swap_channels.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 { getOriginalInteractionResponse } from "./commands/get_original_interaction_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 { addDiscoverySubcategory } from "./discovery/add_discovery_subcategory.ts";
import { editDiscovery } from "./discovery/edit_discovery.ts"; import { editDiscovery } from "./discovery/edit_discovery.ts";
import { getDiscoveryCategories } from "./discovery/get_discovery_categories.ts"; import { getDiscoveryCategories } from "./discovery/get_discovery_categories.ts";
@@ -62,6 +48,20 @@ import { guildSplashURL } from "./guilds/guild_splash_url.ts";
import { leaveGuild } from "./guilds/leave_guild.ts"; import { leaveGuild } from "./guilds/leave_guild.ts";
import { deleteIntegration } from "./integrations/delete_integration.ts"; import { deleteIntegration } from "./integrations/delete_integration.ts";
import { getIntegrations } from "./integrations/get_integrations.ts"; import { getIntegrations } from "./integrations/get_integrations.ts";
import { batchEditSlashCommandPermissions } from "./interactions/commands/batch_edit_slash_command_permissions.ts";
import { createSlashCommand } from "./interactions/commands/create_slash_command.ts";
import { deleteSlashCommand } from "./interactions/commands/delete_slash_command.ts";
import { deleteSlashResponse } from "./interactions/commands/delete_slash_response.ts";
import { editSlashCommandPermissions } from "./interactions/commands/edit_slash_command_permissions.ts";
import { editSlashResponse } from "./interactions/commands/edit_slash_response.ts";
import { getSlashCommand } from "./interactions/commands/get_slash_command.ts";
import { getSlashCommands } from "./interactions/commands/get_slash_commands.ts";
import { getSlashCommandPermission } from "./interactions/commands/get_slash_command_permission.ts";
import { getSlashCommandPermissions } from "./interactions/commands/get_slash_command_permissions.ts";
import { upsertSlashCommand } from "./interactions/commands/upsert_slash_command.ts";
import { upsertSlashCommands } from "./interactions/commands/upsert_slash_commands.ts";
import { getOriginalInteractionResponse } from "./interactions/get_original_interaction_response.ts";
import { sendInteractionResponse } from "./interactions/send_interaction_response.ts";
import { createInvite } from "./invites/create_invite.ts"; import { createInvite } from "./invites/create_invite.ts";
import { deleteInvite } from "./invites/delete_invite.ts"; import { deleteInvite } from "./invites/delete_invite.ts";
import { getChannelInvites } from "./invites/get_channel_invites.ts"; import { getChannelInvites } from "./invites/get_channel_invites.ts";
@@ -71,7 +71,6 @@ import { avatarURL } from "./members/avatar_url.ts";
import { ban, banMember } from "./members/ban_member.ts"; import { ban, banMember } from "./members/ban_member.ts";
import { disconnectMember } from "./members/disconnect_member.ts"; import { disconnectMember } from "./members/disconnect_member.ts";
import { editBotNickname } from "./members/edit_bot_nickname.ts"; import { editBotNickname } from "./members/edit_bot_nickname.ts";
import { editBotProfile } from "./members/edit_bot_profile.ts";
import { editMember } from "./members/edit_member.ts"; import { editMember } from "./members/edit_member.ts";
import { fetchMembers } from "./members/fetch_members.ts"; import { fetchMembers } from "./members/fetch_members.ts";
import { getMember } from "./members/get_member.ts"; import { getMember } from "./members/get_member.ts";
@@ -96,6 +95,7 @@ import { removeReaction } from "./messages/remove_reaction.ts";
import { removeReactionEmoji } from "./messages/remove_reaction_emoji.ts"; import { removeReactionEmoji } from "./messages/remove_reaction_emoji.ts";
import { sendMessage } from "./messages/send_message.ts"; import { sendMessage } from "./messages/send_message.ts";
import { unpin, unpinMessage } from "./messages/unpin_message.ts"; import { unpin, unpinMessage } from "./messages/unpin_message.ts";
import { editBotProfile } from "./misc/edit_bot_profile.ts";
import { editBotStatus } from "./misc/edit_bot_status.ts"; import { editBotStatus } from "./misc/edit_bot_status.ts";
import { getGatewayBot } from "./misc/get_gateway_bot.ts"; import { getGatewayBot } from "./misc/get_gateway_bot.ts";
import { getUser } from "./misc/get_user.ts"; import { getUser } from "./misc/get_user.ts";
+2 -2
View File
@@ -1,6 +1,6 @@
import { API_VERSION, BASE_URL, IMAGE_BASE_URL } from "../util/constants.ts"; import { API_VERSION, BASE_URL, IMAGE_BASE_URL } from "../util/constants.ts";
import { loopObject } from "../util/loop_object.ts"; import { loopObject } from "../util/loop_object.ts";
import { snakeKeysToCamelCase } from "../util/utils.ts"; import { camelize } from "../util/utils.ts";
import { rest } from "./rest.ts"; import { rest } from "./rest.ts";
// deno-lint-ignore no-explicit-any // deno-lint-ignore no-explicit-any
@@ -62,7 +62,7 @@ export async function runMethod<T = any>(
method, method,
reject, reject,
respond: (data: { status: number; body?: string }) => respond: (data: { status: number; body?: string }) =>
resolve(snakeKeysToCamelCase<T>(JSON.parse(data.body || "{}"))), resolve(camelize<T>(JSON.parse(data.body || "{}"))),
}, },
{ {
bucketId, bucketId,
+3 -3
View File
@@ -12,19 +12,19 @@ import { leaveGuild } from "../helpers/guilds/leave_guild.ts";
import { getInvites } from "../helpers/invites/get_invites.ts"; import { getInvites } from "../helpers/invites/get_invites.ts";
import { banMember } from "../helpers/members/ban_member.ts"; import { banMember } from "../helpers/members/ban_member.ts";
import { unbanMember } from "../helpers/members/unban_member.ts"; import { unbanMember } from "../helpers/members/unban_member.ts";
import type { PresenceUpdate } from "../types/activity/presence_update.ts";
import { GetGuildAuditLog } from "../types/audit_log/get_guild_audit_log.ts"; import { GetGuildAuditLog } from "../types/audit_log/get_guild_audit_log.ts";
import type { Emoji } from "../types/emojis/emoji.ts"; import type { Emoji } from "../types/emojis/emoji.ts";
import type { CreateGuildBan } from "../types/guilds/create_guild_ban.ts"; import type { CreateGuildBan } from "../types/guilds/create_guild_ban.ts";
import type { Guild } from "../types/guilds/guild.ts"; import type { Guild } from "../types/guilds/guild.ts";
import { DiscordGuildFeatures } from "../types/guilds/guild_features.ts"; import { DiscordGuildFeatures } from "../types/guilds/guild_features.ts";
import type { ModifyGuild } from "../types/guilds/modify_guild.ts";
import type { import type {
GuildMember, GuildMember,
GuildMemberWithUser, GuildMemberWithUser,
} from "../types/guilds/guild_member.ts"; } from "../types/members/guild_member.ts";
import type { ModifyGuild } from "../types/guilds/modify_guild.ts";
import type { DiscordImageFormat } from "../types/misc/image_format.ts"; import type { DiscordImageFormat } from "../types/misc/image_format.ts";
import type { DiscordImageSize } from "../types/misc/image_size.ts"; import type { DiscordImageSize } from "../types/misc/image_size.ts";
import type { PresenceUpdate } from "../types/misc/presence_update.ts";
import { snowflakeToBigint } from "../util/bigint.ts"; import { snowflakeToBigint } from "../util/bigint.ts";
import { cacheMembers } from "../util/cache_members.ts"; import { cacheMembers } from "../util/cache_members.ts";
import { Collection } from "../util/collection.ts"; import { Collection } from "../util/collection.ts";
+2 -2
View File
@@ -8,11 +8,11 @@ import { sendDirectMessage } from "../helpers/members/send_direct_message.ts";
import { addRole } from "../helpers/roles/add_role.ts"; import { addRole } from "../helpers/roles/add_role.ts";
import { removeRole } from "../helpers/roles/remove_role.ts"; import { removeRole } from "../helpers/roles/remove_role.ts";
import type { CreateGuildBan } from "../types/guilds/create_guild_ban.ts"; import type { CreateGuildBan } from "../types/guilds/create_guild_ban.ts";
import type { ModifyGuildMember } from "../types/guilds/modify_guild_member.ts";
import type { import type {
GuildMember, GuildMember,
GuildMemberWithUser, GuildMemberWithUser,
} from "../types/guilds/guild_member.ts"; } from "../types/members/guild_member.ts";
import type { ModifyGuildMember } from "../types/guilds/modify_guild_member.ts";
import type { CreateMessage } from "../types/messages/create_message.ts"; import type { CreateMessage } from "../types/messages/create_message.ts";
import type { DiscordImageFormat } from "../types/misc/image_format.ts"; import type { DiscordImageFormat } from "../types/misc/image_format.ts";
import type { DiscordImageSize } from "../types/misc/image_size.ts"; import type { DiscordImageSize } from "../types/misc/image_size.ts";
+1 -1
View File
@@ -10,7 +10,7 @@ import { removeAllReactions } from "../helpers/messages/remove_all_reactions.ts"
import { removeReaction } from "../helpers/messages/remove_reaction.ts"; import { removeReaction } from "../helpers/messages/remove_reaction.ts";
import { removeReactionEmoji } from "../helpers/messages/remove_reaction_emoji.ts"; import { removeReactionEmoji } from "../helpers/messages/remove_reaction_emoji.ts";
import { sendMessage } from "../helpers/messages/send_message.ts"; import { sendMessage } from "../helpers/messages/send_message.ts";
import type { GuildMember } from "../types/guilds/guild_member.ts"; import type { GuildMember } from "../types/members/guild_member.ts";
import type { CreateMessage } from "../types/messages/create_message.ts"; import type { CreateMessage } from "../types/messages/create_message.ts";
import type { EditMessage } from "../types/messages/edit_message.ts"; import type { EditMessage } from "../types/messages/edit_message.ts";
import type { Message } from "../types/messages/message.ts"; import type { Message } from "../types/messages/message.ts";
+1 -1
View File
@@ -1,6 +1,6 @@
import { eventHandlers } from "../bot.ts"; import { eventHandlers } from "../bot.ts";
import { cache } from "../cache.ts"; import { cache } from "../cache.ts";
import type { GuildMember } from "../types/guilds/guild_member.ts"; import type { GuildMember } from "../types/members/guild_member.ts";
import type { VoiceState } from "../types/voice/voice_state.ts"; import type { VoiceState } from "../types/voice/voice_state.ts";
import { snowflakeToBigint } from "../util/bigint.ts"; import { snowflakeToBigint } from "../util/bigint.ts";
import { createNewProp } from "../util/utils.ts"; import { createNewProp } from "../util/utils.ts";
+1 -1
View File
@@ -1,4 +1,4 @@
import { Integration } from "../integration/integration.ts"; import { Integration } from "../integrations/integration.ts";
import { User } from "../users/user.ts"; import { User } from "../users/user.ts";
import { Webhook } from "../webhooks/webhook.ts"; import { Webhook } from "../webhooks/webhook.ts";
import { AuditLogEntry } from "./audit_log_entry.ts"; import { AuditLogEntry } from "./audit_log_entry.ts";
+1 -1
View File
@@ -1,4 +1,4 @@
import { CreateGlobalApplicationCommand } from "../interactions/create_global_application_command.ts"; import { CreateGlobalApplicationCommand } from "../interactions/commands/create_global_application_command.ts";
export interface DiscordenoCreateApplicationCommand export interface DiscordenoCreateApplicationCommand
extends CreateGlobalApplicationCommand { extends CreateGlobalApplicationCommand {
+2 -2
View File
@@ -6,8 +6,8 @@ import { DiscordenoRole } from "../../structures/role.ts";
import { Collection } from "../../util/collection.ts"; import { Collection } from "../../util/collection.ts";
import { ThreadMember } from "../channels/threads/thread_member.ts"; import { ThreadMember } from "../channels/threads/thread_member.ts";
import { ThreadMembersUpdate } from "../channels/threads/thread_members_update.ts"; import { ThreadMembersUpdate } from "../channels/threads/thread_members_update.ts";
import { IntegrationCreateUpdate } from "../integration/integration_create_update.ts"; import { IntegrationCreateUpdate } from "../integrations/integration_create_update.ts";
import { ApplicationCommandCreateUpdateDelete } from "../interactions/application_command_create_update_delete.ts"; import { ApplicationCommandCreateUpdateDelete } from "../interactions/commands/application_command_create_update_delete.ts";
import { import {
DiscordGatewayPayload, DiscordGatewayPayload,
Emoji, Emoji,
+1 -1
View File
@@ -1,4 +1,4 @@
import { Activity } from "../misc/activity.ts"; import { Activity } from "../activity/activity.ts";
import { DiscordStatusTypes } from "./status_types.ts"; import { DiscordStatusTypes } from "./status_types.ts";
/** https://discord.com/developers/docs/topics/gateway#update-status */ /** https://discord.com/developers/docs/topics/gateway#update-status */
+2 -2
View File
@@ -1,12 +1,12 @@
import { PresenceUpdate } from "../activity/presence_update.ts";
import { Channel } from "../channels/channel.ts"; import { Channel } from "../channels/channel.ts";
import { Emoji } from "../emojis/emoji.ts"; import { Emoji } from "../emojis/emoji.ts";
import { PresenceUpdate } from "../misc/presence_update.ts"; import { GuildMember } from "../members/guild_member.ts";
import { Role } from "../permissions/role.ts"; import { Role } from "../permissions/role.ts";
import { VoiceState } from "../voice/voice_state.ts"; import { VoiceState } from "../voice/voice_state.ts";
import { DiscordDefaultMessageNotificationLevels } from "./default_message_notification_levels.ts"; import { DiscordDefaultMessageNotificationLevels } from "./default_message_notification_levels.ts";
import { DiscordExplicitContentFilterLevels } from "./explicit_content_filter_levels.ts"; import { DiscordExplicitContentFilterLevels } from "./explicit_content_filter_levels.ts";
import { DiscordGuildFeatures } from "./guild_features.ts"; import { DiscordGuildFeatures } from "./guild_features.ts";
import { GuildMember } from "./guild_member.ts";
import { DiscordMfaLevels } from "./mfa_levels.ts"; import { DiscordMfaLevels } from "./mfa_levels.ts";
import { DiscordPremiumTiers } from "./premium_tiers.ts"; import { DiscordPremiumTiers } from "./premium_tiers.ts";
import { DiscordSystemChannelFlags } from "./system_channel_flags.ts"; import { DiscordSystemChannelFlags } from "./system_channel_flags.ts";
@@ -1,5 +1,5 @@
import { Embed } from "../embeds/embed.ts"; import { Embed } from "../../embeds/embed.ts";
import { AllowedMentions } from "../messages/allowed_mentions.ts"; import { AllowedMentions } from "../../messages/allowed_mentions.ts";
/** https://discord.com/developers/docs/interactions/slash-commands#interaction-response-interactionapplicationcommandcallbackdata */ /** https://discord.com/developers/docs/interactions/slash-commands#interaction-response-interactionapplicationcommandcallbackdata */
export interface InteractionApplicationCommandCallbackData { export interface InteractionApplicationCommandCallbackData {
@@ -1,7 +1,7 @@
import { Channel } from "../channels/channel.ts"; import { Channel } from "../../channels/channel.ts";
import { GuildMember } from "../guilds/guild_member.ts"; import { GuildMember } from "../../members/guild_member.ts";
import { Role } from "../permissions/role.ts"; import { Role } from "../../permissions/role.ts";
import { User } from "../users/user.ts"; import { User } from "../../users/user.ts";
export interface ApplicationCommandInteractionDataResolved { export interface ApplicationCommandInteractionDataResolved {
/** The Ids and User objects */ /** The Ids and User objects */
+2 -2
View File
@@ -1,7 +1,7 @@
import { GuildMemberWithUser } from "../guilds/guild_member.ts"; import { GuildMemberWithUser } from "../members/guild_member.ts";
import { Message } from "../messages/message.ts"; import { Message } from "../messages/message.ts";
import { User } from "../users/user.ts"; import { User } from "../users/user.ts";
import { ApplicationCommandInteractionData } from "./application_command_interaction_data.ts"; import { ApplicationCommandInteractionData } from "./commands/application_command_interaction_data.ts";
import { DiscordInteractionTypes } from "./interaction_types.ts"; import { DiscordInteractionTypes } from "./interaction_types.ts";
/** https://discord.com/developers/docs/interactions/slash-commands#interaction */ /** https://discord.com/developers/docs/interactions/slash-commands#interaction */
@@ -1,4 +1,4 @@
import { GuildMember } from "../guilds/guild_member.ts"; import { GuildMember } from "../members/guild_member.ts";
/** https://discord.com/developers/docs/resources/guild#guild-member-object */ /** https://discord.com/developers/docs/resources/guild#guild-member-object */
export interface InteractionGuildMember extends GuildMember { export interface InteractionGuildMember extends GuildMember {
@@ -1,4 +1,4 @@
import { InteractionApplicationCommandCallbackData } from "./application_command_callback_data.ts"; import { InteractionApplicationCommandCallbackData } from "./commands/application_command_callback_data.ts";
import { DiscordInteractionResponseTypes } from "./interaction_response_types.ts"; import { DiscordInteractionResponseTypes } from "./interaction_response_types.ts";
/** https://discord.com/developers/docs/interactions/slash-commands#interaction-response */ /** https://discord.com/developers/docs/interactions/slash-commands#interaction-response */
+1 -1
View File
@@ -1,4 +1,4 @@
import { GuildMemberWithUser } from "../guilds/guild_member.ts"; import { GuildMemberWithUser } from "../members/guild_member.ts";
/** https://discord.com/developers/docs/topics/gateway#guild-member-add */ /** https://discord.com/developers/docs/topics/gateway#guild-member-add */
export interface GuildMemberAdd extends GuildMemberWithUser { export interface GuildMemberAdd extends GuildMemberWithUser {
+2 -2
View File
@@ -1,5 +1,5 @@
import { GuildMemberWithUser } from "../guilds/guild_member.ts"; import { PresenceUpdate } from "../activity/presence_update.ts";
import { PresenceUpdate } from "../misc/presence_update.ts"; import { GuildMemberWithUser } from "../members/guild_member.ts";
/** https://discord.com/developers/docs/topics/gateway#guild-members-chunk */ /** https://discord.com/developers/docs/topics/gateway#guild-members-chunk */
export interface GuildMembersChunk { export interface GuildMembersChunk {

Some files were not shown because too many files have changed in this diff Show More