Added Basic Redis Caching for DB Queries

This commit is contained in:
Ahmad 2025-02-26 21:35:01 -05:00
parent e1003ee214
commit 0d04adf4fd
No known key found for this signature in database
GPG key ID: 8FD8A93530D182BF
8 changed files with 386 additions and 58 deletions

View file

@ -17,9 +17,12 @@ export const memberJoin = {
}
try {
const members = await guild.members.fetch();
const nonBotMembers = members.filter((m) => !m.user.bot);
await setMembers(nonBotMembers);
await setMembers([
{
discordId: member.user.id,
discordUsername: member.user.username,
},
]);
if (!member.user.bot) {
const attachment = await generateMemberBanner({
@ -37,10 +40,6 @@ export const memberJoin = {
content: `Welcome to ${guild.name}, we hope you enjoy your stay!`,
files: [attachment],
}),
updateMember({
discordId: member.user.id,
currentlyInServer: true,
}),
member.roles.add(config.roles.joinRoles),
logAction({
guild,

View file

@ -1,9 +1,19 @@
import { Client, Events } from 'discord.js';
import { setMembers } from '../db/db.js';
import { loadConfig } from '../util/configLoader.js';
export default {
name: Events.ClientReady,
once: true,
execute: async (client: Client) => {
const config = loadConfig();
const members = await client.guilds.cache
.find((guild) => guild.id === config.guildId)
?.members.fetch();
const nonBotMembers = members!.filter((m) => !m.user.bot);
await setMembers(nonBotMembers);
console.log(`Ready! Logged in as ${client.user?.tag}`);
},
};