Snapper
Snapper
DIAdiscord.js - Imagine an app
Created by Snapper on 2/23/2024 in #djs-questions
message collector filter not working as intended
thank you!
15 replies
DIAdiscord.js - Imagine an app
Created by Snapper on 2/23/2024 in #djs-questions
message collector filter not working as intended
Thank you!
15 replies
DIAdiscord.js - Imagine an app
Created by Snapper on 11/9/2023 in #djs-questions
unable to access cache for member.roles
NVM I figured it out. I just made something really scuffed but it works x'D
12 replies
DIAdiscord.js - Imagine an app
Created by Snapper on 11/9/2023 in #djs-questions
unable to access cache for member.roles
I was reading up on it and it looks like fetching over 100 guild members will leave the fetch command hanging. I'm still not super familiar with data structures since I'm home taught. Is there a way I could fetch half the members in the collection and then fetch the other half so that I don't hit a timeout during the fetch()?
12 replies
DIAdiscord.js - Imagine an app
Created by Snapper on 11/9/2023 in #djs-questions
unable to access cache for member.roles
I thought I might be able to match them by id to the user, but that's also failing
12 replies
DIAdiscord.js - Imagine an app
Created by Snapper on 11/9/2023 in #djs-questions
unable to access cache for member.roles
so, I tried .get() and .has() but it looks like neither of them are a function of the collection that gets created when I fetch() the server members.
12 replies
DIAdiscord.js - Imagine an app
Created by Snapper on 11/9/2023 in #djs-questions
unable to access cache for member.roles
I'm still struggling a little bit with this one.
const reactions = await message.reactions.cache.get(":heart:");
const users = await reactions.users.fetch();
const members = await interaction.guild.members.fetch();
let updatedMembers = 0;

await users.forEach((user) => {
let guildMemberObject = members.find(member => member.id === user.id);
console.log(guildMemberObject);
const reactions = await message.reactions.cache.get(":heart:");
const users = await reactions.users.fetch();
const members = await interaction.guild.members.fetch();
let updatedMembers = 0;

await users.forEach((user) => {
let guildMemberObject = members.find(member => member.id === user.id);
console.log(guildMemberObject);
12 replies
DIAdiscord.js - Imagine an app
Created by Snapper on 11/9/2023 in #djs-questions
unable to access cache for member.roles
thank you for all the suggestions 🙂
12 replies
DIAdiscord.js - Imagine an app
Created by Snapper on 11/9/2023 in #djs-questions
unable to access cache for member.roles
oooh okay. I'll take a look into it for myself and come back if I still can't figure it out. Thank you for the hint!
12 replies
DIAdiscord.js - Imagine an app
Created by Snapper on 11/9/2023 in #djs-questions
client.channels.cache.get(channelId) returning undefined
I appreciate you Jo! You were helpful when I was first learning JS and you're still amazing today. Thanks homie
35 replies
DIAdiscord.js - Imagine an app
Created by Snapper on 11/9/2023 in #djs-questions
client.channels.cache.get(channelId) returning undefined
oh okay that actually makes a lot more sense. What's a good way to access the guild from the discord client? I would assume client.guild?
35 replies
DIAdiscord.js - Imagine an app
Created by Snapper on 11/9/2023 in #djs-questions
client.channels.cache.get(channelId) returning undefined
I should also mention that this method is failing as well
const members = await interaction.client.members.cache.array();
const members = await interaction.client.members.cache.array();
35 replies
DIAdiscord.js - Imagine an app
Created by Snapper on 11/9/2023 in #djs-questions
client.channels.cache.get(channelId) returning undefined
35 replies
DIAdiscord.js - Imagine an app
Created by Snapper on 11/9/2023 in #djs-questions
client.channels.cache.get(channelId) returning undefined
okay so I was able to get that working using fetch. For some reason I'm having a similar issue using it later down the line as well trying to get the members.
const members = await interaction.client.members.fetch()
.then(console.log)
.catch(error);
const members = await interaction.client.members.fetch()
.then(console.log)
.catch(error);
Throws the error:
TypeError: Cannot read properties of undefined (reading 'fetch')
TypeError: Cannot read properties of undefined (reading 'fetch')
35 replies
DIAdiscord.js - Imagine an app
Created by Snapper on 11/9/2023 in #djs-questions
client.channels.cache.get(channelId) returning undefined
TypeError: Cannot read properties of undefined (reading 'get')
at Object.execute (C:\Users\Owner\Desktop\BartleBot\src\commands\tools\verifyParse.js:16:36)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.execute (C:\Users\Owner\Desktop\BartleBot\src\events\client\interactionCreate.js:12:13)
TypeError: Cannot read properties of undefined (reading 'get')
at Object.execute (C:\Users\Owner\Desktop\BartleBot\src\commands\tools\verifyParse.js:16:36)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.execute (C:\Users\Owner\Desktop\BartleBot\src\events\client\interactionCreate.js:12:13)
Does this mean the client channel is reading as undefined?
35 replies
DIAdiscord.js - Imagine an app
Created by Snapper on 11/9/2023 in #djs-questions
client.channels.cache.get(channelId) returning undefined
oh hang on this is a different error
35 replies
DIAdiscord.js - Imagine an app
Created by Snapper on 11/9/2023 in #djs-questions
client.channels.cache.get(channelId) returning undefined

module.exports = {
data: new SlashCommandBuilder()
.setName("verify")
.setDescription("assign and remove the verify role for the rules."),


async execute(interaction, client) {
const botMessage = await interaction.deferReply({
fetchReply: true,
});

const message = await client.channels.get('1103869557849997403').messages.fetch('1164272120994463744');
console.log(message);

module.exports = {
data: new SlashCommandBuilder()
.setName("verify")
.setDescription("assign and remove the verify role for the rules."),


async execute(interaction, client) {
const botMessage = await interaction.deferReply({
fetchReply: true,
});

const message = await client.channels.get('1103869557849997403').messages.fetch('1164272120994463744');
console.log(message);
am I using this right? I'm still getting undefined
35 replies
DIAdiscord.js - Imagine an app
Created by Snapper on 11/9/2023 in #djs-questions
client.channels.cache.get(channelId) returning undefined
I'll give that a try 🙂
35 replies
DIAdiscord.js - Imagine an app
Created by Snapper on 11/9/2023 in #djs-questions
client.channels.cache.get(channelId) returning undefined
the variable for message is returning as undefined, so it's not able to find the message with the specific id
35 replies