refactor: remove unused imports (#2021)

* make lib faster (delete unused import)

* Revert deno.json change

* Missing }
This commit is contained in:
LTS20050703
2022-02-09 19:38:11 +07:00
committed by GitHub
parent a6f0287bbb
commit 3b3663f2b9
30 changed files with 7 additions and 67 deletions

View File

@@ -1,19 +1,5 @@
import {
checkRateLimits,
cleanupQueues,
createRequestBody,
createRestManager,
CreateRestManagerOptions,
processGlobalQueue,
processQueue,
processRateLimitedPaths,
processRequest,
processRequestHeaders,
runMethod,
simplifyUrl,
} from "./rest/mod.ts";
import type { RestPayload, RestRateLimitedPath, RestRequest } from "./rest/rest.ts";
import { GatewayIntents, Intents } from "./types/gateway/gatewayIntents.ts";
import { createRestManager, CreateRestManagerOptions } from "./rest/mod.ts";
import { GatewayIntents } from "./types/gateway/gatewayIntents.ts";
import { GetGatewayBot } from "./types/gateway/getGatewayBot.ts";
import { bigintToSnowflake, snowflakeToBigint } from "./util/bigint.ts";
import { Collection } from "./util/collection.ts";
@@ -45,23 +31,7 @@ import {
} from "./util/constants.ts";
import { Errors } from "./types/discordeno/errors.ts";
import { DiscordGatewayPayload, GatewayDispatchEventNames, GatewayPayload } from "./types/gateway/gatewayPayload.ts";
import {
closeWS,
createGatewayManager,
createShard,
DiscordenoShard,
GatewayManager,
handleOnMessage,
heartbeat,
identify,
prepareBuckets,
processGatewayQueue,
resharder,
resume,
sendShardMessage,
spawnShards,
tellWorkerToIdentify,
} from "./ws/mod.ts";
import { createGatewayManager, GatewayManager } from "./ws/mod.ts";
import { validateLength } from "./util/validateLength.ts";
import { delay, formatImageURL, hasProperty } from "./util/utils.ts";
import { iconBigintToHash, iconHashToBigInt } from "./util/hash.ts";
@@ -85,7 +55,6 @@ import { transformComponent } from "./transformers/component.ts";
import { transformWebhook } from "./transformers/webhook.ts";
import { transformAuditlogEntry } from "./transformers/auditlogEntry.ts";
import { transformApplicationCommandPermission } from "./transformers/applicationCommandPermission.ts";
import { StatusUpdate } from "./types/gateway/statusUpdate.ts";
import { calculateBits, calculatePermissions } from "./util/permissions.ts";
import { transformScheduledEvent } from "./transformers/scheduledEvent.ts";
import { DiscordenoScheduledEvent } from "./transformers/scheduledEvent.ts";

View File

