ass man 🧍
ass man 🧍
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
man i feel so stupid 😭
56 replies
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
oh
56 replies
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
let me log oldMember since thats the one thats erroring
56 replies
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
wdym?
56 replies
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
const checkedRoleId = '1302367535395508325';
const secondaryRoleId = '1306786490671562833';

module.exports = {
event: 'guildMemberUpdate',
once: false,

async execute(oldMember, newMember, client) {
try {
const oldRoles = oldMember.roles.cache.has(checkedRoleId);
const newRoles = newMember.roles.cache.has(checkedRoleId);

if (oldRoles && !newRoles) {
if (newMember.roles.cache.has(secondaryRoleId)) {
await newMember.roles.remove(secondaryRoleId);
}
}
} catch (error) {
console.error(error);
}
}
};
const checkedRoleId = '1302367535395508325';
const secondaryRoleId = '1306786490671562833';

module.exports = {
event: 'guildMemberUpdate',
once: false,

async execute(oldMember, newMember, client) {
try {
const oldRoles = oldMember.roles.cache.has(checkedRoleId);
const newRoles = newMember.roles.cache.has(checkedRoleId);

if (oldRoles && !newRoles) {
if (newMember.roles.cache.has(secondaryRoleId)) {
await newMember.roles.remove(secondaryRoleId);
}
}
} catch (error) {
console.error(error);
}
}
};
56 replies
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
const guildId = '1302367535185920131';

module.exports = {
event: 'ready',
once: false,

async execute(client) {
const guild = client.guilds.cache.get(guildId);

try {
await guild.members.fetch();
console.log(`Got all members`);
} catch (error) {
console.error('Failed to fetch members', error);
}
}
}
const guildId = '1302367535185920131';

module.exports = {
event: 'ready',
once: false,

async execute(client) {
const guild = client.guilds.cache.get(guildId);

try {
await guild.members.fetch();
console.log(`Got all members`);
} catch (error) {
console.error('Failed to fetch members', error);
}
}
}
56 replies
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
hey so uhm, im still getting the same error after fetching all the members in the guild
56 replies
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
okay ty
56 replies
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
const oldRoles = oldMember.roles.cache.has(checkedRoleId);
56 replies
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
heres the full error
TypeError: Cannot read properties of undefined (reading 'cache')
at Object.execute (C:\Users\nbarb\psrp\src\events\5050System.js:10:40)
at Client.<anonymous> (C:\Users\nbarb\psrp\src\utils\EventHandler.js:113:21)
at Client.emit (node:events:519:28)
at GuildMemberUpdateAction.handle (C:\Users\nbarb\psrp\node_modules\discord.js\src\client\actions\GuildMemberUpdate.js:30:74)
at module.exports [as GUILD_MEMBER_UPDATE] (C:\Users\nbarb\psrp\node_modules\discord.js\src\client\websocket\handlers\GUILD_MEMBER_UPDATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\nbarb\psrp\node_modules\discord.js\src\client\websocket\WebSocketManager.js:348:31)
at WebSocketManager.<anonymous> (C:\Users\nbarb\psrp\node_modules\discord.js\src\client\websocket\WebSocketManager.js:232:12)
at WebSocketManager.emit (C:\Users\nbarb\psrp\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
at WebSocketShard.<anonymous> (C:\Users\nbarb\psrp\node_modules\@discordjs\ws\dist\index.js:1190:51)
at WebSocketShard.emit (C:\Users\nbarb\psrp\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
at WebSocketShard.onMessage (C:\Users\nbarb\psrp\node_modules\@discordjs\ws\dist\index.js:1005:14)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
TypeError: Cannot read properties of undefined (reading 'cache')
at Object.execute (C:\Users\nbarb\psrp\src\events\5050System.js:10:40)
at Client.<anonymous> (C:\Users\nbarb\psrp\src\utils\EventHandler.js:113:21)
at Client.emit (node:events:519:28)
at GuildMemberUpdateAction.handle (C:\Users\nbarb\psrp\node_modules\discord.js\src\client\actions\GuildMemberUpdate.js:30:74)
at module.exports [as GUILD_MEMBER_UPDATE] (C:\Users\nbarb\psrp\node_modules\discord.js\src\client\websocket\handlers\GUILD_MEMBER_UPDATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\nbarb\psrp\node_modules\discord.js\src\client\websocket\WebSocketManager.js:348:31)
at WebSocketManager.<anonymous> (C:\Users\nbarb\psrp\node_modules\discord.js\src\client\websocket\WebSocketManager.js:232:12)
at WebSocketManager.emit (C:\Users\nbarb\psrp\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
at WebSocketShard.<anonymous> (C:\Users\nbarb\psrp\node_modules\@discordjs\ws\dist\index.js:1190:51)
at WebSocketShard.emit (C:\Users\nbarb\psrp\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
at WebSocketShard.onMessage (C:\Users\nbarb\psrp\node_modules\@discordjs\ws\dist\index.js:1005:14)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
56 replies
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
It is there when I logged it
56 replies
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
okay makes sense
56 replies
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
so would I fetch all members in the same file before everything or would i do it in lets say in a ready event
56 replies
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
ok ok
56 replies
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
I'm trying to check to see if a certain role got removed, and if so, it removes a different role.
56 replies
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
Oh like what am I trying to do?
56 replies
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
It still says the same error.
56 replies
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
Let me remove both and get back to you.
56 replies
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
So would I just remove the oldMember.fetch part and leave the newMember or remove both?
56 replies
DIAdiscord.js - Imagine an app
Created by ass man 🧍 on 11/27/2024 in #djs-questions
Caching Issues
Sorry for not specifying, this is a guildMemberUpdate event.
56 replies