From e1ec1561bc7f03e08693d8740ff8b7e728312d18 Mon Sep 17 00:00:00 2001 From: Awesome Stickz Date: Sun, 27 Oct 2024 16:56:28 +0530 Subject: [PATCH] refactor!: change channels, guilds etc. in cache.options to singular form to be consistent --- index.ts | 156 +++++++++++++++++++++++++++---------------------------- 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/index.ts b/index.ts index 8f26ad0..44a2adc 100644 --- a/index.ts +++ b/index.ts @@ -68,20 +68,20 @@ export const createProxyCache = { // If available in memory, use it. - if (options.cacheInMemory?.guilds) { + if (options.cacheInMemory?.guild) { const guild = bot.cache.guilds.memory.get(guildId); if (guild) { guild.lastInteractedTime = Date.now(); @@ -157,14 +157,14 @@ export const createProxyCache = { // Remove from memory @@ -193,7 +193,7 @@ export const createProxyCache = { // If available in memory, use it. - if (options.cacheInMemory?.users) { + if (options.cacheInMemory?.user) { const user = bot.cache.users.memory.get(userId); if (user) { user.lastInteractedTime = Date.now(); @@ -203,14 +203,14 @@ export const createProxyCache = { // Remove from memory @@ -238,9 +238,9 @@ export const createProxyCache = { // If available in memory, use it. - if (options.cacheInMemory?.roles) { + if (options.cacheInMemory?.role) { // If guilds are cached, roles will be inside them - if (options.cacheInMemory?.guilds) { + if (options.cacheInMemory?.guild) { const guildId = bot.cache.roles.guildIds.get(roleId); if (guildId) { const role = bot.cache.guilds.memory.get(guildId)?.roles?.get(roleId); @@ -254,14 +254,14 @@ export const createProxyCache = { // Remove from memory @@ -305,9 +305,9 @@ export const createProxyCache = { // If available in memory, use it. - if (options.cacheInMemory?.members) { + if (options.cacheInMemory?.member) { // If guilds are cached, members will be inside them - if (options.cacheInMemory?.guilds) { + if (options.cacheInMemory?.guild) { const member = bot.cache.guilds.memory.get(guildId)?.members?.get(memberId); if (member) { member.lastInteractedTime = Date.now(); @@ -318,14 +318,14 @@ export const createProxyCache = { // Remove from memory @@ -367,9 +367,9 @@ export const createProxyCache = { // If available in memory, use it. - if (options.cacheInMemory?.channels) { + if (options.cacheInMemory?.channel) { // If guilds are cached, channels will be inside them - if (options.cacheInMemory?.guilds) { + if (options.cacheInMemory?.guild) { const guildId = bot.cache.channels.guildIds.get(channelId); if (guildId) { const channel = bot.cache.guilds.memory.get(guildId)?.channels?.get(channelId); @@ -398,14 +398,14 @@ export const createProxyCache = { // Remove from memory @@ -463,11 +463,11 @@ export const createProxyCache = { - if (options.cacheInMemory?.guilds) { + if (options.cacheInMemory?.guild) { // Get the guild id in bigint const guildId = bot.transformers.snowflake(payload.id); // Make a raw guild object we can put in memory before running the old transformer which runs all the other transformers @@ -552,11 +552,11 @@ export const createProxyCache = ; + channel?: DesiredPropsArray; /** The properties you want to keep in a guild object. */ - guilds?: DesiredPropsArray; + guild?: DesiredPropsArray; /** The properties you want to keep in a member object. */ - members?: DesiredPropsArray; + member?: DesiredPropsArray; /** The properties you want to keep in a role object. */ - roles?: DesiredPropsArray; + role?: DesiredPropsArray; /** The properties you want to keep in a user object. */ - users?: DesiredPropsArray; + user?: DesiredPropsArray; }; /** Configure the properties you do NOT want in each object. */ undesiredProps?: { /** The properties you do NOT want in a channel object. */ - channels?: DesiredPropsArray; + channel?: DesiredPropsArray; /** The properties you do NOT want in a guild object. */ - guilds?: DesiredPropsArray; + guild?: DesiredPropsArray; /** The properties you do NOT want in a member object. */ - members?: DesiredPropsArray; + member?: DesiredPropsArray; /** The properties you do NOT want in a role object. */ - roles?: DesiredPropsArray; + role?: DesiredPropsArray; /** The properties you do NOT want in a user object. */ - users?: DesiredPropsArray; + user?: DesiredPropsArray; }; /** * Options to choose how the proxy will cache everything. @@ -739,15 +739,15 @@ export interface CreateProxyCacheOptions