@@ -2,7 +2,6 @@ import { Bot } from "../../bot.ts";
import { ThreadListSync } from "../../types/channels/threads/threadListSync.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gatewayPayload.ts";
import { SnakeCasedPropertiesDeep } from "../../types/util.ts";
import { Collection } from "../../util/collection.ts";
export async function handleThreadListSync(bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as SnakeCasedPropertiesDeep<ThreadListSync>;

View File

@@ -1,6 +1,6 @@
import type { Channel } from "../../types/channels/channel.ts";
import { ChannelTypes } from "../../types/channels/channelTypes.ts";
import type { CreateGuildChannel, DiscordCreateGuildChannel } from "../../types/guilds/createGuildChannel.ts";
import type { CreateGuildChannel } from "../../types/guilds/createGuildChannel.ts";
import type { Bot } from "../../bot.ts";
/** Create a channel in your server. Bot needs MANAGE_CHANNEL permissions in the server. */

View File

@@ -1,4 +1,3 @@
import { ChannelTypes } from "../../types/channels/channelTypes.ts";
import type { Bot } from "../../bot.ts";
/**

View File

@@ -1,9 +1,7 @@
import { ListActiveThreads } from "../../../types/channels/threads/listActiveThreads.ts";
import { ListPublicArchivedThreads } from "../../../types/channels/threads/listPublicArchivedThreads.ts";
import { PermissionStrings } from "../../../types/permissions/permissionStrings.ts";
import { Collection } from "../../../util/collection.ts";
import type { Bot } from "../../../bot.ts";
// import { channelToThread } from "../../../util/transformers/channel_to_thread.ts";
/** Get the archived threads for this channel, defaults to public */
export async function getArchivedThreads(

View File

@@ -1,6 +1,5 @@
import type { ValidateDiscoverySearchTerm } from "../../types/discovery/validateDiscoverySearchTerm.ts";
import type { Bot } from "../../bot.ts";
import { SnakeCasedPropertiesDeep } from "../../types/util.ts";
export async function validDiscoveryTerm(bot: Bot, term: string) {
const result = await bot.rest.runMethod<ValidateDiscoverySearchTerm>(

View File

@@ -1,5 +1,4 @@
import type { Emoji } from "../../types/emojis/emoji.ts";
import { Errors } from "../../types/discordeno/errors.ts";
import type { Bot } from "../../bot.ts";
/**

View File

@@ -1,6 +1,5 @@
import type { Bot } from "../../bot.ts";
import type { Emoji } from "../../types/emojis/emoji.ts";
import { Errors } from "../../types/discordeno/errors.ts";
import { Collection } from "../../util/collection.ts";
/**

View File

@@ -1,5 +1,5 @@
import { Bot } from "../../../bot.ts";
import { EditScheduledEvent, ScheduledEvent, ScheduledEventEntityType } from "../../../types/guilds/scheduledEvents.ts";
import { EditScheduledEvent, ScheduledEvent } from "../../../types/guilds/scheduledEvents.ts";
/** Modify a guild scheduled event. To start or end an event, use this endpoint to modify the event's status. */
export async function editScheduledEvent(

View File

@@ -1,6 +1,5 @@
import type { DiscordenoEditWebhookMessage } from "../../../types/discordeno/editWebhookMessage.ts";
import type { Bot } from "../../../bot.ts";
import { AllowedMentionsTypes } from "../../../types/messages/allowedMentionsTypes.ts";
import { MessageComponentTypes } from "../../../types/messages/components/messageComponentTypes.ts";
/** To edit your response to a application command. If a messageId is not provided it will default to editing the original response. */

View File

@@ -3,7 +3,6 @@ import type { EditGlobalApplicationCommand } from "../../../types/interactions/c
import type { MakeRequired } from "../../../types/util.ts";
import type { Bot } from "../../../bot.ts";
import { Collection } from "../../../util/collection.ts";
import { ApplicationCommandOption } from "../../../types/interactions/commands/applicationCommandOption.ts";
import { makeOptionsForCommand } from "./createApplicationCommand.ts";
/**

View File

@@ -1,5 +1,4 @@
import { Bot } from "../../../bot.ts";
import { AllowedMentionsTypes } from "../../../types/messages/allowedMentionsTypes.ts";
import { MessageComponentTypes } from "../../../types/messages/components/messageComponentTypes.ts";
import { Message } from "../../../types/messages/message.ts";
import { EditWebhookMessage } from "../../../types/webhooks/editWebhookMessage.ts";

View File

@@ -1,6 +1,5 @@
import type { Bot } from "../../bot.ts";
import type { Message } from "../../types/messages/message.ts";
import type { SnakeCasedPropertiesDeep } from "../../types/util.ts";
/** Returns the initial Interaction response. Functions the same as Get Webhook Message */
export async function getOriginalInteractionResponse(bot: Bot, token: string) {

View File

@@ -1,6 +1,5 @@
import type { InviteMetadata } from "../../types/invites/inviteMetadata.ts";
import { Collection } from "../../util/collection.ts";
import { SnakeCasedPropertiesDeep } from "../../types/util.ts";
import type { Bot } from "../../bot.ts";
/** Get all the invites for this guild. Requires MANAGE_GUILD permission */

View File

@@ -1,9 +1,7 @@
import type { RequestGuildMembers } from "../../types/members/requestGuildMembers.ts";
import { Collection } from "../../util/collection.ts";
import type { Bot } from "../../bot.ts";
import { GatewayIntents } from "../../types/gateway/gatewayIntents.ts";
import { GatewayOpcodes } from "../../types/codes/gatewayOpcodes.ts";
import type { DiscordenoMember } from "../../transformers/member.ts";
/**
* Highly recommended to use this function to fetch members instead of getMember from REST.

View File

@@ -2,7 +2,6 @@ import type { GuildMemberWithUser } from "../../types/members/guildMember.ts";
import type { ListGuildMembers } from "../../types/members/listGuildMembers.ts";
import type { Bot } from "../../bot.ts";
import { Collection } from "../../util/collection.ts";
import type { DiscordenoMember } from "../../transformers/member.ts";
/**
* Highly recommended to **NOT** use this function to get members instead use fetchMembers().

View File

@@ -1,6 +1,5 @@
import type { Message } from "../../types/messages/message.ts";
import type { Bot } from "../../bot.ts";
import { SnakeCasedPropertiesDeep } from "../../types/util.ts";
/** Crosspost a message in a News Channel to following channels. */
export async function publishMessage(bot: Bot, channelId: bigint, messageId: bigint) {

View File

@@ -1,4 +1,3 @@
import { AllowedMentionsTypes } from "../../types/messages/allowedMentionsTypes.ts";
import type { CreateMessage } from "../../types/messages/createMessage.ts";
import type { Message } from "../../types/messages/message.ts";
import type { Bot } from "../../bot.ts";

View File

@@ -1,4 +1,3 @@
import { Errors } from "../../types/discordeno/errors.ts";
import type { User } from "../../types/users/user.ts";
import type { Bot } from "../../bot.ts";

View File

@@ -1,6 +1,5 @@
import type { GetGatewayBot } from "../../types/gateway/getGatewayBot.ts";
import type { Bot } from "../../bot.ts";
import { SnakeCasedPropertiesDeep } from "../../types/util.ts";
/** Get the bots Gateway metadata that can help during the operation of large or sharded bots. */
export async function getGatewayBot(bot: Bot): Promise<GetGatewayBot> {

View File

@@ -1,6 +1,5 @@
import type { User } from "../../types/users/user.ts";
import type { Bot } from "../../bot.ts";
import { SnakeCasedPropertiesDeep } from "../../types/util.ts";
/** This function will return the raw user payload in the rare cases you need to fetch a user directly from the API. */
export async function getUser(bot: Bot, userId: bigint) {

View File

@@ -1,7 +1,6 @@
import type { ModifyWebhook } from "../../types/webhooks/modifyWebhook.ts";
import type { Webhook } from "../../types/webhooks/webhook.ts";
import type { Bot } from "../../bot.ts";
import type { SnakeCasedPropertiesDeep } from "../../types/util.ts";
/** Edit a webhook. Returns the updated webhook object on success. */
export async function editWebhookWithToken(

View File

@@ -1,7 +1,6 @@
import type { Bot } from "../../bot.ts";
import type { Webhook } from "../../types/webhooks/webhook.ts";
import { Collection } from "../../util/collection.ts";
import type { SnakeCasedPropertiesDeep } from "../../types/util.ts";
/** Returns a list of guild webhooks objects. Requires the MANAGE_WEBHOOKs permission. */
export async function getWebhooks(bot: Bot, guildId: bigint) {

View File

@@ -1,5 +1,4 @@
import type { Bot } from "../../bot.ts";
import { AllowedMentionsTypes } from "../../types/messages/allowedMentionsTypes.ts";
import type { Message } from "../../types/messages/message.ts";
import type { ExecuteWebhook } from "../../types/webhooks/executeWebhook.ts";

View File

@@ -1,10 +1,8 @@
import { Bot } from "../bot.ts";
import { AuditLogEntry } from "../types/auditLog/auditLogEntry.ts";
import { AuditLogEvents } from "../types/auditLog/auditLogEvents.ts";
import { DiscordOverwrite, Overwrite } from "../types/channels/overwrite.ts";
import { Role } from "../types/permissions/role.ts";
import { DiscordOverwrite } from "../types/channels/overwrite.ts";
import { SnakeCasedPropertiesDeep } from "../types/util.ts";
import { DiscordenoUser } from "./member.ts";
export function transformAuditlogEntry(
bot: Bot,

View File

@@ -1,5 +1,4 @@
import { Bot } from "../bot.ts";
import type { Emoji } from "../types/emojis/emoji.ts";
import type { Guild } from "../types/guilds/guild.ts";
import { Collection } from "../util/collection.ts";
import { DiscordenoRole } from "./role.ts";

View File

@@ -1,5 +1,5 @@
import { Bot } from "../bot.ts";
import { Invite, InviteCreate, TargetTypes } from "../types/mod.ts";
import { InviteCreate, TargetTypes } from "../types/mod.ts";
import { SnakeCasedPropertiesDeep } from "../types/util.ts";
import { DiscordenoApplication } from "./application.ts";
import { DiscordenoUser } from "./member.ts";

View File

@@ -2,7 +2,6 @@ import { FileContent } from "../../discordeno/fileContent.ts";
import { Embed } from "../../embeds/embed.ts";
import { AllowedMentions } from "../../messages/allowedMentions.ts";
import { MessageComponents } from "../../messages/components/messageComponents.ts";
import { CreateMessage } from "../../messages/createMessage.ts";
import { ApplicationCommandOptionChoice } from "./applicationCommandOptionChoice.ts";
/** https://discord.com/developers/docs/interactions/slash-commands#interaction-response-interactionapplicationcommandcallbackdata */

View File

@@ -1,4 +1,3 @@
import { SnakeCasedPropertiesDeep } from "../../util.ts";
import { ButtonStyles } from "./buttonStyles.ts";
import { MessageComponentTypes } from "./messageComponentTypes.ts";

View File

@@ -1,6 +1,5 @@
import { Embed } from "../embeds/embed.ts";
import { AllowedMentions } from "../messages/allowedMentions.ts";
import { MessageReference } from "../messages/messageReference.ts";
import { FileContent } from "../discordeno/fileContent.ts";
import { SnakeCasedPropertiesDeep } from "../util.ts";
import { MessageComponents } from "./components/messageComponents.ts";