diff --git a/src/cache.ts b/src/cache.ts index e2e67adcb..2f8678cdf 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -1,74 +1,74 @@ -// deno-lint-ignore-file require-await no-explicit-any prefer-const -import { botId } from "./bot.ts"; -import type { DiscordenoChannel } from "./structures/channel.ts"; -import type { DiscordenoGuild } from "./structures/guild.ts"; -import type { DiscordenoMember } from "./structures/member.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 { DiscordenoThread } from "./util/transformers/channel_to_thread.ts"; -import { Collection } from "./util/collection.ts"; -import { Channel } from "./types/channels/channel.ts"; -import { Guild } from "./types/guilds/guild.ts"; -import { GuildMember } from "./types/members/guild_member.ts"; -import { Message } from "./types/messages/message.ts"; -import { Role } from "./types/permissions/role.ts"; -import { VoiceState } from "./types/voice/voice_state.ts"; -import { User } from "./types/users/user.ts"; +// // deno-lint-ignore-file require-await no-explicit-any prefer-const +// import { botId } from "./bot.ts"; +// import type { DiscordenoChannel } from "./structures/channel.ts"; +// import type { DiscordenoGuild } from "./structures/guild.ts"; +// import type { DiscordenoMember } from "./structures/member.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 { DiscordenoThread } from "./util/transformers/channel_to_thread.ts"; +// import { Collection } from "./util/collection.ts"; +// import { Channel } from "./types/channels/channel.ts"; +// import { Guild } from "./types/guilds/guild.ts"; +// import { GuildMember } from "./types/members/guild_member.ts"; +// import { Message } from "./types/messages/message.ts"; +// import { Role } from "./types/permissions/role.ts"; +// import { VoiceState } from "./types/voice/voice_state.ts"; +// import { User } from "./types/users/user.ts"; -export const cache = { - isReady: false, - /** All of the guild objects the bot has access to, mapped by their Ids */ - guilds: new Collection([], { sweeper: { filter: guildSweeper, interval: 3600000 } }), - /** All of the channel objects the bot has access to, mapped by their Ids. Sweep channels 1 minute after guilds are sweeped so dispatchedGuildIds is filled. */ - channels: new Collection([], { sweeper: { filter: channelSweeper, interval: 3660000 } }), - /** All of the message objects the bot has cached since the bot acquired `READY` state, mapped by their Ids */ - messages: new Collection([], { sweeper: { filter: messageSweeper, interval: 300000 } }), - /** All of the member objects that have been cached since the bot acquired `READY` state, mapped by their Ids */ - members: new Collection([], { sweeper: { filter: memberSweeper, interval: 300000 } }), - /** All of the unavailable guilds, mapped by their Ids (id, timestamp) */ - unavailableGuilds: new Collection(), - /** All of the presence update objects received in PRESENCE_UPDATE gateway event, mapped by their user Id */ - presences: new Collection([], { sweeper: { filter: () => true, interval: 300000 } }), - fetchAllMembersProcessingRequests: new Collection< - string, - (value: Collection | PromiseLike>) => void - >(), - executedSlashCommands: new Set(), - get emojis() { - return new Collection( - this.guilds.reduce((a, b) => [...a, ...b.emojis.map((e, id) => [id, e])], [] as any[]) - ); - }, - activeGuildIds: new Set(), - dispatchedGuildIds: new Set(), - dispatchedChannelIds: new Set(), - threads: new Collection(), - /** ADVANCED USER ONLY: Please ask for help before modifying these. The properties that you want to use for your bot's structures. If you do not set any properties, all properties will be used by default. */ - requiredStructureProperties: { - /** Only these properties will be added to memory for your channels. */ - channels: new Set(), - /** Only these properties will be added to memory for your guilds. */ - guilds: new Set(), - /** Only these properties will be added to memory for your members. */ - members: new Set(), - /** Only these properties will be added to memory for your messages. */ - messages: new Set< - | keyof Message - | "isBot" - | "tag" - | "authorId" - | "mentionedUserIds" - | "mentionedRoleIds" - | "mentionedChannelIds" - | "bitfield" - >(), - /** Only these properties will be added to memory for your roles. */ - roles: new Set(), - /** Only these properties will be added to memory for your voice states. */ - voiceStates: new Set(), - }, -}; +// export const cache = { +// isReady: false, +// /** All of the guild objects the bot has access to, mapped by their Ids */ +// guilds: new Collection([], { sweeper: { filter: guildSweeper, interval: 3600000 } }), +// /** All of the channel objects the bot has access to, mapped by their Ids. Sweep channels 1 minute after guilds are sweeped so dispatchedGuildIds is filled. */ +// channels: new Collection([], { sweeper: { filter: channelSweeper, interval: 3660000 } }), +// /** All of the message objects the bot has cached since the bot acquired `READY` state, mapped by their Ids */ +// messages: new Collection([], { sweeper: { filter: messageSweeper, interval: 300000 } }), +// /** All of the member objects that have been cached since the bot acquired `READY` state, mapped by their Ids */ +// members: new Collection([], { sweeper: { filter: memberSweeper, interval: 300000 } }), +// /** All of the unavailable guilds, mapped by their Ids (id, timestamp) */ +// unavailableGuilds: new Collection(), +// /** All of the presence update objects received in PRESENCE_UPDATE gateway event, mapped by their user Id */ +// presences: new Collection([], { sweeper: { filter: () => true, interval: 300000 } }), +// fetchAllMembersProcessingRequests: new Collection< +// string, +// (value: Collection | PromiseLike>) => void +// >(), +// executedSlashCommands: new Set(), +// get emojis() { +// return new Collection( +// this.guilds.reduce((a, b) => [...a, ...b.emojis.map((e, id) => [id, e])], [] as any[]) +// ); +// }, +// activeGuildIds: new Set(), +// dispatchedGuildIds: new Set(), +// dispatchedChannelIds: new Set(), +// threads: new Collection(), +// /** ADVANCED USER ONLY: Please ask for help before modifying these. The properties that you want to use for your bot's structures. If you do not set any properties, all properties will be used by default. */ +// requiredStructureProperties: { +// /** Only these properties will be added to memory for your channels. */ +// channels: new Set(), +// /** Only these properties will be added to memory for your guilds. */ +// guilds: new Set(), +// /** Only these properties will be added to memory for your members. */ +// members: new Set(), +// /** Only these properties will be added to memory for your messages. */ +// messages: new Set< +// | keyof Message +// | "isBot" +// | "tag" +// | "authorId" +// | "mentionedUserIds" +// | "mentionedRoleIds" +// | "mentionedChannelIds" +// | "bitfield" +// >(), +// /** Only these properties will be added to memory for your roles. */ +// roles: new Set(), +// /** Only these properties will be added to memory for your voice states. */ +// voiceStates: new Set(), +// }, +// }; function messageSweeper(message: DiscordenoMessage) { // DM messages aren't needed