this is the biggest pain ever

This commit is contained in:
ITOH
2021-05-04 12:38:54 +02:00
parent 320180edee
commit 19cbad63a2
95 changed files with 141 additions and 144 deletions
@@ -1,6 +1,6 @@
import { DiscordOverwrite } from "../../types/channels/overwrite.ts";
import type { DiscordOverwrite } from "../../types/channels/overwrite.ts";
import { DiscordBitwisePermissionFlags } from "../../types/permissions/bitwise_permission_flags.ts";
import { PermissionStrings } from "../../types/permissions/permission_strings.ts";
import type { PermissionStrings } from "../../types/permissions/permission_strings.ts";
/** Checks if a channel overwrite for a user id or a role id has permission in this channel */
export function channelOverwriteHasPermission(
+1 -1
View File
@@ -1,6 +1,6 @@
import { cacheHandlers } from "../../cache.ts";
import { DiscordChannelTypes } from "../../types/channels/channel_types.ts";
import { CreateGuildChannel } from "../../types/guilds/create_guild_channel.ts";
import type { CreateGuildChannel } from "../../types/guilds/create_guild_channel.ts";
import { Errors } from "../../types/misc/errors.ts";
import { bigintToSnowflake } from "../../util/bigint.ts";
import { calculatePermissions } from "../../util/permissions.ts";
+3 -3
View File
@@ -2,13 +2,13 @@ import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { Channel } from "../../types/channels/channel.ts";
import type { Channel } from "../../types/channels/channel.ts";
import { DiscordChannelTypes } from "../../types/channels/channel_types.ts";
import {
import type {
CreateGuildChannel,
DiscordCreateGuildChannel,
} from "../../types/guilds/create_guild_channel.ts";
import { PermissionStrings } from "../../types/permissions/permission_strings.ts";
import type { PermissionStrings } from "../../types/permissions/permission_strings.ts";
import { endpoints } from "../../util/constants.ts";
import {
calculateBits,
+2 -2
View File
@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { ModifyChannel } from "../../types/channels/modify_channel.ts";
import { Channel } from "../../types/mod.ts";
import type { Channel } from "../../types/channels/channel.ts";
import type { ModifyChannel } from "../../types/channels/modify_channel.ts";
import { endpoints } from "../../util/constants.ts";
import {
calculateBits,
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Overwrite } from "../../types/channels/overwrite.ts";
import type { Overwrite } from "../../types/channels/overwrite.ts";
import { endpoints } from "../../util/constants.ts";
import {
calculateBits,
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { FollowedChannel } from "../../types/channels/followed_channel.ts";
import type { FollowedChannel } from "../../types/channels/followed_channel.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts";
+1 -1
View File
@@ -1,7 +1,7 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { Channel } from "../../types/channels/channel.ts";
import type { Channel } from "../../types/channels/channel.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
import { endpoints } from "../../util/constants.ts";
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Webhook } from "../../types/webhooks/webhook.ts";
import type { Webhook } from "../../types/webhooks/webhook.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts";
+1 -1
View File
@@ -1,7 +1,7 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { Channel } from "../../types/channels/channel.ts";
import type { Channel } from "../../types/channels/channel.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";
+1 -1
View File
@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { Message } from "../../types/messages/message.ts";
import type { Message } from "../../types/messages/message.ts";
import { endpoints } from "../../util/constants.ts";
/** Get pinned messages in this channel. */
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { ModifyGuildChannelPositions } from "../../types/guilds/modify_guild_channel_position.ts";
import type { ModifyGuildChannelPositions } from "../../types/guilds/modify_guild_channel_position.ts";
import { endpoints } from "../../util/constants.ts";
/** Modify the positions of channels on the guild. Requires MANAGE_CHANNELS permisison. */
@@ -1,6 +1,6 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { ApplicationCommandPermissions } from "../../types/interactions/application_command_permissions.ts";
import type { ApplicationCommandPermissions } from "../../types/interactions/application_command_permissions.ts";
import { endpoints } from "../../util/constants.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts";
+2 -2
View File
@@ -1,7 +1,7 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { CreateGlobalApplicationCommand } from "../../types/interactions/create_global_application_command.ts";
import { ApplicationCommand } from "../../types/mod.ts";
import type { ApplicationCommand } from "../../types/interactions/application_command.ts";
import type { CreateGlobalApplicationCommand } from "../../types/interactions/create_global_application_command.ts";
import { endpoints } from "../../util/constants.ts";
import {
camelKeysToSnakeCase,
@@ -1,6 +1,6 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { ApplicationCommandPermissions } from "../../types/interactions/application_command_permissions.ts";
import type { ApplicationCommandPermissions } from "../../types/interactions/application_command_permissions.ts";
import { endpoints } from "../../util/constants.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts";
+1 -1
View File
@@ -1,7 +1,7 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { 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/misc/errors.ts";
import { endpoints } from "../../util/constants.ts";
+1 -1
View File
@@ -1,6 +1,6 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { ApplicationCommand } from "../../types/interactions/application_command.ts";
import type { ApplicationCommand } from "../../types/interactions/application_command.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. */
@@ -1,6 +1,6 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { GuildApplicationCommandPermissions } from "../../types/interactions/guild_application_command_permissions.ts";
import type { 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. */
@@ -1,6 +1,6 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { GuildApplicationCommandPermissions } from "../../types/interactions/guild_application_command_permissions.ts";
import type { 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. */
+1 -1
View File
@@ -1,6 +1,6 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { ApplicationCommand } from "../../types/interactions/application_command.ts";
import type { ApplicationCommand } from "../../types/interactions/application_command.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";
@@ -1,7 +1,7 @@
import { applicationId, eventHandlers } from "../../bot.ts";
import { cache } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { DiscordenoInteractionResponse } from "../../types/discordeno/interaction_response.ts";
import type { DiscordenoInteractionResponse } from "../../types/discordeno/interaction_response.ts";
import { endpoints } from "../../util/constants.ts";
/**
+2 -2
View File
@@ -1,7 +1,7 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { EditGlobalApplicationCommand } from "../../types/interactions/edit_global_application_command.ts";
import { ApplicationCommand } from "../../types/mod.ts";
import type { ApplicationCommand } from "../../types/interactions/application_command.ts";
import type { EditGlobalApplicationCommand } from "../../types/interactions/edit_global_application_command.ts";
import { endpoints } from "../../util/constants.ts";
import { validateSlashCommands } from "../../util/utils.ts";
@@ -1,7 +1,7 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { EditGlobalApplicationCommand } from "../../types/interactions/edit_global_application_command.ts";
import { ApplicationCommand } from "../../types/mod.ts";
import type { ApplicationCommand } from "../../types/interactions/application_command.ts";
import type { EditGlobalApplicationCommand } from "../../types/interactions/edit_global_application_command.ts";
import { endpoints } from "../../util/constants.ts";
import { validateSlashCommands } from "../../util/utils.ts";
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import {
import type {
AddGuildDiscoverySubcategory,
} from "../../types/discovery/add_guild_discovery_subcategory.ts";
import { endpoints } from "../../util/constants.ts";
+2 -2
View File
@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { DiscoveryMetadata } from "../../types/discovery/discovery_metadata.ts";
import { ModifyGuildDiscoveryMetadata } from "../../types/discovery/modify_guild_discovery_metadata.ts";
import type { DiscoveryMetadata } from "../../types/discovery/discovery_metadata.ts";
import type { ModifyGuildDiscoveryMetadata } from "../../types/discovery/modify_guild_discovery_metadata.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts";
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { DiscoveryCategory } from "../../types/discovery/discovery_category.ts";
import type { DiscoveryCategory } from "../../types/discovery/discovery_category.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { ValidateDiscoverySearchTerm } from "../../types/discovery/validate_discovery_search_term.ts";
import type { ValidateDiscoverySearchTerm } from "../../types/discovery/validate_discovery_search_term.ts";
import { endpoints } from "../../util/constants.ts";
export async function validDiscoveryTerm(term: string) {
+1 -1
View File
@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { CreateGuildEmoji } from "../../types/emojis/create_guild_emoji.ts";
import { Emoji } from "../../types/emojis/emoji.ts";
import type { Emoji } from "../../types/emojis/emoji.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
+2 -2
View File
@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { ModifyGuildEmoji } from "../../types/emojis/modify_guild_emoji.ts";
import { Emoji } from "../../types/mod.ts";
import type { Emoji } from "../../types/emojis/emoji.ts";
import type { ModifyGuildEmoji } from "../../types/emojis/modify_guild_emoji.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
+1 -1
View File
@@ -1,6 +1,6 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { Emoji } from "../../types/emojis/emoji.ts";
import type { Emoji } from "../../types/emojis/emoji.ts";
import { Errors } from "../../types/misc/errors.ts";
import { endpoints } from "../../util/constants.ts";
+1 -1
View File
@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { Emoji } from "../../types/emojis/emoji.ts";
import type { Emoji } from "../../types/emojis/emoji.ts";
import { Errors } from "../../types/misc/errors.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
import { Collection } from "../../util/collection.ts";
+2 -2
View File
@@ -2,8 +2,8 @@ import { botId } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { CreateGuild } from "../../types/guilds/create_guild.ts";
import { Guild } from "../../types/guilds/guild.ts";
import type { CreateGuild } from "../../types/guilds/create_guild.ts";
import type { Guild } from "../../types/guilds/guild.ts";
import { endpoints } from "../../util/constants.ts";
import { getMember } from "../members/get_member.ts";
+2 -2
View File
@@ -1,8 +1,8 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { Guild } from "../../types/guilds/guild.ts";
import { ModifyGuild } from "../../types/guilds/modify_guild.ts";
import type { Guild } from "../../types/guilds/guild.ts";
import type { ModifyGuild } from "../../types/guilds/modify_guild.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
import { urlToBase64 } from "../../util/utils.ts";
+2 -2
View File
@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { ModifyGuildWelcomeScreen } from "../../types/guilds/modify_guild_welcome_screen.ts";
import { WelcomeScreen } from "../../types/mod.ts";
import type { ModifyGuildWelcomeScreen } from "../../types/guilds/modify_guild_welcome_screen.ts";
import type { WelcomeScreen } from "../../types/guilds/welcome_screen.ts";
import { endpoints } from "../../util/constants.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts";
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { GuildWidget } from "../../types/guilds/guild_widget.ts";
import type { GuildWidget } from "../../types/guilds/guild_widget.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
+2 -2
View File
@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { AuditLog } from "../../types/audit_log/audit_log.ts";
import { GetGuildAuditLog } from "../../types/audit_log/get_guild_audit_log.ts";
import type { AuditLog } from "../../types/audit_log/audit_log.ts";
import type { GetGuildAuditLog } from "../../types/audit_log/get_guild_audit_log.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts";
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { VoiceRegion } from "../../types/voice/voice_region.ts";
import type { VoiceRegion } from "../../types/voice/voice_region.ts";
import { endpoints } from "../../util/constants.ts";
/** Returns an array of voice regions that can be used when creating servers. */
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Ban } from "../../types/guilds/ban.ts";
import type { Ban } from "../../types/guilds/ban.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Ban } from "../../types/guilds/ban.ts";
import type { Ban } from "../../types/guilds/ban.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";
+1 -1
View File
@@ -1,7 +1,7 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { Guild } from "../../types/guilds/guild.ts";
import type { Guild } from "../../types/guilds/guild.ts";
import { endpoints } from "../../util/constants.ts";
import { ws } from "../../ws/ws.ts";
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { GuildPreview } from "../../types/guilds/guild_preview.ts";
import type { GuildPreview } from "../../types/guilds/guild_preview.ts";
import { endpoints } from "../../util/constants.ts";
/** Returns the guild preview object for the given id. If the bot is not in the guild, then the guild must be Discoverable. */
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { GetGuildPruneCountQuery } from "../../types/guilds/get_guild_prune_count.ts";
import type { GetGuildPruneCountQuery } from "../../types/guilds/get_guild_prune_count.ts";
import { Errors } from "../../types/misc/errors.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { InviteMetadata } from "../../types/invites/invite_metadata.ts";
import type { InviteMetadata } from "../../types/invites/invite_metadata.ts";
import { endpoints } from "../../util/constants.ts";
/** Returns the code and uses of the vanity url for this server if it is enabled else `code` will be null. Requires the `MANAGE_GUILD` permission. */
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { VoiceRegion } from "../../types/voice/voice_region.ts";
import type { VoiceRegion } from "../../types/voice/voice_region.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { WelcomeScreen } from "../../types/mod.ts";
import type { WelcomeScreen } from "../../types/mod.ts";
import { endpoints } from "../../util/constants.ts";
export async function getWelcomeScreen(guildId: bigint) {
+1 -1
View File
@@ -1,6 +1,6 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { GuildWidgetDetails } from "../../types/guilds/guild_widget_details.ts";
import type { GuildWidgetDetails } from "../../types/guilds/guild_widget_details.ts";
import { Errors } from "../../types/misc/errors.ts";
import { endpoints } from "../../util/constants.ts";
+1 -1
View File
@@ -1,5 +1,5 @@
import { cacheHandlers } from "../../cache.ts";
import { GetGuildWidgetImageQuery } from "../../types/guilds/get_guild_widget_image.ts";
import type { GetGuildWidgetImageQuery } from "../../types/guilds/get_guild_widget_image.ts";
import { Errors } from "../../types/misc/errors.ts";
import { endpoints } from "../../util/constants.ts";
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { GuildWidget } from "../../types/guilds/guild_widget.ts";
import type { GuildWidget } from "../../types/guilds/guild_widget.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
+2 -2
View File
@@ -1,5 +1,5 @@
import { DiscordImageFormat } from "../../types/misc/image_format.ts";
import { DiscordImageSize } from "../../types/misc/image_size.ts";
import type { DiscordImageFormat } from "../../types/misc/image_format.ts";
import type { DiscordImageSize } from "../../types/misc/image_size.ts";
import { endpoints } from "../../util/constants.ts";
import { formatImageURL } from "../../util/utils.ts";
+2 -2
View File
@@ -1,5 +1,5 @@
import { DiscordImageFormat } from "../../types/misc/image_format.ts";
import { DiscordImageSize } from "../../types/misc/image_size.ts";
import type { DiscordImageFormat } from "../../types/misc/image_format.ts";
import type { DiscordImageSize } from "../../types/misc/image_size.ts";
import { endpoints } from "../../util/constants.ts";
import { formatImageURL } from "../../util/utils.ts";
+2 -2
View File
@@ -1,5 +1,5 @@
import { DiscordImageFormat } from "../../types/misc/image_format.ts";
import { DiscordImageSize } from "../../types/misc/image_size.ts";
import type { DiscordImageFormat } from "../../types/misc/image_format.ts";
import type { DiscordImageSize } from "../../types/misc/image_size.ts";
import { endpoints } from "../../util/constants.ts";
import { formatImageURL } from "../../util/utils.ts";
+6 -8
View File
@@ -1,6 +1,5 @@
import { RequestManager } from "../../rest/request_manager.ts";
import {
DiscordUpdateSelfVoiceState,
import { rest } from "../../rest/rest.ts";
import type {
UpdateSelfVoiceState,
} from "../../types/guilds/update_self_voice_state.ts";
import { endpoints } from "../../util/constants.ts";
@@ -15,14 +14,13 @@ import { camelKeysToSnakeCase } from "../../util/utils.ts";
* - You must have the `REQUEST_TO_SPEAK` permission to request to speak. You can always clear your own request to speak.
* - You are able to set `request_to_speak_timestamp` to any present or future time.
*/
export function updateBotVoiceState(
export async function updateBotVoiceState(
guildId: bigint,
data: UpdateSelfVoiceState,
) {
const payload = camelKeysToSnakeCase<DiscordUpdateSelfVoiceState>(data);
return RequestManager.patch(
return await rest.runMethod(
"patch",
endpoints.UPDATE_VOICE_STATE(guildId),
payload,
camelKeysToSnakeCase(data),
);
}
@@ -1,6 +1,5 @@
import { RequestManager } from "../../rest/request_manager.ts";
import {
DiscordUpdateOthersVoiceState,
import { rest } from "../../rest/rest.ts";
import type {
UpdateOthersVoiceState,
} from "../../types/guilds/update_others_voice_state.ts";
import { endpoints } from "../../util/constants.ts";
@@ -20,10 +19,9 @@ export function updateVoiceState(
userId: bigint,
data: UpdateOthersVoiceState,
) {
const payload = camelKeysToSnakeCase<DiscordUpdateOthersVoiceState>(data);
return RequestManager.patch(
return rest.runMethod(
"patch",
endpoints.UPDATE_VOICE_STATE(guildId, userId),
payload,
camelKeysToSnakeCase(data),
);
}
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Integration } from "../../types/mod.ts";
import type { Integration } from "../../types/integration/integration.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
+2 -2
View File
@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { CreateChannelInvite } from "../../types/invites/create_channel_invite.ts";
import { Invite } from "../../types/invites/invite.ts";
import type { CreateChannelInvite } from "../../types/invites/create_channel_invite.ts";
import type { Invite } from "../../types/invites/invite.ts";
import { Errors } from "../../types/misc/errors.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts";
+1 -1
View File
@@ -1,6 +1,6 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { Invite } from "../../types/invites/invite.ts";
import type { Invite } from "../../types/invites/invite.ts";
import { Errors } from "../../types/misc/errors.ts";
import { endpoints } from "../../util/constants.ts";
import {
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Invite } from "../../types/invites/invite.ts";
import type { Invite } from "../../types/invites/invite.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts";
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Invite } from "../../types/invites/invite.ts";
import type { Invite } from "../../types/invites/invite.ts";
import { endpoints } from "../../util/constants.ts";
/** Returns an invite for the given code or throws an error if the invite doesn't exists. */
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Invite } from "../../types/invites/invite.ts";
import type { Invite } from "../../types/invites/invite.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
+2 -2
View File
@@ -1,5 +1,5 @@
import { DiscordImageFormat } from "../../types/misc/image_format.ts";
import { DiscordImageSize } from "../../types/misc/image_size.ts";
import type { DiscordImageFormat } from "../../types/misc/image_format.ts";
import type { DiscordImageSize } from "../../types/misc/image_size.ts";
import { endpoints } from "../../util/constants.ts";
import { formatImageURL } from "../../util/utils.ts";
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { 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 { requireBotGuildPermissions } from "../../util/permissions.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts";
+1 -1
View File
@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { Errors } from "../../types/misc/errors.ts";
import { User } from "../../types/mod.ts";
import type { User } from "../../types/users/user.ts";
import { endpoints } from "../../util/constants.ts";
import { urlToBase64 } from "../../util/utils.ts";
+3 -3
View File
@@ -1,10 +1,10 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { GuildMemberWithUser } from "../../types/guilds/guild_member.ts";
import type { GuildMemberWithUser } from "../../types/guilds/guild_member.ts";
import type { ModifyGuildMember } from "../../types/guilds/modify_guild_member.ts";
import { Errors } from "../../types/misc/errors.ts";
import { ModifyGuildMember } from "../../types/mod.ts";
import { PermissionStrings } from "../../types/permissions/permission_strings.ts";
import type { PermissionStrings } from "../../types/permissions/permission_strings.ts";
import { bigintToSnowflake } from "../../util/bigint.ts";
import { endpoints } from "../../util/constants.ts";
import {
+1 -1
View File
@@ -1,7 +1,7 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { GuildMemberWithUser } from "../../types/guilds/guild_member.ts";
import type { GuildMemberWithUser } from "../../types/guilds/guild_member.ts";
import { endpoints } from "../../util/constants.ts";
/** Returns a guild member object for the specified user.
+2 -2
View File
@@ -4,8 +4,8 @@ import { rest } from "../../rest/rest.ts";
import { DiscordenoMember } from "../../structures/member.ts";
import { structures } from "../../structures/mod.ts";
import { DiscordGatewayIntents } from "../../types/gateway/gateway_intents.ts";
import { GuildMemberWithUser } from "../../types/guilds/guild_member.ts";
import { ListGuildMembers } from "../../types/guilds/list_guild_members.ts";
import type { GuildMemberWithUser } from "../../types/guilds/guild_member.ts";
import type { ListGuildMembers } from "../../types/guilds/list_guild_members.ts";
import { Errors } from "../../types/misc/errors.ts";
import { bigintToSnowflake } from "../../util/bigint.ts";
import { Collection } from "../../util/collection.ts";
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { BeginGuildPrune } from "../../types/guilds/begin_guild_prune.ts";
import type { BeginGuildPrune } from "../../types/guilds/begin_guild_prune.ts";
import { Errors } from "../../types/misc/errors.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
+2 -2
View File
@@ -2,8 +2,8 @@ import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { DiscordenoMember } from "../../structures/member.ts";
import { structures } from "../../structures/mod.ts";
import { GuildMemberWithUser } from "../../types/guilds/guild_member.ts";
import { SearchGuildMembers } from "../../types/members/search_guild_members.ts";
import type { GuildMemberWithUser } from "../../types/guilds/guild_member.ts";
import type { SearchGuildMembers } from "../../types/members/search_guild_members.ts";
import { Errors } from "../../types/misc/errors.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";
+2 -2
View File
@@ -1,8 +1,8 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { Channel } from "../../types/channels/channel.ts";
import { CreateMessage } from "../../types/messages/create_message.ts";
import type { Channel } from "../../types/channels/channel.ts";
import type { CreateMessage } from "../../types/messages/create_message.ts";
import { endpoints } from "../../util/constants.ts";
import { sendMessage } from "../messages/send_message.ts";
+2 -2
View File
@@ -3,9 +3,9 @@ import { rest } from "../../rest/rest.ts";
import { DiscordenoMessage } from "../../structures/message.ts";
import { structures } from "../../structures/mod.ts";
import { EditMessage } from "../../types/messages/edit_message.ts";
import { Message } from "../../types/messages/message.ts";
import type { Message } from "../../types/messages/message.ts";
import { Errors } from "../../types/misc/errors.ts";
import { PermissionStrings } from "../../types/permissions/permission_strings.ts";
import type { PermissionStrings } from "../../types/permissions/permission_strings.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts";
+1 -1
View File
@@ -1,7 +1,7 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { Message } from "../../types/messages/message.ts";
import type { Message } from "../../types/messages/message.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts";
+1 -1
View File
@@ -6,7 +6,7 @@ import {
GetMessagesBefore,
GetMessagesLimit,
} from "../../types/messages/get_messages.ts";
import { Message } from "../../types/messages/message.ts";
import type { Message } from "../../types/messages/message.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts";
+2 -2
View File
@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { GetReactions } from "../../types/messages/message_get_reactions.ts";
import { User } from "../../types/users/user.ts";
import type { GetReactions } from "../../types/messages/message_get_reactions.ts";
import type { User } from "../../types/users/user.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";
+1 -1
View File
@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { Message } from "../../types/messages/message.ts";
import type { Message } from "../../types/messages/message.ts";
import { endpoints } from "../../util/constants.ts";
/** Crosspost a message in a News Channel to following channels. */
+3 -3
View File
@@ -4,10 +4,10 @@ import { structures } from "../../structures/mod.ts";
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 { Message } from "../../types/messages/message.ts";
import type { CreateMessage } from "../../types/messages/create_message.ts";
import type { Message } from "../../types/messages/message.ts";
import { Errors } from "../../types/misc/errors.ts";
import { PermissionStrings } from "../../types/permissions/permission_strings.ts";
import type { PermissionStrings } from "../../types/permissions/permission_strings.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts";
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { GetGatewayBot } from "../../types/gateway/get_gateway_bot.ts";
import type { GetGatewayBot } from "../../types/gateway/get_gateway_bot.ts";
import { endpoints } from "../../util/constants.ts";
/** Get the bots Gateway metadata that can help during the operation of large or sharded bots. */
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { User } from "../../types/users/user.ts";
import type { User } from "../../types/users/user.ts";
import { endpoints } from "../../util/constants.ts";
/** This function will return the raw user payload in the rare cases you need to fetch a user directly from the API. */
+1 -1
View File
@@ -2,7 +2,7 @@ import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { CreateGuildRole } from "../../types/guilds/create_guild_role.ts";
import { Role } from "../../types/permissions/role.ts";
import type { Role } from "../../types/permissions/role.ts";
import { endpoints } from "../../util/constants.ts";
import {
calculateBits,
+2 -1
View File
@@ -1,6 +1,7 @@
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { CreateGuildRole, Role } from "../../types/mod.ts";
import type { CreateGuildRole } from "../../types/guilds/create_guild_role.ts";
import type { Role } from "../../types/permissions/role.ts";
import { endpoints } from "../../util/constants.ts";
import {
calculateBits,
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Role } from "../../types/permissions/role.ts";
import type { Role } from "../../types/permissions/role.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
@@ -1,7 +1,7 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { Guild } from "../../types/guilds/guild.ts";
import { CreateGuildFromTemplate } from "../../types/templates/create_guild_from_template.ts";
import type { Guild } from "../../types/guilds/guild.ts";
import type { CreateGuildFromTemplate } from "../../types/templates/create_guild_from_template.ts";
import { endpoints } from "../../util/constants.ts";
import { urlToBase64 } from "../../util/utils.ts";
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Template } from "../../types/templates/template.ts";
import type { Template } from "../../types/templates/template.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Template } from "../../types/templates/template.ts";
import type { Template } from "../../types/templates/template.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
+2 -2
View File
@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { ModifyGuildTemplate } from "../../types/templates/modify_guild_template.ts";
import { Template } from "../../types/templates/template.ts";
import type { ModifyGuildTemplate } from "../../types/templates/modify_guild_template.ts";
import type { Template } from "../../types/templates/template.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Template } from "../../types/templates/template.ts";
import type { Template } from "../../types/templates/template.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Template } from "../../types/templates/template.ts";
import type { Template } from "../../types/templates/template.ts";
import { endpoints } from "../../util/constants.ts";
/** Returns the guild template if it exists */
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Template } from "../../types/templates/template.ts";
import type { Template } from "../../types/templates/template.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
+2 -2
View File
@@ -1,5 +1,5 @@
import { ActionRow } from "../../types/messages/components/action_row.ts";
import { MessageComponent } from "../../types/messages/components/message_components.ts";
import type { ActionRow } from "../../types/messages/components/action_row.ts";
import type { MessageComponent } from "../../types/messages/components/message_components.ts";
import { MessageComponentTypes } from "../../types/messages/components/message_component_types.ts";
/** A type guard function to tell if it is a action row component */
+2 -2
View File
@@ -1,5 +1,5 @@
import { ButtonComponent } from "../../types/messages/components/button_component.ts";
import { MessageComponent } from "../../types/messages/components/message_components.ts";
import type { ButtonComponent } from "../../types/messages/components/button_component.ts";
import type { MessageComponent } from "../../types/messages/components/message_components.ts";
import { MessageComponentTypes } from "../../types/messages/components/message_component_types.ts";
/** A type guard function to tell if it is a button component */
+2 -2
View File
@@ -1,7 +1,7 @@
import { rest } from "../../rest/rest.ts";
import { Errors } from "../../types/misc/errors.ts";
import { CreateWebhook } from "../../types/webhooks/create_webhook.ts";
import { Webhook } from "../../types/webhooks/webhook.ts";
import type { CreateWebhook } from "../../types/webhooks/create_webhook.ts";
import type { Webhook } from "../../types/webhooks/webhook.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts";
import { urlToBase64 } from "../../util/utils.ts";
+2 -2
View File
@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { ModifyWebhook } from "../../types/webhooks/modify_webhook.ts";
import { Webhook } from "../../types/webhooks/webhook.ts";
import type { ModifyWebhook } from "../../types/webhooks/modify_webhook.ts";
import type { Webhook } from "../../types/webhooks/webhook.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts";
+2 -2
View File
@@ -1,9 +1,9 @@
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { DiscordAllowedMentionsTypes } from "../../types/messages/allowed_mentions_types.ts";
import { Message } from "../../types/messages/message.ts";
import type { Message } from "../../types/messages/message.ts";
import { Errors } from "../../types/misc/errors.ts";
import { EditWebhookMessage } from "../../types/webhooks/edit_webhook_message.ts";
import type { EditWebhookMessage } from "../../types/webhooks/edit_webhook_message.ts";
import { endpoints } from "../../util/constants.ts";
export async function editWebhookMessage(
@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { ModifyWebhook } from "../../types/webhooks/modify_webhook.ts";
import { Webhook } from "../../types/webhooks/webhook.ts";
import type { ModifyWebhook } from "../../types/webhooks/modify_webhook.ts";
import type { Webhook } from "../../types/webhooks/webhook.ts";
import { endpoints } from "../../util/constants.ts";
/** Edit a webhook. Returns the updated webhook object on success. */
+2 -2
View File
@@ -1,9 +1,9 @@
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { DiscordAllowedMentionsTypes } from "../../types/messages/allowed_mentions_types.ts";
import { Message } from "../../types/messages/message.ts";
import type { Message } from "../../types/messages/message.ts";
import { Errors } from "../../types/misc/errors.ts";
import { ExecuteWebhook } from "../../types/webhooks/execute_webhook.ts";
import type { ExecuteWebhook } from "../../types/webhooks/execute_webhook.ts";
import { endpoints } from "../../util/constants.ts";
/** Execute a webhook with webhook Id and webhook token */
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Webhook } from "../../types/webhooks/webhook.ts";
import type { Webhook } from "../../types/webhooks/webhook.ts";
import { endpoints } from "../../util/constants.ts";
/** Returns the new webhook object for the given id. */
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Webhook } from "../../types/webhooks/webhook.ts";
import type { Webhook } from "../../types/webhooks/webhook.ts";
import { endpoints } from "../../util/constants.ts";
/** Returns the new webhook object for the given id, this call does not require authentication and returns no user in the webhook object. */
+1 -1
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Webhook } from "../../types/webhooks/webhook.ts";
import type { Webhook } from "../../types/webhooks/webhook.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";